Version Description
- Fixed: Some escaping issue
- Fixed: Elementor controller condition
- Fixed: Elementor controller css selector
Download this release
Release Info
Developer | techlabpro1 |
Plugin | ![]() |
Version | 4.2.1 |
Comparing to | |
See all releases |
Code changes from version 4.2.0 to 4.2.1
- README.txt +7 -2
- app/Controllers/GutenBergController.php +24 -55
- app/Controllers/Hooks/FilterHooks.php +34 -2
- app/Helpers/Fns.php +1106 -135
- app/RtTpg.php +2 -1
- app/Widgets/elementor/base.php +13 -103
- app/Widgets/elementor/rtTPGElementorHelper.php +68 -88
- app/Widgets/elementor/rtTPGElementorQuery.php +287 -58
- app/Widgets/elementor/widgets/grid-hover-layout-archive.php +10 -8
- app/Widgets/elementor/widgets/grid-hover-layout.php +10 -8
- app/Widgets/elementor/widgets/grid-layout-archive.php +11 -7
- app/Widgets/elementor/widgets/grid-layout.php +11 -10
- app/Widgets/elementor/widgets/list-layout-archive.php +7 -7
- app/Widgets/elementor/widgets/list-layout.php +11 -9
- app/Widgets/elementor/widgets/related-post.php +16 -15
- app/Widgets/elementor/widgets/slider-layout-archive.php +18 -18
- app/Widgets/elementor/widgets/slider-layout.php +27 -25
- assets/blocks/main.asset.php +1 -0
- assets/blocks/main.css +1598 -0
- assets/blocks/main.css.map +1 -0
- assets/blocks/main.js +17734 -0
README.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link:
|
|
4 |
Tags: post grid, content grid, post display, post slider, post grid elementor addon
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 6.0
|
7 |
-
Stable tag: 4.2.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -363,6 +363,11 @@ With the Post Grid PRO, you get to use the Single Page Builder, which is based o
|
|
363 |
|
364 |
== Changelog ==
|
365 |
|
|
|
|
|
|
|
|
|
|
|
366 |
= 4.2.0 =
|
367 |
* Fixed: Admin body class conflict fixed
|
368 |
* Fixed: Admin pagination fixed
|
@@ -480,4 +485,4 @@ With the Post Grid PRO, you get to use the Single Page Builder, which is based o
|
|
480 |
* Changed demo link
|
481 |
|
482 |
= 2.3.6.5 =
|
483 |
-
* Add New icon
|
4 |
Tags: post grid, content grid, post display, post slider, post grid elementor addon
|
5 |
Requires at least: 4.5
|
6 |
Tested up to: 6.0
|
7 |
+
Stable tag: 4.2.1
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
363 |
|
364 |
== Changelog ==
|
365 |
|
366 |
+
= 4.2.1 =
|
367 |
+
* Fixed: Some escaping issue
|
368 |
+
* Fixed: Elementor controller condition
|
369 |
+
* Fixed: Elementor controller css selector
|
370 |
+
|
371 |
= 4.2.0 =
|
372 |
* Fixed: Admin body class conflict fixed
|
373 |
* Fixed: Admin pagination fixed
|
485 |
* Changed demo link
|
486 |
|
487 |
= 2.3.6.5 =
|
488 |
+
* Add New icon
|
app/Controllers/GutenBergController.php
CHANGED
@@ -14,72 +14,41 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
14 |
exit( 'This script cannot be accessed directly.' );
|
15 |
}
|
16 |
|
17 |
-
/**
|
18 |
-
* Elementor Controller class.
|
19 |
-
*/
|
20 |
class GutenBergController {
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
if ( function_exists( 'register_block_type' ) ) {
|
29 |
-
register_block_type(
|
30 |
-
'rttpg/post-grid',
|
31 |
-
[ 'render_callback' => [ $this, 'render_shortcode' ] ]
|
32 |
-
);
|
33 |
}
|
34 |
}
|
35 |
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
* @return string
|
41 |
-
*/
|
42 |
-
public static function render_shortcode( $atts ) {
|
43 |
-
if ( ! isset( $atts['gridId'] ) && empty( isset( $atts['gridId'] ) ) ) {
|
44 |
-
return;
|
45 |
-
};
|
46 |
-
|
47 |
-
return do_shortcode( '[the-post-grid id="' . absint( $atts['gridId'] ) . '"]' );
|
48 |
}
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
* @return void
|
54 |
-
*/
|
55 |
-
public function block_assets() {
|
56 |
-
wp_enqueue_style( 'wp-blocks' );
|
57 |
}
|
58 |
|
59 |
-
|
60 |
-
* Block editor assets
|
61 |
-
*
|
62 |
-
* @return void
|
63 |
-
*/
|
64 |
-
public function block_editor_assets() {
|
65 |
// Scripts.
|
66 |
wp_enqueue_script(
|
67 |
'rt-tpg-cgb-block-js',
|
68 |
-
rtTPG()->get_assets_uri(
|
69 |
-
|
70 |
-
(
|
71 |
true
|
72 |
);
|
73 |
-
|
74 |
-
|
75 |
-
'
|
76 |
-
|
77 |
-
|
78 |
-
'short_codes' => Fns::getAllTPGShortCodeList(),
|
79 |
-
'icon' => rtTPG()->get_assets_uri( 'images/icon-16x16.png' ),
|
80 |
-
]
|
81 |
-
);
|
82 |
-
|
83 |
-
wp_enqueue_style( 'wp-edit-blocks' );
|
84 |
}
|
85 |
-
}
|
14 |
exit( 'This script cannot be accessed directly.' );
|
15 |
}
|
16 |
|
|
|
|
|
|
|
17 |
class GutenBergController {
|
18 |
+
function __construct() {
|
19 |
+
add_action('enqueue_block_assets', array($this, 'block_assets'));
|
20 |
+
add_action('enqueue_block_editor_assets', array($this, 'block_editor_assets'));
|
21 |
+
if(function_exists('register_block_type')) {
|
22 |
+
register_block_type('rttpg/post-grid', array(
|
23 |
+
'render_callback' => array($this,'render_shortcode'),
|
24 |
+
));
|
|
|
|
|
|
|
|
|
|
|
25 |
}
|
26 |
}
|
27 |
|
28 |
+
static function render_shortcode( $atts ){
|
29 |
+
if(!empty($atts['gridId']) && $id = absint($atts['gridId'])){
|
30 |
+
return do_shortcode( '[the-post-grid id="' . $id . '"]' );
|
31 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
+
|
35 |
+
function block_assets() {
|
36 |
+
wp_enqueue_style('wp-blocks');
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
+
function block_editor_assets() {
|
|
|
|
|
|
|
|
|
|
|
40 |
// Scripts.
|
41 |
wp_enqueue_script(
|
42 |
'rt-tpg-cgb-block-js',
|
43 |
+
rtTPG()->get_assets_uri('js/post-grid-blocks.js'),
|
44 |
+
array('wp-blocks', 'wp-i18n', 'wp-element'),
|
45 |
+
(defined('WP_DEBUG') && WP_DEBUG) ? time() : RT_THE_POST_GRID_VERSION,
|
46 |
true
|
47 |
);
|
48 |
+
wp_localize_script('rt-tpg-cgb-block-js', 'rttpgGB', array(
|
49 |
+
'short_codes' => Fns::getAllTPGShortCodeList(),
|
50 |
+
'icon' => rtTPG()->get_assets_uri('images/icon-16x16.png'),
|
51 |
+
));
|
52 |
+
wp_enqueue_style('wp-edit-blocks');
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
+
}
|
app/Controllers/Hooks/FilterHooks.php
CHANGED
@@ -14,6 +14,7 @@ use RT\ThePostGrid\Helpers\Fns;
|
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
exit( 'This script cannot be accessed directly.' );
|
16 |
}
|
|
|
17 |
/**
|
18 |
* Filter Hooks class.
|
19 |
*
|
@@ -37,18 +38,45 @@ class FilterHooks {
|
|
37 |
|
38 |
add_filter( 'wp_head', [ __CLASS__, 'set_post_view_count' ], 9999 );
|
39 |
add_filter( 'admin_body_class', [ __CLASS__, 'admin_body_class' ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
* Admin body class
|
44 |
*
|
45 |
* @param string $clsses Classes.
|
|
|
46 |
* @return string
|
47 |
*/
|
|
|
48 |
public static function admin_body_class( $clsses ) {
|
49 |
$settings = get_option( 'rt_the_post_grid_settings' );
|
50 |
|
51 |
-
if ( isset( $settings['tpg_block_type'] ) && in_array( $settings['tpg_block_type'], [ 'elementor', 'shortcode' ]
|
|
|
52 |
$clsses .= ' tpg-block-type-elementor-or-shortcode';
|
53 |
}
|
54 |
|
@@ -59,6 +87,7 @@ class FilterHooks {
|
|
59 |
* Set view count
|
60 |
*
|
61 |
* @param string $content Content.
|
|
|
62 |
* @return string
|
63 |
*/
|
64 |
public static function set_post_view_count( $content ) {
|
@@ -74,6 +103,7 @@ class FilterHooks {
|
|
74 |
* Filter author args.
|
75 |
*
|
76 |
* @param array $args Args.
|
|
|
77 |
* @return array
|
78 |
*/
|
79 |
public static function filter_author_args( $args ) {
|
@@ -85,8 +115,9 @@ class FilterHooks {
|
|
85 |
/**
|
86 |
* Add plugin row meta
|
87 |
*
|
88 |
-
* @param array
|
89 |
* @param string $file File.
|
|
|
90 |
* @return array
|
91 |
*/
|
92 |
public static function plugin_row_meta( $links, $file ) {
|
@@ -109,6 +140,7 @@ class FilterHooks {
|
|
109 |
* ACF content filter
|
110 |
*
|
111 |
* @param string $content Content.
|
|
|
112 |
* @return string
|
113 |
*/
|
114 |
public static function tpg_acf_content_filter( $content ) {
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
exit( 'This script cannot be accessed directly.' );
|
16 |
}
|
17 |
+
|
18 |
/**
|
19 |
* Filter Hooks class.
|
20 |
*
|
38 |
|
39 |
add_filter( 'wp_head', [ __CLASS__, 'set_post_view_count' ], 9999 );
|
40 |
add_filter( 'admin_body_class', [ __CLASS__, 'admin_body_class' ] );
|
41 |
+
add_filter( 'wp_kses_allowed_html', [ __CLASS__, 'tpg_custom_wpkses_post_tags' ], 10, 2 );
|
42 |
+
}
|
43 |
+
|
44 |
+
public static function tpg_custom_wpkses_post_tags( $tags, $context ) {
|
45 |
+
|
46 |
+
if ( 'post' === $context ) {
|
47 |
+
$tags['iframe'] = [
|
48 |
+
'src' => true,
|
49 |
+
'height' => true,
|
50 |
+
'width' => true,
|
51 |
+
'frameborder' => true,
|
52 |
+
'allowfullscreen' => true,
|
53 |
+
];
|
54 |
+
$tags['input'] = [
|
55 |
+
'type' => true,
|
56 |
+
'class' => true,
|
57 |
+
'placeholder' => true,
|
58 |
+
];
|
59 |
+
$tags['style'] = [
|
60 |
+
'src' => true,
|
61 |
+
];
|
62 |
+
}
|
63 |
+
|
64 |
+
return $tags;
|
65 |
}
|
66 |
|
67 |
/**
|
68 |
* Admin body class
|
69 |
*
|
70 |
* @param string $clsses Classes.
|
71 |
+
*
|
72 |
* @return string
|
73 |
*/
|
74 |
+
|
75 |
public static function admin_body_class( $clsses ) {
|
76 |
$settings = get_option( 'rt_the_post_grid_settings' );
|
77 |
|
78 |
+
if ( isset( $settings['tpg_block_type'] ) && in_array( $settings['tpg_block_type'], [ 'elementor', 'shortcode' ] ) ) {
|
79 |
+
|
80 |
$clsses .= ' tpg-block-type-elementor-or-shortcode';
|
81 |
}
|
82 |
|
87 |
* Set view count
|
88 |
*
|
89 |
* @param string $content Content.
|
90 |
+
*
|
91 |
* @return string
|
92 |
*/
|
93 |
public static function set_post_view_count( $content ) {
|
103 |
* Filter author args.
|
104 |
*
|
105 |
* @param array $args Args.
|
106 |
+
*
|
107 |
* @return array
|
108 |
*/
|
109 |
public static function filter_author_args( $args ) {
|
115 |
/**
|
116 |
* Add plugin row meta
|
117 |
*
|
118 |
+
* @param array $links Links.
|
119 |
* @param string $file File.
|
120 |
+
*
|
121 |
* @return array
|
122 |
*/
|
123 |
public static function plugin_row_meta( $links, $file ) {
|
140 |
* ACF content filter
|
141 |
*
|
142 |
* @param string $content Content.
|
143 |
+
*
|
144 |
* @return string
|
145 |
*/
|
146 |
public static function tpg_acf_content_filter( $content ) {
|
app/Helpers/Fns.php
CHANGED
@@ -34,9 +34,10 @@ class Fns {
|
|
34 |
/**
|
35 |
* Render view
|
36 |
*
|
37 |
-
* @param string
|
38 |
-
* @param array
|
39 |
* @param boolean $return Include/return.
|
|
|
40 |
* @return string
|
41 |
*/
|
42 |
public static function view( $viewName, $args = [], $return = false ) {
|
@@ -48,7 +49,7 @@ class Fns {
|
|
48 |
return new \WP_Error(
|
49 |
'brock',
|
50 |
sprintf(
|
51 |
-
|
52 |
esc_html__( '%s file not found', 'the-post-grid' ),
|
53 |
$viewFile
|
54 |
)
|
@@ -73,6 +74,7 @@ class Fns {
|
|
73 |
* Update post view
|
74 |
*
|
75 |
* @param integer $post_id Listing ID.
|
|
|
76 |
* @return void
|
77 |
*/
|
78 |
public static function update_post_views_count( $post_id ) {
|
@@ -107,7 +109,7 @@ class Fns {
|
|
107 |
* Template Content
|
108 |
*
|
109 |
* @param string $template_name Template name.
|
110 |
-
* @param array
|
111 |
* @param string $template_path Template path. (default: '').
|
112 |
* @param string $default_path Default path. (default: '').
|
113 |
*/
|
@@ -139,7 +141,7 @@ class Fns {
|
|
139 |
* Get template content and return
|
140 |
*
|
141 |
* @param string $template_name Template name.
|
142 |
-
* @param array
|
143 |
* @param string $template_path Template path. (default: '').
|
144 |
* @param string $default_path Default path. (default: '').
|
145 |
*
|
@@ -158,6 +160,7 @@ class Fns {
|
|
158 |
* @param string $template_name Template.
|
159 |
* @param string $template_path Path.
|
160 |
* @param string $default_path Default path.
|
|
|
161 |
* @return mixed|void
|
162 |
*/
|
163 |
public static function locate_template( $template_name, $template_path = '', $default_path = '' ) {
|
@@ -191,6 +194,7 @@ class Fns {
|
|
191 |
* @param string $function — The function that was called.
|
192 |
* @param string $message — A message explaining what has been done incorrectly.
|
193 |
* @param string $version — The version of WordPress where the message was added.
|
|
|
194 |
* @return void
|
195 |
*/
|
196 |
public static function doing_it_wrong( $function, $message, $version ) {
|
@@ -217,6 +221,794 @@ class Fns {
|
|
217 |
}
|
218 |
|
219 |
/**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
* All settings.
|
221 |
*
|
222 |
* @return array
|
@@ -426,7 +1218,7 @@ class Fns {
|
|
426 |
* Sanitize field value
|
427 |
*
|
428 |
* @param array $field
|
429 |
-
* @param null
|
430 |
*
|
431 |
* @return array|null
|
432 |
* @internal param $value
|
@@ -542,26 +1334,26 @@ class Fns {
|
|
542 |
$h .= '<div class="field-label"><label>' . esc_html( $label ) . '' . self::htmlKses( $proText, 'basic' ) . '</label></div>';
|
543 |
$h .= "<div class='field'>";
|
544 |
// color.
|
545 |
-
$h
|
546 |
-
$h
|
547 |
-
$h
|
548 |
$cValue = get_post_meta( get_the_ID(), $key . '_color', true );
|
549 |
-
$h
|
550 |
-
$h
|
551 |
-
$h
|
552 |
|
553 |
// Font size.
|
554 |
-
$h
|
555 |
-
$h
|
556 |
-
$h
|
557 |
-
$h
|
558 |
$fSizes = Options::scFontSize();
|
559 |
$sValue = get_post_meta( get_the_ID(), $key . '_size', true );
|
560 |
-
$h
|
561 |
|
562 |
foreach ( $fSizes as $size => $sizeLabel ) {
|
563 |
$sSlt = ( $size == $sValue ? 'selected' : null );
|
564 |
-
$h
|
565 |
}
|
566 |
|
567 |
$h .= '</select>';
|
@@ -569,17 +1361,17 @@ class Fns {
|
|
569 |
$h .= '</div>';
|
570 |
|
571 |
// Weight.
|
572 |
-
$h
|
573 |
-
$h
|
574 |
-
$h
|
575 |
-
$h
|
576 |
-
$h
|
577 |
$weights = Options::scTextWeight();
|
578 |
$wValue = get_post_meta( get_the_ID(), $key . '_weight', true );
|
579 |
|
580 |
foreach ( $weights as $weight => $weightLabel ) {
|
581 |
$wSlt = ( $weight == $wValue ? 'selected' : null );
|
582 |
-
$h
|
583 |
}
|
584 |
|
585 |
$h .= '</select>';
|
@@ -587,17 +1379,17 @@ class Fns {
|
|
587 |
$h .= '</div>';
|
588 |
|
589 |
// Alignment.
|
590 |
-
$h
|
591 |
-
$h
|
592 |
-
$h
|
593 |
-
$h
|
594 |
-
$h
|
595 |
$aligns = Options::scAlignment();
|
596 |
$aValue = get_post_meta( get_the_ID(), $key . '_alignment', true );
|
597 |
|
598 |
foreach ( $aligns as $align => $alignLabel ) {
|
599 |
$aSlt = ( $align == $aValue ? 'selected' : null );
|
600 |
-
$h
|
601 |
}
|
602 |
|
603 |
$h .= '</select>';
|
@@ -678,7 +1470,7 @@ class Fns {
|
|
678 |
}
|
679 |
|
680 |
public static function socialShare( $pLink ) {
|
681 |
-
$html
|
682 |
$html .= "<div class='single-tpg-share'>
|
683 |
<div class='fb-share'>
|
684 |
<div class='fb-share-button' data-href='" . esc_url( $pLink ) . "' data-layout='button_count'></div>
|
@@ -1019,7 +1811,7 @@ class Fns {
|
|
1019 |
}
|
1020 |
|
1021 |
if ( $paged > 1 && $showitems < $pages && ! $ajax ) {
|
1022 |
-
$p
|
1023 |
$html .= "<li><a data-paged='{$p}' href='" . get_pagenum_link( $p ) . "' aria-label='Previous'>‹</a></li>";
|
1024 |
}
|
1025 |
|
@@ -1036,7 +1828,7 @@ class Fns {
|
|
1036 |
}
|
1037 |
|
1038 |
if ( $paged < $pages && $showitems < $pages && ! $ajax ) {
|
1039 |
-
$p
|
1040 |
$html .= "<li><a data-paged='{$p}' href=\"" . get_pagenum_link( $paged + 1 ) . "\" aria-label='Next'>›</a></li>";
|
1041 |
}
|
1042 |
|
@@ -1064,10 +1856,10 @@ class Fns {
|
|
1064 |
* Call the Image resize model for resize function
|
1065 |
*
|
1066 |
* @param $url
|
1067 |
-
* @param null
|
1068 |
-
* @param null
|
1069 |
-
* @param null
|
1070 |
-
* @param bool|true
|
1071 |
* @param bool|false $upscale
|
1072 |
*
|
1073 |
* @return array|bool|string
|
@@ -1168,7 +1960,7 @@ class Fns {
|
|
1168 |
}
|
1169 |
|
1170 |
public static function layoutStyle( $layoutID, $scMeta, $layout, $scId = null ) {
|
1171 |
-
$css
|
1172 |
$css .= "<style type='text/css' media='all'>";
|
1173 |
// primary color
|
1174 |
if ( $scId ) {
|
@@ -1330,7 +2122,7 @@ class Fns {
|
|
1330 |
$css .= 'background-color:' . $primaryColor . ';';
|
1331 |
$css .= '}';
|
1332 |
|
1333 |
-
$ocp
|
1334 |
$primaryColor,
|
1335 |
! empty( $scMeta['overlay_opacity'][0] ) ? absint( $scMeta['overlay_opacity'][0] ) / 10 : .8
|
1336 |
);
|
@@ -1708,8 +2500,8 @@ class Fns {
|
|
1708 |
|
1709 |
if ( $title_size ) {
|
1710 |
$lineHeight = $title_size + 10;
|
1711 |
-
$css
|
1712 |
-
$css
|
1713 |
}
|
1714 |
|
1715 |
if ( $title_weight ) {
|
@@ -1922,6 +2714,15 @@ class Fns {
|
|
1922 |
return $plugin;
|
1923 |
}
|
1924 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1925 |
public static function get_groups_by_post_type( $post_type ) {
|
1926 |
$post_type = $post_type ? $post_type : 'post';
|
1927 |
$groups = [];
|
@@ -2015,35 +2816,35 @@ class Fns {
|
|
2015 |
}
|
2016 |
|
2017 |
if ( 'default' == $data['category_position']
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
|
2026 |
-
|
2027 |
-
|
2028 |
-
|
2029 |
-
|
2030 |
-
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
) {
|
2048 |
return false;
|
2049 |
}
|
@@ -2132,7 +2933,7 @@ class Fns {
|
|
2132 |
);
|
2133 |
$post_types = wp_list_pluck( $post_types, 'label', 'name' );
|
2134 |
|
2135 |
-
$exclude = [ 'attachment', 'revision', 'nav_menu_item', 'elementor_library', 'tpg_builder' ];
|
2136 |
|
2137 |
foreach ( $exclude as $ex ) {
|
2138 |
unset( $post_types[ $ex ] );
|
@@ -2177,11 +2978,15 @@ class Fns {
|
|
2177 |
$comments_text = sprintf( '%s (%s)', esc_html( $comment_label ), number_format_i18n( $comments_number ) );
|
2178 |
$date = get_the_date();
|
2179 |
|
2180 |
-
|
2181 |
-
|
2182 |
-
$
|
2183 |
-
$
|
2184 |
-
$
|
|
|
|
|
|
|
|
|
2185 |
|
2186 |
$count_key = self::get_post_view_count_meta_key();
|
2187 |
$get_view_count = get_post_meta( $post_id, $count_key, true );
|
@@ -2193,14 +2998,14 @@ class Fns {
|
|
2193 |
$post_meta_html = [];
|
2194 |
|
2195 |
ob_start();
|
2196 |
-
if ( ''
|
2197 |
$is_author_avatar = null;
|
2198 |
|
2199 |
if ( '' !== $data['show_author_image'] ) {
|
2200 |
$is_author_avatar = 'has-author-avatar';
|
2201 |
}
|
2202 |
?>
|
2203 |
-
|
2204 |
|
2205 |
<?php
|
2206 |
if ( '' !== $data['show_author_image'] ) {
|
@@ -2238,17 +3043,18 @@ class Fns {
|
|
2238 |
|
2239 |
if ( $category_condition ) {
|
2240 |
?>
|
2241 |
-
|
2242 |
<?php
|
2243 |
if ( $data['show_meta_icon'] === 'yes' ) {
|
2244 |
if ( isset( $data['cat_icon']['value'] ) && $data['cat_icon']['value'] ) {
|
2245 |
\Elementor\Icons_Manager::render_icon( $data['cat_icon'], [ 'aria-hidden' => 'true' ] );
|
2246 |
} else {
|
2247 |
-
echo "<i class='
|
2248 |
}
|
2249 |
}
|
2250 |
echo wp_kses( $categories, self::allowedHtml() );
|
2251 |
?>
|
|
|
2252 |
</span>
|
2253 |
<?php
|
2254 |
echo wp_kses( $meta_separator, self::allowedHtml() );
|
@@ -2263,14 +3069,14 @@ class Fns {
|
|
2263 |
$archive_day = get_the_date( 'j' );
|
2264 |
|
2265 |
?>
|
2266 |
-
<span class='date'>
|
2267 |
|
|
|
2268 |
<?php
|
2269 |
if ( $data['show_meta_icon'] === 'yes' ) {
|
2270 |
if ( isset( $data['date_icon']['value'] ) && $data['date_icon']['value'] ) {
|
2271 |
\Elementor\Icons_Manager::render_icon( $data['date_icon'], [ 'aria-hidden' => 'true' ] );
|
2272 |
} else {
|
2273 |
-
echo "<i class='
|
2274 |
}
|
2275 |
}
|
2276 |
?>
|
@@ -2288,13 +3094,14 @@ class Fns {
|
|
2288 |
// Tags Meta.
|
2289 |
if ( $tags && 'show' == $data['show_tags'] ) {
|
2290 |
?>
|
2291 |
-
|
|
|
2292 |
<?php
|
2293 |
if ( $data['show_meta_icon'] === 'yes' ) {
|
2294 |
if ( isset( $data['tag_icon']['value'] ) && $data['tag_icon']['value'] ) {
|
2295 |
\Elementor\Icons_Manager::render_icon( $data['tag_icon'], [ 'aria-hidden' => 'true' ] );
|
2296 |
} else {
|
2297 |
-
echo "<i class='fa fa-
|
2298 |
}
|
2299 |
}
|
2300 |
echo wp_kses( $tags, self::allowedHtml() );
|
@@ -2309,13 +3116,13 @@ class Fns {
|
|
2309 |
// Comment Meta.
|
2310 |
if ( 'show' == $data['show_comment_count'] ) {
|
2311 |
?>
|
2312 |
-
|
2313 |
<?php
|
2314 |
if ( $data['show_meta_icon'] === 'yes' ) {
|
2315 |
if ( isset( $data['comment_icon']['value'] ) && $data['comment_icon']['value'] ) {
|
2316 |
\Elementor\Icons_Manager::render_icon( $data['comment_icon'], [ 'aria-hidden' => 'true' ] );
|
2317 |
} else {
|
2318 |
-
echo "<i class='
|
2319 |
}
|
2320 |
}
|
2321 |
echo wp_kses( $comments_text, self::allowedHtml() );
|
@@ -2331,7 +3138,7 @@ class Fns {
|
|
2331 |
// Post Count.
|
2332 |
if ( rtTPG()->hasPro() && 'show' == $data['show_post_count'] && ! empty( $get_view_count ) ) {
|
2333 |
?>
|
2334 |
-
|
2335 |
<?php
|
2336 |
if ( $data['show_meta_icon'] === 'yes' ) {
|
2337 |
if ( isset( $data['post_count_icon']['value'] ) && $data['post_count_icon']['value'] ) {
|
@@ -2349,11 +3156,34 @@ class Fns {
|
|
2349 |
|
2350 |
$post_meta_html['post_count'] = ob_get_clean();
|
2351 |
|
2352 |
-
$meta_orering = isset( $data['meta_ordering'] ) && is_array( $data['meta_ordering'] ) ? $data['meta_ordering'] : [];
|
2353 |
|
2354 |
-
|
2355 |
-
|
2356 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2357 |
}
|
2358 |
}
|
2359 |
}
|
@@ -2415,19 +3245,20 @@ class Fns {
|
|
2415 |
|
2416 |
$pID = get_the_ID();
|
2417 |
$_cat_id = $data['post_type'] . '_taxonomy';
|
2418 |
-
$
|
|
|
2419 |
$category_position = $data['category_position'];
|
2420 |
|
2421 |
if ( in_array( $data['layout'], [ 'grid-layout4' ] ) && 'default' === $data['category_position'] ) {
|
2422 |
$category_position = 'top_left';
|
2423 |
}
|
2424 |
?>
|
2425 |
-
|
2426 |
<span class='categories-links'>
|
2427 |
<?php echo ( 'yes' === $data['show_cat_icon'] ) ? "<i class='fas fa-folder-open'></i>" : null; ?>
|
2428 |
<?php echo wp_kses( $categories, self::allowedHtml() ); ?>
|
2429 |
</span>
|
2430 |
-
|
2431 |
<?php
|
2432 |
}
|
2433 |
|
@@ -2436,7 +3267,7 @@ class Fns {
|
|
2436 |
* Get first image from the content
|
2437 |
*
|
2438 |
* @param $post_id
|
2439 |
-
* @param string
|
2440 |
*
|
2441 |
* @return mixed|string
|
2442 |
*/
|
@@ -2485,20 +3316,14 @@ class Fns {
|
|
2485 |
* @param $data
|
2486 |
* @param $link_start
|
2487 |
* @param $link_end
|
2488 |
-
* @param false
|
2489 |
*/
|
2490 |
public static function get_post_thumbnail( $pID, $data, $link_start, $link_end, $offset_size = false ) {
|
2491 |
$thumb_cat_condition = ( ! ( 'above_title' === $data['category_position'] || 'default' === $data['category_position'] ) );
|
2492 |
|
2493 |
if ( 'grid-layout4' === $data['layout'] && 'default' === $data['category_position'] ) {
|
2494 |
$thumb_cat_condition = true;
|
2495 |
-
} elseif ( in_array(
|
2496 |
-
$data['layout'],
|
2497 |
-
[
|
2498 |
-
'grid-layout4',
|
2499 |
-
'grid_hover-layout11',
|
2500 |
-
]
|
2501 |
-
) && 'default' === $data['category_position'] ) {
|
2502 |
$thumb_cat_condition = true;
|
2503 |
}
|
2504 |
|
@@ -2507,10 +3332,11 @@ class Fns {
|
|
2507 |
}
|
2508 |
|
2509 |
$img_link = get_the_post_thumbnail_url( $pID, 'full' );
|
2510 |
-
$img_size_key = '
|
|
|
2511 |
|
2512 |
if ( $offset_size ) {
|
2513 |
-
$img_size_key = '
|
2514 |
}
|
2515 |
|
2516 |
$lazy_load = ( $data['prefix'] == 'slider' && $data['lazy_load'] == 'yes' ) ? true : false;
|
@@ -2520,7 +3346,7 @@ class Fns {
|
|
2520 |
$lazy_class = 'swiper-lazy';
|
2521 |
}
|
2522 |
|
2523 |
-
echo 'yes' === $data['is_thumb_linked'] ?
|
2524 |
|
2525 |
if ( has_post_thumbnail() && 'feature_image' === $data['media_source'] ) {
|
2526 |
$fImgSize = $data['image_size'];
|
@@ -2534,20 +3360,20 @@ class Fns {
|
|
2534 |
$thumb_alt = trim( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) );
|
2535 |
if ( $lazy_load ) {
|
2536 |
?>
|
2537 |
-
|
2538 |
-
|
2539 |
-
|
2540 |
-
|
2541 |
-
|
2542 |
-
|
2543 |
<?php
|
2544 |
} else {
|
2545 |
?>
|
2546 |
-
|
2547 |
-
|
2548 |
-
|
2549 |
-
|
2550 |
-
|
2551 |
<?php
|
2552 |
}
|
2553 |
?>
|
@@ -2559,6 +3385,13 @@ class Fns {
|
|
2559 |
$defaultImgId = null;
|
2560 |
$customImgSize = [];
|
2561 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2562 |
if ( isset( $data['image_custom_dimension'] ) ) {
|
2563 |
$post_thumb_id = get_post_thumbnail_id( $pID );
|
2564 |
$default_image_dimension = wp_get_attachment_image_src( $post_thumb_id, 'full' );
|
@@ -2579,8 +3412,10 @@ class Fns {
|
|
2579 |
echo wp_kses_post( self::get_content_first_image( $pID, 'markup', $lazy_class ) );
|
2580 |
$img_link = self::get_content_first_image( $pID, 'url' );
|
2581 |
} elseif ( 'yes' === $data['is_default_img'] || 'grid_hover' == $data['prefix'] ) {
|
2582 |
-
echo \Elementor\Group_Control_Image_Size::get_attachment_image_html( $data, $img_size_key, 'default_image' );
|
2583 |
-
|
|
|
|
|
2584 |
if ( ! empty( $data['default_image'] ) && isset( $data['default_image']['url'] ) ) {
|
2585 |
$img_link = $data['default_image']['url'];
|
2586 |
}
|
@@ -2588,7 +3423,7 @@ class Fns {
|
|
2588 |
|
2589 |
?>
|
2590 |
<?php if ( $lazy_load ) : ?>
|
2591 |
-
|
2592 |
<?php endif; ?>
|
2593 |
|
2594 |
<?php echo 'yes' === $data['is_thumb_linked'] ? wp_kses( $link_end, self::allowedHtml() ) : null; ?>
|
@@ -2596,11 +3431,12 @@ class Fns {
|
|
2596 |
<?php
|
2597 |
if ( 'show' === $data['is_thumb_lightbox'] || ( in_array( $data['layout'], [ 'grid-layout7', 'slider-layout4' ] ) && in_array( $data['is_thumb_lightbox'], [ 'default', 'show' ] ) ) ) :
|
2598 |
?>
|
2599 |
-
|
2600 |
-
|
2601 |
-
|
2602 |
-
|
2603 |
-
|
|
|
2604 |
|
2605 |
<?php
|
2606 |
if ( isset( $data['light_box_icon']['value'] ) && $data['light_box_icon']['value'] ) {
|
@@ -2609,9 +3445,10 @@ class Fns {
|
|
2609 |
echo "<i class='fa fa-plus'></i>";
|
2610 |
}
|
2611 |
?>
|
2612 |
-
|
|
|
2613 |
<?php endif; ?>
|
2614 |
-
|
2615 |
<?php
|
2616 |
}
|
2617 |
|
@@ -2632,6 +3469,7 @@ class Fns {
|
|
2632 |
if ( isset( $data['show_acf'] ) && 'show' == $data['show_acf'] ) {
|
2633 |
$cf_group = $data['cf_group'];
|
2634 |
|
|
|
2635 |
$format = [
|
2636 |
'hide_empty' => ( isset( $data['cf_hide_empty_value'] ) && $data['cf_hide_empty_value'] ) ? 'yes' : '',
|
2637 |
'show_value' => ( isset( $data['cf_show_only_value'] ) && $data['cf_show_only_value'] ) ? '' : 'yes',
|
@@ -2639,7 +3477,14 @@ class Fns {
|
|
2639 |
];
|
2640 |
|
2641 |
if ( ! empty( $cf_group ) ) {
|
2642 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2643 |
$acf_html .= Functions::get_cf_formatted_fields( $cf_group, $format, $pID );
|
2644 |
$acf_html .= '</div>';
|
2645 |
|
@@ -2662,12 +3507,12 @@ class Fns {
|
|
2662 |
*/
|
2663 |
public static function is_filter_enable( $data ) {
|
2664 |
if ( rtTPG()->hasPro()
|
2665 |
-
|
2666 |
-
|
2667 |
-
|
2668 |
-
|
2669 |
-
|
2670 |
-
|
2671 |
) {
|
2672 |
return true;
|
2673 |
}
|
@@ -2675,11 +3520,136 @@ class Fns {
|
|
2675 |
return false;
|
2676 |
}
|
2677 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2678 |
/**
|
2679 |
* Prints HTML.
|
2680 |
*
|
2681 |
* @param string $html HTML.
|
2682 |
-
* @param bool
|
2683 |
*
|
2684 |
* @return mixed
|
2685 |
*/
|
@@ -2858,3 +3828,4 @@ class Fns {
|
|
2858 |
return wp_kses( $string, self::allowedHtml( $level ) );
|
2859 |
}
|
2860 |
}
|
|
34 |
/**
|
35 |
* Render view
|
36 |
*
|
37 |
+
* @param string $viewName View name.
|
38 |
+
* @param array $args Args.
|
39 |
* @param boolean $return Include/return.
|
40 |
+
*
|
41 |
* @return string
|
42 |
*/
|
43 |
public static function view( $viewName, $args = [], $return = false ) {
|
49 |
return new \WP_Error(
|
50 |
'brock',
|
51 |
sprintf(
|
52 |
+
/* translators: %s File name */
|
53 |
esc_html__( '%s file not found', 'the-post-grid' ),
|
54 |
$viewFile
|
55 |
)
|
74 |
* Update post view
|
75 |
*
|
76 |
* @param integer $post_id Listing ID.
|
77 |
+
*
|
78 |
* @return void
|
79 |
*/
|
80 |
public static function update_post_views_count( $post_id ) {
|
109 |
* Template Content
|
110 |
*
|
111 |
* @param string $template_name Template name.
|
112 |
+
* @param array $args Arguments. (default: array).
|
113 |
* @param string $template_path Template path. (default: '').
|
114 |
* @param string $default_path Default path. (default: '').
|
115 |
*/
|
141 |
* Get template content and return
|
142 |
*
|
143 |
* @param string $template_name Template name.
|
144 |
+
* @param array $args Arguments. (default: array).
|
145 |
* @param string $template_path Template path. (default: '').
|
146 |
* @param string $default_path Default path. (default: '').
|
147 |
*
|
160 |
* @param string $template_name Template.
|
161 |
* @param string $template_path Path.
|
162 |
* @param string $default_path Default path.
|
163 |
+
*
|
164 |
* @return mixed|void
|
165 |
*/
|
166 |
public static function locate_template( $template_name, $template_path = '', $default_path = '' ) {
|
194 |
* @param string $function — The function that was called.
|
195 |
* @param string $message — A message explaining what has been done incorrectly.
|
196 |
* @param string $version — The version of WordPress where the message was added.
|
197 |
+
*
|
198 |
* @return void
|
199 |
*/
|
200 |
public static function doing_it_wrong( $function, $message, $version ) {
|
221 |
}
|
222 |
|
223 |
/**
|
224 |
+
* @param $data
|
225 |
+
* @param $temp_path
|
226 |
+
*
|
227 |
+
* @return void
|
228 |
+
*/
|
229 |
+
public static function tpg_template( $data, $temp_path = 'elementor' ) {
|
230 |
+
$layout = str_replace( '-2', '', $data['layout'] );
|
231 |
+
|
232 |
+
$template_name = '/the-post-grid/' . $temp_path . '/' . $layout . '.php';
|
233 |
+
if ( file_exists( STYLESHEETPATH . $template_name ) ) {
|
234 |
+
$file = STYLESHEETPATH . $template_name;
|
235 |
+
} elseif ( file_exists( TEMPLATEPATH . $template_name ) ) {
|
236 |
+
$file = TEMPLATEPATH . $template_name;
|
237 |
+
} else {
|
238 |
+
$file = RT_THE_POST_GRID_PLUGIN_PATH . '/templates/' . $temp_path . '/' . $layout . '.php';
|
239 |
+
if ( ! file_exists( $file ) ) {
|
240 |
+
if ( rtTPG()->hasPro() ) {
|
241 |
+
$file = RT_THE_POST_GRID_PRO_PLUGIN_PATH . '/templates/' . $temp_path . '/' . $layout . '.php';
|
242 |
+
} else {
|
243 |
+
$layout = substr( $layout, 0, - 1 );
|
244 |
+
$layout = strpos( $layout, '1' ) ? str_replace( '1', '', $layout ) : $layout;
|
245 |
+
$file = RT_THE_POST_GRID_PLUGIN_PATH . '/templates/' . $temp_path . '/' . $layout . '1.php';
|
246 |
+
}
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
ob_start();
|
251 |
+
include $file;
|
252 |
+
echo ob_get_clean();
|
253 |
+
}
|
254 |
+
|
255 |
+
/**
|
256 |
+
* @param $data
|
257 |
+
*
|
258 |
+
* @return string
|
259 |
+
*/
|
260 |
+
public static function tpg_template_path( $data, $temp_path = 'elementor' ) {
|
261 |
+
$layout = str_replace( '-2', '', $data['layout'] );
|
262 |
+
$template_name = '/the-post-grid/' . $temp_path . '/' . $layout . '.php';
|
263 |
+
$path = RT_THE_POST_GRID_PLUGIN_PATH . '/templates/' . $temp_path . '/';
|
264 |
+
if ( file_exists( STYLESHEETPATH . $template_name ) ) {
|
265 |
+
$path = STYLESHEETPATH . '/the-post-grid/' . $temp_path . '/';
|
266 |
+
} elseif ( file_exists( TEMPLATEPATH . $template_name ) ) {
|
267 |
+
$path = TEMPLATEPATH . '/the-post-grid/' . $temp_path . '/';
|
268 |
+
} else {
|
269 |
+
$template_path = RT_THE_POST_GRID_PLUGIN_PATH . '/templates/' . $temp_path . '/' . $layout . '.php';
|
270 |
+
|
271 |
+
if ( ! file_exists( $template_path ) && rtTPG()->hasPro() ) {
|
272 |
+
$path = RT_THE_POST_GRID_PRO_PLUGIN_PATH . '/templates/' . $temp_path . '/';
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
return $path;
|
277 |
+
}
|
278 |
+
|
279 |
+
/**
|
280 |
+
* Get Post Pagination, Load more & Scroll markup
|
281 |
+
*
|
282 |
+
* @param $query
|
283 |
+
* @param $data
|
284 |
+
*
|
285 |
+
* @return false|string|void
|
286 |
+
*/
|
287 |
+
public static function get_pagination_markup( $query, $data ) {
|
288 |
+
if ( 'show' !== $data['show_pagination'] ) {
|
289 |
+
return;
|
290 |
+
}
|
291 |
+
|
292 |
+
$htmlUtility = null;
|
293 |
+
|
294 |
+
$posts_loading_type = $data['pagination_type'];
|
295 |
+
|
296 |
+
$posts_per_page = ( isset( $data['display_per_page'] ) && $data['display_per_page'] ) ? $data['display_per_page']
|
297 |
+
: ( $data['post_limit'] ? $data['post_limit'] : get_option( 'posts_per_page' ) );
|
298 |
+
$hide = ( $query->max_num_pages < 2 ? " rt-hidden-elm" : null );
|
299 |
+
|
300 |
+
if ( $posts_loading_type == "pagination" ) {
|
301 |
+
$htmlUtility .= Fns::rt_pagination( $query, $posts_per_page );
|
302 |
+
} elseif ( rtTPG()->hasPro() && $posts_loading_type == "pagination_ajax" ) { //&& ! $isIsotope
|
303 |
+
$htmlUtility .= "<div class='rt-page-numbers'></div>";
|
304 |
+
} elseif ( rtTPG()->hasPro() && $posts_loading_type == "load_more" ) {
|
305 |
+
$htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style{$hide}'>
|
306 |
+
<span class='rt-loadmore-text'>" . __( 'Load More', 'the-post-grid' ) . "</span>
|
307 |
+
<div class='rt-loadmore-loading rt-ball-scale-multiple rt-2x'><div></div><div></div><div></div></div>
|
308 |
+
</div>";
|
309 |
+
} elseif ( rtTPG()->hasPro() && $posts_loading_type == "load_on_scroll" ) {
|
310 |
+
$htmlUtility .= "<div class='rt-infinite-action'>
|
311 |
+
<div class='rt-infinite-loading la-fire la-2x'>
|
312 |
+
<div></div><div></div><div></div>
|
313 |
+
</div>
|
314 |
+
</div>";
|
315 |
+
}
|
316 |
+
|
317 |
+
|
318 |
+
if ( $htmlUtility ) {
|
319 |
+
$html = "<div class='rt-pagination-wrap' data-total-pages='{$query->max_num_pages}' data-posts-per-page='{$posts_per_page}' data-type='{$posts_loading_type}' >"
|
320 |
+
. $htmlUtility . "</div>";
|
321 |
+
|
322 |
+
return $html;
|
323 |
+
}
|
324 |
+
|
325 |
+
return false;
|
326 |
+
}
|
327 |
+
|
328 |
+
|
329 |
+
/**
|
330 |
+
* @param $data
|
331 |
+
* @param $total_pages
|
332 |
+
* @param $posts_per_page
|
333 |
+
* @param $_prefix
|
334 |
+
*
|
335 |
+
* @return array
|
336 |
+
*/
|
337 |
+
public static function get_render_data_set( $data, $total_pages, $posts_per_page, $_prefix, $is_gutenberg = '' ) {
|
338 |
+
|
339 |
+
$data_set = [
|
340 |
+
'block_type' => 'elementor',
|
341 |
+
'is_gutenberg' => $is_gutenberg,
|
342 |
+
'prefix' => $_prefix,
|
343 |
+
'grid_column' => $data[ $_prefix . '_column' ],
|
344 |
+
'grid_column_tablet' => isset( $data[ $_prefix . '_column_tablet' ] ) ? $data[ $_prefix . '_column_tablet' ] : '0',
|
345 |
+
'grid_column_mobile' => isset( $data[ $_prefix . '_column_mobile' ] ) ? $data[ $_prefix . '_column_mobile' ] : '0',
|
346 |
+
'layout' => $data[ $_prefix . '_layout' ],
|
347 |
+
'pagination_type' => 'slider' === $_prefix ? 'slider' : $data['pagination_type'],
|
348 |
+
'total_pages' => $total_pages,
|
349 |
+
'posts_per_page' => $posts_per_page,
|
350 |
+
'layout_style' => isset( $data[ $_prefix . '_layout_style' ] ) ? $data[ $_prefix . '_layout_style' ] : '',
|
351 |
+
'show_title' => $data['show_title'],
|
352 |
+
'excerpt_type' => $data['excerpt_type'],
|
353 |
+
'excerpt_limit' => $data['excerpt_limit'],
|
354 |
+
'excerpt_more_text' => $data['excerpt_more_text'],
|
355 |
+
'title_limit' => $data['title_limit'],
|
356 |
+
'title_limit_type' => $data['title_limit_type'],
|
357 |
+
'title_visibility_style' => $data['title_visibility_style'],
|
358 |
+
'post_link_type' => $data['post_link_type'],
|
359 |
+
'link_target' => $data['link_target'],
|
360 |
+
'hover_animation' => isset( $data['hover_animation'] ) ? $data['hover_animation'] : '',
|
361 |
+
'show_thumb' => $data['show_thumb'],
|
362 |
+
'show_meta' => $data['show_meta'],
|
363 |
+
'show_author' => $data['show_author'],
|
364 |
+
'show_author_image' => $data['show_author_image'],
|
365 |
+
'show_meta_icon' => $data['show_meta_icon'],
|
366 |
+
'show_category' => $data['show_category'],
|
367 |
+
'show_date' => $data['show_date'],
|
368 |
+
'show_tags' => $data['show_tags'],
|
369 |
+
'show_comment_count' => $data['show_comment_count'],
|
370 |
+
'show_comment_count_label' => isset( $data['show_comment_count_label'] ) ? $data['show_comment_count_label'] : '',
|
371 |
+
'comment_count_label_singular' => isset( $data['comment_count_label_singular'] ) ? $data['comment_count_label_singular'] : '',
|
372 |
+
'comment_count_label_plural' => isset( $data['comment_count_label_plural'] ) ? $data['comment_count_label_plural'] : '',
|
373 |
+
'show_post_count' => $data['show_post_count'],
|
374 |
+
'post_count_icon' => isset( $data['post_count_icon'] ) ? $data['post_count_icon'] : '',
|
375 |
+
'show_excerpt' => $data['show_excerpt'],
|
376 |
+
'show_read_more' => $data['show_read_more'],
|
377 |
+
'show_btn_icon' => $data['show_btn_icon'],
|
378 |
+
'show_social_share' => $data['show_social_share'],
|
379 |
+
'show_cat_icon' => isset( $data['show_cat_icon'] ) ? $data['show_cat_icon'] : '',
|
380 |
+
'is_thumb_linked' => $data['is_thumb_linked'],
|
381 |
+
'media_source' => $data['media_source'],
|
382 |
+
'no_posts_found_text' => isset( $data['no_posts_found_text'] ) ? $data['no_posts_found_text'] : '',
|
383 |
+
'image_size' => $data['image_size'],
|
384 |
+
'image_offset' => $data['image_offset_size'],
|
385 |
+
|
386 |
+
'is_default_img' => $data['is_default_img'],
|
387 |
+
'default_image' => $data['default_image'],
|
388 |
+
'thumb_overlay_visibility' => isset( $data['thumb_overlay_visibility'] ) ? $data['thumb_overlay_visibility'] : '',
|
389 |
+
'overlay_type' => isset( $data['overlay_type'] ) ? $data['overlay_type'] : '',
|
390 |
+
'title_tag' => $data['title_tag'],
|
391 |
+
'post_type' => $data['post_type'],
|
392 |
+
'meta_separator' => $data['meta_separator'],
|
393 |
+
'readmore_icon_position' => $data['readmore_icon_position'],
|
394 |
+
'read_more_label' => $data['read_more_label'],
|
395 |
+
'readmore_btn_icon' => $data['readmore_btn_icon'],
|
396 |
+
'category_position' => $data['category_position'],
|
397 |
+
'title_position' => $data['title_position'],
|
398 |
+
'category_style' => $data['category_style'],
|
399 |
+
'is_thumb_lightbox' => $data['is_thumb_lightbox'],
|
400 |
+
'author_prefix' => $data['author_prefix'],
|
401 |
+
'cat_icon' => isset( $data['cat_icon'] ) ? $data['cat_icon'] : '',
|
402 |
+
'tag_icon' => isset( $data['tag_icon'] ) ? $data['tag_icon'] : '',
|
403 |
+
'date_icon' => isset( $data['date_icon'] ) ? $data['date_icon'] : '',
|
404 |
+
'user_icon' => isset( $data['user_icon'] ) ? $data['user_icon'] : '',
|
405 |
+
'meta_ordering' => $data['meta_ordering'],
|
406 |
+
'comment_icon' => isset( $data['comment_icon'] ) ? $data['comment_icon'] : '',
|
407 |
+
'image_custom_dimension' => ( $data['image_size'] == 'custom' && isset( $data['image_custom_dimension'] ) ) ? $data['image_custom_dimension'] : [],
|
408 |
+
'img_crop_style' => ( $data['image_size'] == 'custom' && isset( $data['img_crop_style'] ) ) ? $data['img_crop_style'] : '',
|
409 |
+
'show_acf' => isset( $data['show_acf'] ) ? $data['show_acf'] : '',
|
410 |
+
];
|
411 |
+
|
412 |
+
$cf = Fns::is_acf();
|
413 |
+
if ( $cf && rtTPG()->hasPro() ) {
|
414 |
+
$post_type = $data['post_type'];
|
415 |
+
if ( $is_gutenberg && isset( $data['acf_data_lists'][ $post_type . '_cf_group' ] ) ) {
|
416 |
+
$cf_group = $data['acf_data_lists'][ $post_type . '_cf_group' ]['options'];
|
417 |
+
$data_set['cf_group'] = wp_list_pluck( $cf_group, 'value' );
|
418 |
+
} else {
|
419 |
+
$data_set['cf_group'] = $data[ $post_type . '_cf_group' ];
|
420 |
+
}
|
421 |
+
$data_set['cf_hide_empty_value'] = $data['cf_hide_empty_value'];
|
422 |
+
$data_set['cf_show_only_value'] = $data['cf_show_only_value'];
|
423 |
+
$data_set['cf_hide_group_title'] = $data['cf_hide_group_title'];
|
424 |
+
}
|
425 |
+
if ( $is_gutenberg ) {
|
426 |
+
unset( $data_set['grid_column'] );
|
427 |
+
unset( $data_set['grid_column_mobile'] );
|
428 |
+
unset( $data_set['grid_column_mobile'] );
|
429 |
+
$data_set['c_image_width'] = isset( $data['c_image_width'] ) ? $data['c_image_width'] : '';
|
430 |
+
$data_set['c_image_height'] = isset( $data['c_image_height'] ) ? $data['c_image_height'] : '';
|
431 |
+
$data_set['grid_column'] = (array) $data[ $_prefix . '_column' ];
|
432 |
+
}
|
433 |
+
|
434 |
+
return $data_set;
|
435 |
+
}
|
436 |
+
|
437 |
+
|
438 |
+
/**
|
439 |
+
* Get Filter markup
|
440 |
+
*
|
441 |
+
* @param $data
|
442 |
+
*
|
443 |
+
* @return string
|
444 |
+
*/
|
445 |
+
public static function get_frontend_filter_markup( $data ) {
|
446 |
+
if ( ! rtTPG()->hasPro()
|
447 |
+
|| ! ( $data['show_taxonomy_filter'] == 'show' || $data['show_author_filter'] == 'show' || $data['show_order_by'] == 'show'
|
448 |
+
|| $data['show_sort_order'] == 'show'
|
449 |
+
|| $data['show_search'] == 'show' )
|
450 |
+
) {
|
451 |
+
return;
|
452 |
+
}
|
453 |
+
|
454 |
+
$html = null;
|
455 |
+
$wrapperContainer = $wrapperClass = $itemClass = $filter_btn_item_per_page = '';
|
456 |
+
|
457 |
+
if ( 'carousel' === $data['filter_btn_style'] ) {
|
458 |
+
$wrapperContainer = 'swiper';
|
459 |
+
$wrapperClass = 'swiper-wrapper';
|
460 |
+
$itemClass = 'swiper-slide';
|
461 |
+
$filter_btn_mobile = isset( $data['filter_btn_item_per_page_mobile'] ) ? $data['filter_btn_item_per_page_mobile'] : 'auto';
|
462 |
+
$filter_btn_tablet = isset( $data['filter_btn_item_per_page_tablet'] ) ? $data['filter_btn_item_per_page_tablet'] : 'auto';
|
463 |
+
$filter_btn_item_per_page
|
464 |
+
= "data-per-page = '{$data['filter_btn_item_per_page']}' data-per-page-mobile = '{$filter_btn_mobile}' data-per-tablet = '{$filter_btn_tablet}'";
|
465 |
+
}
|
466 |
+
|
467 |
+
$html .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
|
468 |
+
|
469 |
+
if ( 'show' == $data['show_author_filter'] || 'show' == $data['show_taxonomy_filter'] ) {
|
470 |
+
$html .= "<div class='filter-left-wrapper {$wrapperContainer}' {$filter_btn_item_per_page}>";
|
471 |
+
}
|
472 |
+
// if($data['filter_btn_style'] == 'carousel') {
|
473 |
+
// $html .= "<div class='swiper-pagination'></div>";
|
474 |
+
// }
|
475 |
+
$selectedSubTermsForButton = null;
|
476 |
+
|
477 |
+
$filterType = $data['filter_type'];
|
478 |
+
$post_count = ( 'yes' == $data['filter_post_count'] ) ? true : false;
|
479 |
+
|
480 |
+
|
481 |
+
if ( 'show' == $data['show_taxonomy_filter'] ) {
|
482 |
+
$postCountClass = ( $post_count ? " has-post-count" : null );
|
483 |
+
$allSelect = " selected";
|
484 |
+
$isTermSelected = false;
|
485 |
+
|
486 |
+
$taxFilterOperator = $data['relation'];
|
487 |
+
|
488 |
+
$section_term_key = $data['post_type'] . '_filter_taxonomy';
|
489 |
+
$taxFilter = $data[ $section_term_key ];
|
490 |
+
|
491 |
+
$taxonomy_label = $default_term = '';
|
492 |
+
|
493 |
+
if ( $taxFilter ) {
|
494 |
+
$taxonomy_details = get_taxonomy( $taxFilter );
|
495 |
+
$taxonomy_label = $taxonomy_details->label;
|
496 |
+
$default_term_key = $taxFilter . '_default_terms';
|
497 |
+
$default_term = $data[ $default_term_key ];
|
498 |
+
}
|
499 |
+
|
500 |
+
|
501 |
+
$allText = $data['tax_filter_all_text'] ? $data['tax_filter_all_text'] : __( "All ", "the-post-grid" ) . $taxonomy_label;
|
502 |
+
|
503 |
+
|
504 |
+
$_taxonomies = get_object_taxonomies( $data['post_type'], 'objects' );
|
505 |
+
$terms = [];
|
506 |
+
foreach ( $_taxonomies as $index => $object ) {
|
507 |
+
if ( $object->name != $taxFilter ) {
|
508 |
+
continue;
|
509 |
+
}
|
510 |
+
$setting_key = $object->name . '_ids';
|
511 |
+
if ( ! empty( $data[ $setting_key ] ) ) {
|
512 |
+
$terms = $data[ $setting_key ];
|
513 |
+
} else {
|
514 |
+
$terms = get_terms( [
|
515 |
+
'taxonomy' => $taxFilter,
|
516 |
+
'fields' => 'ids',
|
517 |
+
] );
|
518 |
+
}
|
519 |
+
}
|
520 |
+
$taxFilterTerms = $terms;
|
521 |
+
|
522 |
+
|
523 |
+
if ( $default_term && $taxFilter ) {
|
524 |
+
$isTermSelected = true;
|
525 |
+
$allSelect = null;
|
526 |
+
}
|
527 |
+
if ( $filterType == 'dropdown' ) {
|
528 |
+
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-taxonomy='{$taxFilter}' data-filter='taxonomy'>";
|
529 |
+
$termDefaultText = $allText;
|
530 |
+
$dataTerm = 'all';
|
531 |
+
$htmlButton = "";
|
532 |
+
$selectedSubTerms = null;
|
533 |
+
$pCount = 0;
|
534 |
+
|
535 |
+
|
536 |
+
if ( ! empty( $terms ) ) {
|
537 |
+
$i = 0;
|
538 |
+
foreach ( $terms as $term_id ) {
|
539 |
+
$term = get_term( $term_id, $taxFilter, ARRAY_A );
|
540 |
+
$id = $term['term_id'];
|
541 |
+
$pCount = $pCount + $term['count'];
|
542 |
+
$sT = null;
|
543 |
+
if ( $data['tgp_filter_taxonomy_hierarchical'] == 'yes' ) {
|
544 |
+
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
545 |
+
if ( ! empty( $subTerms ) ) {
|
546 |
+
$count = 0;
|
547 |
+
$item = $allCount = null;
|
548 |
+
foreach ( $subTerms as $stId => $t ) {
|
549 |
+
$count = $count + absint( $t['count'] );
|
550 |
+
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
551 |
+
$item .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$stId}'><span class='rt-text'>{$t['name']}{$sTPostCount}</span></span>";
|
552 |
+
}
|
553 |
+
if ( $post_count ) {
|
554 |
+
$allCount = " (<span class='rt-post-count'>{$count}</span>)";
|
555 |
+
}
|
556 |
+
$sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
|
557 |
+
$sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
|
558 |
+
<span class='rt-text'>" . $allText . "</span>
|
559 |
+
<i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
|
560 |
+
</span>";
|
561 |
+
$sT .= '<span class="term-dropdown rt-filter-dropdown">';
|
562 |
+
$sT .= $item;
|
563 |
+
$sT .= '</span>';
|
564 |
+
$sT .= "</div>";
|
565 |
+
}
|
566 |
+
if ( $default_term === $id ) {
|
567 |
+
$selectedSubTerms = $sT;
|
568 |
+
}
|
569 |
+
}
|
570 |
+
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
571 |
+
if ( $default_term && $default_term == $id ) {
|
572 |
+
$termDefaultText = $term['name'] . $postCount;
|
573 |
+
$dataTerm = $id;
|
574 |
+
}
|
575 |
+
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
576 |
+
if ( in_array( $id, $taxFilterTerms ) ) {
|
577 |
+
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
578 |
+
}
|
579 |
+
} else {
|
580 |
+
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
581 |
+
}
|
582 |
+
$i ++;
|
583 |
+
}
|
584 |
+
}
|
585 |
+
$pAllCount = null;
|
586 |
+
if ( $post_count ) {
|
587 |
+
$pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
|
588 |
+
if ( ! $default_term ) {
|
589 |
+
$termDefaultText = $termDefaultText;
|
590 |
+
}
|
591 |
+
}
|
592 |
+
|
593 |
+
if ( 'yes' == $data['tpg_hide_all_button'] ) {
|
594 |
+
$htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText . "</span></span>"
|
595 |
+
. $htmlButton;
|
596 |
+
}
|
597 |
+
$htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
|
598 |
+
|
599 |
+
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
|
600 |
+
<span class="rt-text">' . $termDefaultText . '</span>
|
601 |
+
<i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
|
602 |
+
</span>';
|
603 |
+
|
604 |
+
$html .= $showAllhtml . $htmlButton;
|
605 |
+
$html .= '</div>' . $selectedSubTerms;
|
606 |
+
} else {
|
607 |
+
//if Button the execute
|
608 |
+
//$termDefaultText = $allText;
|
609 |
+
|
610 |
+
$bCount = 0;
|
611 |
+
$bItems = null;
|
612 |
+
if ( ! empty( $terms ) ) {
|
613 |
+
foreach ( $terms as $term_id ) {
|
614 |
+
$term = get_term( $term_id, $taxFilter, ARRAY_A );
|
615 |
+
|
616 |
+
$id = $term['term_id'];
|
617 |
+
$bCount = $bCount + absint( $term['count'] );
|
618 |
+
$sT = null;
|
619 |
+
if ( $data['tgp_filter_taxonomy_hierarchical'] == 'yes' && $data['filter_btn_style'] === 'default' && $data['filter_type'] == 'button' ) {
|
620 |
+
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
621 |
+
if ( ! empty( $subTerms ) ) {
|
622 |
+
$sT .= "<div class='rt-filter-sub-tax sub-button-group '>";
|
623 |
+
foreach ( $subTerms as $stId => $t ) {
|
624 |
+
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
625 |
+
$sT .= "<span class='term-button-item rt-filter-button-item ' data-term='{$stId}'>{$t['name']}{$sTPostCount}</span>";
|
626 |
+
}
|
627 |
+
$sT .= "</div>";
|
628 |
+
if ( $default_term === $id ) {
|
629 |
+
$selectedSubTermsForButton = $sT;
|
630 |
+
}
|
631 |
+
}
|
632 |
+
}
|
633 |
+
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
634 |
+
$termSelected = null;
|
635 |
+
if ( $isTermSelected && $id == $default_term ) {
|
636 |
+
$termSelected = " selected";
|
637 |
+
}
|
638 |
+
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
639 |
+
if ( in_array( $id, $taxFilterTerms ) ) {
|
640 |
+
$bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected} {$itemClass}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
|
641 |
+
}
|
642 |
+
} else {
|
643 |
+
$bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected} {$itemClass}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
|
644 |
+
}
|
645 |
+
}
|
646 |
+
}
|
647 |
+
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass} {$wrapperClass}' data-taxonomy='{$taxFilter}' data-filter='taxonomy'>";
|
648 |
+
|
649 |
+
//$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
650 |
+
if ( 'yes' == $data['tpg_hide_all_button'] ) {
|
651 |
+
$html .= "<span class='term-button-item rt-filter-button-item {$allSelect} {$itemClass}' data-term='all'>" . $allText . "</span>";
|
652 |
+
}
|
653 |
+
|
654 |
+
$html .= $bItems;
|
655 |
+
|
656 |
+
$html .= "</div>";
|
657 |
+
if ( 'carousel' === $data['filter_btn_style'] ) {
|
658 |
+
$html .= '<div class="swiper-navigation"><div class="swiper-button-prev slider-btn"></div><div class="swiper-button-next slider-btn"></div></div>';
|
659 |
+
}
|
660 |
+
}
|
661 |
+
}
|
662 |
+
|
663 |
+
// TODO: Author filter
|
664 |
+
if ( 'show' == $data['show_author_filter'] ) {
|
665 |
+
$user_el = $data['author'];
|
666 |
+
|
667 |
+
$filterAuthors = $user_el;
|
668 |
+
|
669 |
+
if ( ! empty( $user_el ) ) {
|
670 |
+
$users = get_users( apply_filters( 'tpg_author_arg', [ 'include' => $user_el ] ) );
|
671 |
+
} else {
|
672 |
+
$users = get_users( apply_filters( 'tpg_author_arg', [] ) );
|
673 |
+
}
|
674 |
+
$allText = $allText = $data['author_filter_all_text'] ? $data['author_filter_all_text'] : __( "All Users", "the-post-grid" );
|
675 |
+
$allSelect = " selected";
|
676 |
+
//$isTermSelected = false;
|
677 |
+
// if ( $default_term && $taxFilter ) {
|
678 |
+
$isTermSelected = true;
|
679 |
+
// $allSelect = null;
|
680 |
+
// }
|
681 |
+
if ( $filterType == 'dropdown' ) {
|
682 |
+
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-filter='author'>";
|
683 |
+
$termDefaultText = $allText;
|
684 |
+
$dataAuthor = 'all';
|
685 |
+
$htmlButton = "";
|
686 |
+
$htmlButton .= '<span class="author-dropdown rt-filter-dropdown">';
|
687 |
+
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'>" . $allText . "</span>";
|
688 |
+
|
689 |
+
if ( ! empty( $users ) ) {
|
690 |
+
foreach ( $users as $user ) {
|
691 |
+
$user_post_count = false;
|
692 |
+
$post_count ? "(" . count_user_posts( $user->ID, $data['post_type'] ) . ")" : null;
|
693 |
+
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
694 |
+
if ( in_array( $user->ID, $filterAuthors ) ) {
|
695 |
+
if ( $default_term == $user->ID ) {
|
696 |
+
$termDefaultText = $user->display_name;
|
697 |
+
$dataTerm = $user->ID;
|
698 |
+
} else {
|
699 |
+
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$user->ID}'>{$user->display_name} <span class='rt-text'>{$user_post_count}</span></span>";
|
700 |
+
}
|
701 |
+
}
|
702 |
+
} else {
|
703 |
+
if ( $default_term == $user->ID ) {
|
704 |
+
$termDefaultText = $user->display_name;
|
705 |
+
$dataTerm = $user->ID;
|
706 |
+
} else {
|
707 |
+
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$user->ID}'><span class='rt-text'>{$user->display_name} {$user_post_count}</span></span>";
|
708 |
+
}
|
709 |
+
}
|
710 |
+
}
|
711 |
+
}
|
712 |
+
|
713 |
+
|
714 |
+
$htmlButton .= '</span>';
|
715 |
+
|
716 |
+
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
|
717 |
+
<span class="rt-text">' . $termDefaultText . '</span>
|
718 |
+
<i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
|
719 |
+
</span>';
|
720 |
+
|
721 |
+
$html .= $showAllhtml . $htmlButton;
|
722 |
+
$html .= '</div>';
|
723 |
+
} else {
|
724 |
+
$bCount = 0;
|
725 |
+
$bItems = null;
|
726 |
+
|
727 |
+
if ( ! empty( $users ) ) {
|
728 |
+
foreach ( $users as $user ) {
|
729 |
+
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
730 |
+
if ( in_array( $user->ID, $filterAuthors ) ) {
|
731 |
+
$bItems .= "<span class='author-button-item rt-filter-button-item' data-term='{$user->ID}'>{$user->display_name}</span>";
|
732 |
+
}
|
733 |
+
} else {
|
734 |
+
$bItems .= "<span class='author-button-item rt-filter-button-item' data-term='{$user->ID}'>{$user->display_name}</span>";
|
735 |
+
}
|
736 |
+
}
|
737 |
+
}
|
738 |
+
|
739 |
+
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-filter='author'>";
|
740 |
+
// if ( 'yes' == $data['tax_filter_all_text'] ) {
|
741 |
+
//$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
742 |
+
$html .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . "</span>";
|
743 |
+
// }
|
744 |
+
$html .= $bItems;
|
745 |
+
$html .= "</div>";
|
746 |
+
}
|
747 |
+
}
|
748 |
+
|
749 |
+
|
750 |
+
if ( 'show' == $data['show_author_filter'] || 'show' == $data['show_taxonomy_filter'] ) {
|
751 |
+
$html .= "</div>";
|
752 |
+
}
|
753 |
+
|
754 |
+
|
755 |
+
if ( 'show' == $data['show_order_by'] || 'show' == $data['show_sort_order'] || 'show' == $data['show_search'] ) {
|
756 |
+
$html .= "<div class='filter-right-wrapper'>";
|
757 |
+
}
|
758 |
+
|
759 |
+
|
760 |
+
// TODO: Order Filter
|
761 |
+
if ( 'show' == $data['show_sort_order'] ) {
|
762 |
+
$action_order = ( $data['order'] ? strtoupper( $data['order'] ) : "DESC" );
|
763 |
+
$html .= '<div class="rt-filter-item-wrap rt-sort-order-action" data-filter="order">';
|
764 |
+
$html .= "<span class='rt-sort-order-action-arrow' data-sort-order='{$action_order}'> <span></span></span>";
|
765 |
+
$html .= '</div>';
|
766 |
+
}
|
767 |
+
|
768 |
+
//TODO: Orderby Filter
|
769 |
+
if ( 'show' == $data['show_order_by'] ) {
|
770 |
+
$wooFeature = ( $data['post_type'] == "product" ? true : false );
|
771 |
+
$orders = Options::rtPostOrderBy( $wooFeature );
|
772 |
+
$action_orderby = ( ! empty( $data['orderby'] ) ? $data['orderby'] : "none" );
|
773 |
+
if ( $action_orderby == 'none' ) {
|
774 |
+
$action_orderby_label = __( "Sort By", "the-post-grid" );
|
775 |
+
} elseif ( in_array( $action_orderby, array_keys( Options::rtMetaKeyType() ) ) ) {
|
776 |
+
$action_orderby_label = __( "Meta value", "the-post-grid" );
|
777 |
+
} else {
|
778 |
+
$action_orderby_label = __( "By ", "the-post-grid" ) . $action_orderby;
|
779 |
+
}
|
780 |
+
if ( $action_orderby !== 'none' ) {
|
781 |
+
$orders['none'] = __( "Sort By", "the-post-grid" );
|
782 |
+
}
|
783 |
+
$html .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap" data-filter="orderby">';
|
784 |
+
$html .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
|
785 |
+
<span class='rt-text-order-by'>{$action_orderby_label}</span>
|
786 |
+
<i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
|
787 |
+
</span>";
|
788 |
+
$html .= '<span class="order-by-dropdown rt-filter-dropdown">';
|
789 |
+
|
790 |
+
foreach ( $orders as $orderKey => $order ) {
|
791 |
+
$html .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
|
792 |
+
}
|
793 |
+
$html .= '</span>';
|
794 |
+
$html .= '</div>';
|
795 |
+
}
|
796 |
+
|
797 |
+
//TODO: Search Filter
|
798 |
+
if ( 'show' == $data['show_search'] ) {
|
799 |
+
$html .= '<div class="rt-filter-item-wrap rt-search-filter-wrap" data-filter="search">';
|
800 |
+
$html .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__( "Search...", 'the-post-grid' ) );
|
801 |
+
$html .= "<span class='rt-action'>🔍</span>";
|
802 |
+
$html .= "<span class='rt-loading'></span>";
|
803 |
+
$html .= '</div>';
|
804 |
+
}
|
805 |
+
|
806 |
+
if ( 'show' == $data['show_order_by'] || 'show' == $data['show_sort_order'] || 'show' == $data['show_search'] ) {
|
807 |
+
$html .= "</div>";
|
808 |
+
}
|
809 |
+
|
810 |
+
$html .= "</div>$selectedSubTermsForButton</div>";
|
811 |
+
|
812 |
+
return $html;
|
813 |
+
}
|
814 |
+
|
815 |
+
|
816 |
+
/**
|
817 |
+
* Get Excluded Taxonomy
|
818 |
+
*
|
819 |
+
* @return string[]
|
820 |
+
*/
|
821 |
+
public static function get_excluded_taxonomy() {
|
822 |
+
return [
|
823 |
+
'post_format',
|
824 |
+
'nav_menu',
|
825 |
+
'link_category',
|
826 |
+
'wp_theme',
|
827 |
+
'elementor_library_type',
|
828 |
+
'elementor_library_type',
|
829 |
+
'elementor_library_category',
|
830 |
+
'product_visibility',
|
831 |
+
'product_shipping_class',
|
832 |
+
];
|
833 |
+
}
|
834 |
+
|
835 |
+
/**
|
836 |
+
* Get Popup Modal Markup
|
837 |
+
*/
|
838 |
+
public static function get_modal_markup() {
|
839 |
+
$html = null;
|
840 |
+
$html .= '<div class="md-modal rt-md-effect" id="rt-modal">
|
841 |
+
<div class="md-content">
|
842 |
+
<div class="rt-md-content-holder"></div>
|
843 |
+
<div class="md-cls-btn">
|
844 |
+
<button class="md-close"><i class="fa fa-times" aria-hidden="true"></i></button>
|
845 |
+
</div>
|
846 |
+
</div>
|
847 |
+
</div>';
|
848 |
+
$html .= "<div class='md-overlay'></div>";
|
849 |
+
echo $html;
|
850 |
+
}
|
851 |
+
|
852 |
+
/**
|
853 |
+
* Get Archive page title
|
854 |
+
*/
|
855 |
+
public static function get_archive_title() {
|
856 |
+
$queried_obj = get_queried_object();
|
857 |
+
if ( is_tag() || is_category() ) {
|
858 |
+
echo esc_html( $queried_obj->name );
|
859 |
+
} elseif ( is_author() ) {
|
860 |
+
echo esc_html( $queried_obj->display_name );
|
861 |
+
} elseif ( is_date() ) {
|
862 |
+
$year = get_query_var( 'year' );
|
863 |
+
$monthnum = get_query_var( 'monthnum' );
|
864 |
+
$day = get_query_var( 'day' );
|
865 |
+
$time_string = $year . '/' . $monthnum . '/' . $day;
|
866 |
+
$time_stamp = strtotime( $time_string );
|
867 |
+
echo date( get_option( 'date_format' ), $time_stamp );
|
868 |
+
}
|
869 |
+
}
|
870 |
+
|
871 |
+
/**
|
872 |
+
* Get Last Category ID
|
873 |
+
*
|
874 |
+
* @return mixed
|
875 |
+
*/
|
876 |
+
public static function get_last_category_id() {
|
877 |
+
if ( is_archive() ) {
|
878 |
+
return;
|
879 |
+
}
|
880 |
+
$categories = get_terms( [
|
881 |
+
'taxonomy' => 'category',
|
882 |
+
'hide_empty' => false,
|
883 |
+
'number' => 1,
|
884 |
+
] );
|
885 |
+
if ( ! empty( $categories ) && ! is_wp_error( $categories ) ) {
|
886 |
+
return $categories[0]->term_id;
|
887 |
+
}
|
888 |
+
}
|
889 |
+
|
890 |
+
/**
|
891 |
+
* @param $data
|
892 |
+
*
|
893 |
+
* @return string
|
894 |
+
*/
|
895 |
+
public static function get_dynamic_class_gutenberg( $data ) {
|
896 |
+
$uniqueId = isset( $data['uniqueId'] ) ? $data['uniqueId'] : null;
|
897 |
+
$uniqueClass = 'rttpg-block-postgrid rttpg-block-' . $uniqueId;
|
898 |
+
$dynamicClass = $uniqueClass;
|
899 |
+
$dynamicClass .= isset( $data['full_wrapper_align'] ) ? " tpg-wrapper-align-{$data['full_wrapper_align']}" : null;
|
900 |
+
$dynamicClass .= isset( $data['filter_type'] ) ? " tpg-filter-type-{$data['filter_type']}" : null;
|
901 |
+
$dynamicClass .= isset( $data['show_pagination'] ) ? " pagination-visibility-{$data['show_pagination']}" : null;
|
902 |
+
$dynamicClass .= isset( $data['ajax_pagination_type'] ) ? " ajax-pagination-type-next-prev-{$data['ajax_pagination_type']}" : null;
|
903 |
+
$dynamicClass .= isset( $data['show_meta'] ) ? " meta-visibility-{$data['show_meta']}" : null;
|
904 |
+
$dynamicClass .= isset( $data['section_title_style'] ) ? " section-title-style-{$data['section_title_style']}" : null;
|
905 |
+
$dynamicClass .= isset( $data['section_title_alignment'] ) && ! is_array( $data['section_title_alignment'] ) ? " section-title-align-{$data['section_title_alignment']}" : null;
|
906 |
+
$dynamicClass .= isset( $data['hover_animation'] ) ? " img_hover_animation_{$data['hover_animation']}" : null;
|
907 |
+
$dynamicClass .= isset( $data['title_visibility_style'] ) ? " title-{$data['title_visibility_style']}" : null;
|
908 |
+
$dynamicClass .= isset( $data['title_position'] ) ? " title_position_{$data['title_position']}" : null;
|
909 |
+
$dynamicClass .= isset( $data['title_hover_underline'] ) ? " title_hover_border_{$data['title_hover_underline']}" : null;
|
910 |
+
$dynamicClass .= isset( $data['meta_position'] ) ? " meta_position_{$data['meta_position']}" : null;
|
911 |
+
$dynamicClass .= isset( $data['author_icon_visibility'] ) ? " tpg-is-author-icon-{$data['author_icon_visibility']}" : null;
|
912 |
+
$dynamicClass .= isset( $data['show_author_image'] ) ? " author-image-visibility-{$data['show_author_image']}" : null;
|
913 |
+
$dynamicClass .= isset( $data['category_position'] ) ? " tpg-category-position-{$data['category_position']}" : null;
|
914 |
+
$dynamicClass .= isset( $data['readmore_btn_style'] ) ? " readmore-btn-{$data['readmore_btn_style']}" : null;
|
915 |
+
$dynamicClass .= isset( $data['grid_hover_overlay_type'] ) ? " grid-hover-overlay-type-{$data['grid_hover_overlay_type']}" : null;
|
916 |
+
$dynamicClass .= isset( $data['grid_hover_overlay_height'] ) ? " grid-hover-overlay-height-{$data['grid_hover_overlay_height']}" : null;
|
917 |
+
$dynamicClass .= isset( $data['on_hover_overlay'] ) ? " hover-overlay-height-{$data['on_hover_overlay']}" : null;
|
918 |
+
$dynamicClass .= isset( $data['title_border_visibility'] ) ? " tpg-title-border-{$data['title_border_visibility']}" : null;
|
919 |
+
$dynamicClass .= isset( $data['title_alignment'] ) && ! is_array( $data['title_alignment'] ) ? " title-alignment-{$data['title_alignment']}" : null;
|
920 |
+
$dynamicClass .= isset( $data['filter_v_alignment'] ) && ! is_array( $data['filter_v_alignment'] ) ? " tpg-filter-alignment-{$data['filter_v_alignment']}" : null;
|
921 |
+
$dynamicClass .= isset( $data['border_style'] ) ? " filter-button-border-{$data['border_style']}" : null;
|
922 |
+
$dynamicClass .= isset( $data['filter_next_prev_btn'] ) ? " filter-nex-prev-btn-{$data['filter_next_prev_btn']}" : null;
|
923 |
+
$dynamicClass .= isset( $data['filter_h_alignment'] ) && ! is_array( $data['filter_h_alignment'] ) ? " tpg-filter-h-alignment-{$data['filter_h_alignment']}" : null;
|
924 |
+
$dynamicClass .= isset( $data['is_box_border'] ) ? " tpg-el-box-border-{$data['is_box_border']}" : null;
|
925 |
+
|
926 |
+
//Slider layout
|
927 |
+
$dynamicClass .= isset( $data['arrow_position'] ) ? " slider-arrow-position-{$data['arrow_position']}" : null;
|
928 |
+
$dynamicClass .= isset( $data['dots'] ) ? " slider-dot-enable-{$data['dots']}" : null;
|
929 |
+
$dynamicClass .= isset( $data['dots_style'] ) ? " slider-dots-style-{$data['dots_style']}" : null;
|
930 |
+
$dynamicClass .= isset( $data['lazyLoad'] ) ? " is-lazy-load-{$data['lazyLoad']}" : null;
|
931 |
+
$dynamicClass .= isset( $data['carousel_overflow'] ) ? " is-carousel-overflow-{$data['carousel_overflow']}" : null;
|
932 |
+
$dynamicClass .= isset( $data['slider_direction'] ) ? " slider-direction-{$data['slider_direction']}" : null;
|
933 |
+
$dynamicClass .= isset( $data['dots_text_align'] ) ? " slider-dots-align-{$data['dots_text_align']}" : null;
|
934 |
+
|
935 |
+
//ACF
|
936 |
+
$dynamicClass .= isset( $data['acf_label_style'] ) ? " act-label-style-{$data['acf_label_style']}" : null;
|
937 |
+
$dynamicClass .= isset( $data['acf_alignment'] ) && ! is_array( $data['acf_alignment'] ) ? " tpg-acf-align-{$data['acf_alignment']}" : null;
|
938 |
+
|
939 |
+
return $dynamicClass;
|
940 |
+
}
|
941 |
+
|
942 |
+
|
943 |
+
/**
|
944 |
+
* Get Section Title
|
945 |
+
*
|
946 |
+
* @param $data
|
947 |
+
*/
|
948 |
+
public static function get_section_title( $data ) {
|
949 |
+
if ( 'show' != $data['show_section_title'] ) {
|
950 |
+
return;
|
951 |
+
}
|
952 |
+
|
953 |
+
$_is_link = false;
|
954 |
+
if ( ! empty( $data['section_title_link']['url'] ) ) {
|
955 |
+
$_is_link = true;
|
956 |
+
}
|
957 |
+
|
958 |
+
ob_start();
|
959 |
+
?>
|
960 |
+
|
961 |
+
<div class="tpg-widget-heading-wrapper rt-clear heading-<?php echo esc_attr( $data['section_title_style'] ); ?> ">
|
962 |
+
<span class="tpg-widget-heading-line line-left"></span>
|
963 |
+
|
964 |
+
<?php printf( "<%s class='tpg-widget-heading'>", $data['section_title_tag'] ); ?>
|
965 |
+
|
966 |
+
<?php
|
967 |
+
if ( $_is_link ) : ?>
|
968 |
+
<a href="#">
|
969 |
+
<?php endif; ?>
|
970 |
+
|
971 |
+
<?php
|
972 |
+
if ( 'page_title' == $data['section_title_source'] ) {
|
973 |
+
$archive_prefix = $data['title_prefix'] ? $data['title_prefix'] . ' ' : null;
|
974 |
+
$archive_suffix = $data['title_suffix'] ? ' ' . $data['title_suffix'] : null;
|
975 |
+
printf( "<span class='prefix-text'>%s</span>", esc_html( $archive_prefix ) );
|
976 |
+
if ( is_archive() ) {
|
977 |
+
self::get_archive_title();
|
978 |
+
} elseif ( is_search() ) {
|
979 |
+
echo get_query_var( 's' );
|
980 |
+
} else {
|
981 |
+
the_title();
|
982 |
+
}
|
983 |
+
printf( "<span class='suffix-text'>%s</span>", esc_html( $archive_suffix ) );
|
984 |
+
} else {
|
985 |
+
?>
|
986 |
+
<span>
|
987 |
+
<?php echo $data['section_title_text'] ?>
|
988 |
+
</span>
|
989 |
+
<?php
|
990 |
+
}
|
991 |
+
?>
|
992 |
+
|
993 |
+
<?php if ( $_is_link ) : ?>
|
994 |
+
</a>
|
995 |
+
|
996 |
+
<?php endif; ?>
|
997 |
+
<?php printf( "</%s>", $data['section_title_tag'] ); ?>
|
998 |
+
<span class="tpg-widget-heading-line line-right"></span>
|
999 |
+
</div>
|
1000 |
+
|
1001 |
+
<?php if ( isset( $data['show_cat_desc'] ) && $data['show_cat_desc'] == 'yes' && category_description( self::get_last_category_id() ) ) : ?>
|
1002 |
+
<div class="tpg-category-description">
|
1003 |
+
<?php echo category_description( self::get_last_category_id() ); ?>
|
1004 |
+
</div>
|
1005 |
+
<?php endif; ?>
|
1006 |
+
|
1007 |
+
<?php echo ob_get_clean();
|
1008 |
+
}
|
1009 |
+
|
1010 |
+
/**
|
1011 |
+
* rtAllOptionFields
|
1012 |
* All settings.
|
1013 |
*
|
1014 |
* @return array
|
1218 |
* Sanitize field value
|
1219 |
*
|
1220 |
* @param array $field
|
1221 |
+
* @param null $value
|
1222 |
*
|
1223 |
* @return array|null
|
1224 |
* @internal param $value
|
1334 |
$h .= '<div class="field-label"><label>' . esc_html( $label ) . '' . self::htmlKses( $proText, 'basic' ) . '</label></div>';
|
1335 |
$h .= "<div class='field'>";
|
1336 |
// color.
|
1337 |
+
$h .= "<div class='field-inner col-4'>";
|
1338 |
+
$h .= "<div class='field-inner-container size'>";
|
1339 |
+
$h .= "<span class='label'>Color</span>";
|
1340 |
$cValue = get_post_meta( get_the_ID(), $key . '_color', true );
|
1341 |
+
$h .= '<input type="text" value="' . esc_attr( $cValue ) . '" class="rt-color" name="' . esc_attr( $key ) . '_color">';
|
1342 |
+
$h .= '</div>';
|
1343 |
+
$h .= '</div>';
|
1344 |
|
1345 |
// Font size.
|
1346 |
+
$h .= "<div class='field-inner col-4'>";
|
1347 |
+
$h .= "<div class='field-inner-container size'>";
|
1348 |
+
$h .= "<span class='label'>Font size</span>";
|
1349 |
+
$h .= '<select ' . self::htmlKses( $atts, 'basic' ) . ' name="' . esc_attr( $key ) . '_size" class="rt-select2">';
|
1350 |
$fSizes = Options::scFontSize();
|
1351 |
$sValue = get_post_meta( get_the_ID(), $key . '_size', true );
|
1352 |
+
$h .= "<option value=''>Default</option>";
|
1353 |
|
1354 |
foreach ( $fSizes as $size => $sizeLabel ) {
|
1355 |
$sSlt = ( $size == $sValue ? 'selected' : null );
|
1356 |
+
$h .= '<option value="' . esc_attr( $size ) . '" ' . esc_attr( $sSlt ) . '>' . esc_html( $sizeLabel ) . '</option>';
|
1357 |
}
|
1358 |
|
1359 |
$h .= '</select>';
|
1361 |
$h .= '</div>';
|
1362 |
|
1363 |
// Weight.
|
1364 |
+
$h .= "<div class='field-inner col-4'>";
|
1365 |
+
$h .= "<div class='field-inner-container weight'>";
|
1366 |
+
$h .= "<span class='label'>Weight</span>";
|
1367 |
+
$h .= '<select ' . self::htmlKses( $atts, 'basic' ) . ' name="' . esc_attr( $key ) . '_weight" class="rt-select2">';
|
1368 |
+
$h .= "<option value=''>Default</option>";
|
1369 |
$weights = Options::scTextWeight();
|
1370 |
$wValue = get_post_meta( get_the_ID(), $key . '_weight', true );
|
1371 |
|
1372 |
foreach ( $weights as $weight => $weightLabel ) {
|
1373 |
$wSlt = ( $weight == $wValue ? 'selected' : null );
|
1374 |
+
$h .= '<option value="' . esc_attr( $weight ) . '" ' . esc_attr( $wSlt ) . '>' . esc_html( $weightLabel ) . '</option>';
|
1375 |
}
|
1376 |
|
1377 |
$h .= '</select>';
|
1379 |
$h .= '</div>';
|
1380 |
|
1381 |
// Alignment.
|
1382 |
+
$h .= "<div class='field-inner col-4'>";
|
1383 |
+
$h .= "<div class='field-inner-container alignment'>";
|
1384 |
+
$h .= "<span class='label'>Alignment</span>";
|
1385 |
+
$h .= '<select ' . self::htmlKses( $atts, 'basic' ) . ' name="' . esc_attr( $key ) . '_alignment" class="rt-select2">';
|
1386 |
+
$h .= "<option value=''>Default</option>";
|
1387 |
$aligns = Options::scAlignment();
|
1388 |
$aValue = get_post_meta( get_the_ID(), $key . '_alignment', true );
|
1389 |
|
1390 |
foreach ( $aligns as $align => $alignLabel ) {
|
1391 |
$aSlt = ( $align == $aValue ? 'selected' : null );
|
1392 |
+
$h .= '<option value="' . esc_attr( $align ) . '" ' . esc_attr( $aSlt ) . '>' . esc_html( $alignLabel ) . '</option>';
|
1393 |
|