Version Description
- Fixed: Admin body class conflict fixed
- Fixed: Admin pagination fixed
- Updated: Proper sanitization and escaping for all files
- Updated: All vendor libraries
Download this release
Release Info
Developer | techlabpro1 |
Plugin | The Post Grid |
Version | 4.2.0 |
Comparing to | |
See all releases |
Code changes from version 4.1.5 to 4.2.0
- README.txt +7 -1
- app/Controllers/Admin/AdminAjaxController.php +528 -324
- app/Controllers/Admin/MetaController.php +256 -151
- app/Controllers/Admin/NoticeController.php +314 -242
- app/Controllers/Admin/PostTypeController.php +49 -31
- app/Controllers/Admin/SettingsController.php +118 -64
- app/Controllers/Admin/UpgradeController.php +53 -10
- app/Controllers/AjaxController.php +199 -107
- app/Controllers/ElementorController.php +80 -41
- app/Controllers/GutenBergController.php +65 -26
- app/Controllers/Hooks/ActionHooks.php +28 -2
- app/Controllers/Hooks/FilterHooks.php +60 -10
- app/Controllers/ScriptController.php +217 -176
- app/Controllers/ShortcodeController.php +344 -186
- app/Controllers/WidgetController.php +24 -5
- app/Helpers/Fns.php +1117 -711
- app/Helpers/Install.php +15 -2
- app/Helpers/Options.php +796 -760
- app/Models/Field.php +427 -383
- app/Models/ReSizer.php +76 -41
- app/RtTpg.php +124 -22
- app/Widgets/ElementorWidget.php +24 -11
- app/Widgets/TPGWidget.php +43 -31
- app/Widgets/elementor/base.php +210 -177
- app/Widgets/elementor/rtTPGElementorHelper.php +845 -845
- app/Widgets/elementor/rtTPGElementorQuery.php +34 -22
- app/Widgets/elementor/widgets/default.php +24 -10
- app/Widgets/elementor/widgets/grid-hover-layout-archive.php +76 -69
- app/Widgets/elementor/widgets/grid-hover-layout.php +94 -78
- app/Widgets/elementor/widgets/grid-layout-archive.php +75 -71
- app/Widgets/elementor/widgets/grid-layout.php +86 -76
- app/Widgets/elementor/widgets/list-layout-archive.php +77 -72
- app/Widgets/elementor/widgets/list-layout.php +79 -70
- app/Widgets/elementor/widgets/related-post.php +105 -80
- app/Widgets/elementor/widgets/slider-layout-archive.php +107 -112
- app/Widgets/elementor/widgets/slider-layout.php +103 -107
- assets/css/admin/admin.css +16 -6
- assets/js/admin.js +2 -1
- assets/vendor/isotope/imagesloaded.pkgd.min.js +0 -7
- assets/vendor/isotope/isotope.pkgd.js +0 -3563
- assets/vendor/select2/select2.min.css +1 -1
- assets/vendor/select2/select2.min.js +0 -2
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.
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -363,6 +363,12 @@ With the Post Grid PRO, you get to use the Single Page Builder, which is based o
|
|
363 |
|
364 |
== Changelog ==
|
365 |
|
|
|
|
|
|
|
|
|
|
|
|
|
366 |
= 4.1.5 =
|
367 |
* Fixed: Admin preview pagination not showing
|
368 |
* Fixed: Datepicker style added
|
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.0
|
8 |
License: GPLv3
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
363 |
|
364 |
== Changelog ==
|
365 |
|
366 |
+
= 4.2.0 =
|
367 |
+
* Fixed: Admin body class conflict fixed
|
368 |
+
* Fixed: Admin pagination fixed
|
369 |
+
* Updated: Proper sanitization and escaping for all files
|
370 |
+
* Updated: All vendor libraries
|
371 |
+
|
372 |
= 4.1.5 =
|
373 |
* Fixed: Admin preview pagination not showing
|
374 |
* Fixed: Datepicker style added
|
app/Controllers/Admin/AdminAjaxController.php
CHANGED
@@ -1,35 +1,55 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Controllers\Admin;
|
4 |
|
5 |
use RT\ThePostGrid\Helpers\Fns;
|
6 |
use RT\ThePostGrid\Helpers\Options;
|
7 |
|
8 |
-
|
|
|
|
|
|
|
9 |
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
private $l4toggle = false;
|
13 |
|
|
|
|
|
|
|
14 |
public function __construct() {
|
15 |
add_action( 'wp_ajax_tpgPreviewAjaxCall', [ $this, 'tpgPreviewAjaxCall' ] );
|
16 |
}
|
17 |
|
18 |
/**
|
19 |
* Preview rendering
|
|
|
|
|
20 |
*/
|
21 |
-
function tpgPreviewAjaxCall() {
|
22 |
$msg = $data = null;
|
23 |
$error = true;
|
|
|
24 |
if ( Fns::verifyNonce() ) {
|
25 |
-
$error
|
26 |
-
$
|
|
|
27 |
|
28 |
-
$
|
29 |
-
$layoutID = "rt-tpg-container-" . $rand;
|
30 |
|
31 |
-
|
32 |
-
if ( ! in_array( $layout, array_keys( Options::rtTPGLayouts() ) ) ) {
|
33 |
$layout = 'layout1';
|
34 |
}
|
35 |
|
@@ -40,16 +60,19 @@ class AdminAjaxController {
|
|
40 |
$isOffset = preg_match( '/offset/', $layout );
|
41 |
$isGridHover = preg_match( '/grid_hover/', $layout );
|
42 |
|
43 |
-
$dCol = ( isset( $
|
44 |
-
$tCol = ( isset( $
|
45 |
-
$mCol = ( isset( $
|
46 |
-
|
|
|
47 |
$dCol = 3;
|
48 |
}
|
49 |
-
|
|
|
50 |
$tCol = 2;
|
51 |
}
|
52 |
-
|
|
|
53 |
$mCol = 1;
|
54 |
}
|
55 |
|
@@ -58,68 +81,64 @@ class AdminAjaxController {
|
|
58 |
$tCol = ( $tCol < 3 ? 2 : $tCol );
|
59 |
$mCol = ( $mCol < 3 ? 1 : $mCol );
|
60 |
}
|
|
|
61 |
$arg = [];
|
62 |
-
$fImg =
|
63 |
-
$fImgSize = ( isset( $
|
64 |
-
$mediaSource = ( isset( $
|
65 |
-
$arg['excerpt_type'] = ( isset( $
|
66 |
-
$arg['title_limit_type'] = ( isset( $
|
67 |
-
$arg['excerpt_limit'] = ( isset( $
|
68 |
-
$arg['title_limit'] = ( isset( $
|
69 |
-
$arg['excerpt_more_text'] = ( isset( $
|
70 |
-
$arg['read_more_text'] = ( ! empty( $
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
$arg['
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
$arg['
|
79 |
-
$arg['
|
80 |
-
|
81 |
-
// Category Settings
|
82 |
-
$arg['category_position'] = isset( $scMeta['tpg_category_position'] ) ? $scMeta['tpg_category_position'] : null;
|
83 |
-
$arg['category_style'] = ! empty( $scMeta['tpg_category_style'] ) ? $scMeta['tpg_category_style'] : '';
|
84 |
-
$arg['catIcon'] = isset( $scMeta['tpg_category_icon'] ) ? $scMeta['tpg_category_icon'] : true;
|
85 |
-
// Meta Settings
|
86 |
-
$arg['metaPosition'] = isset( $scMeta['tpg_meta_position'] ) ? $scMeta['tpg_meta_position'] : null;
|
87 |
-
$arg['metaIcon'] = ! empty( $scMeta['tpg_meta_icon'] ) ? $scMeta['tpg_meta_icon'] : true;
|
88 |
-
$arg['metaSeparator'] = ! empty( $scMeta['tpg_meta_separator'] ) ? $scMeta['tpg_meta_separator'] : '';
|
89 |
-
/* Argument create */
|
90 |
$args = [];
|
91 |
-
$postType = ( isset( $
|
92 |
|
93 |
if ( $postType ) {
|
94 |
$args['post_type'] = $postType;
|
95 |
}
|
96 |
|
97 |
-
// Common filter
|
98 |
/* post__in */
|
99 |
-
$post__in = ( isset( $
|
|
|
100 |
if ( $post__in ) {
|
101 |
$post__in = explode( ',', $post__in );
|
102 |
$args['post__in'] = $post__in;
|
103 |
}
|
|
|
104 |
/* post__not_in */
|
105 |
-
$post__not_in = ( isset( $
|
|
|
106 |
if ( $post__not_in ) {
|
107 |
$post__not_in = explode( ',', $post__not_in );
|
108 |
$args['post__not_in'] = $post__not_in;
|
109 |
}
|
110 |
|
111 |
/* LIMIT */
|
112 |
-
$limit = ( ( empty( $
|
113 |
-
$queryOffset = empty( $
|
114 |
$args['posts_per_page'] = $limit;
|
115 |
-
$pagination = (
|
116 |
-
$posts_loading_type = ( ! empty( $
|
|
|
117 |
if ( $pagination ) {
|
118 |
-
$posts_per_page = ( isset( $
|
119 |
-
|
|
|
120 |
$posts_per_page = $limit;
|
121 |
}
|
122 |
-
|
123 |
$args['posts_per_page'] = $posts_per_page;
|
124 |
|
125 |
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
|
@@ -127,29 +146,32 @@ class AdminAjaxController {
|
|
127 |
$offset = $posts_per_page * ( (int) $paged - 1 );
|
128 |
$args['paged'] = $paged;
|
129 |
|
130 |
-
|
131 |
-
if ( intval( $args['posts_per_page'] ) > $limit - $offset ) {
|
132 |
$args['posts_per_page'] = $limit - $offset;
|
133 |
}
|
134 |
}
|
135 |
|
136 |
-
|
137 |
-
$
|
138 |
-
$
|
139 |
-
$taxHierarchical = ! empty( $scMeta['tgp_filter_taxonomy_hierarchical'] ) ? true : false;
|
140 |
$taxFilterTerms = [];
|
141 |
-
$taxFilterOperator =
|
142 |
-
|
143 |
$taxQ = [];
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
|
|
|
|
|
|
|
|
148 |
if ( $taxonomy == $taxFilter ) {
|
149 |
$taxFilterTerms = $terms;
|
150 |
}
|
|
|
151 |
if ( is_array( $terms ) && ! empty( $terms ) ) {
|
152 |
-
$operator = ( isset( $
|
153 |
$taxQ[] = [
|
154 |
'taxonomy' => $taxonomy,
|
155 |
'field' => 'term_id',
|
@@ -159,8 +181,9 @@ class AdminAjaxController {
|
|
159 |
}
|
160 |
}
|
161 |
}
|
|
|
162 |
if ( count( $taxQ ) >= 2 ) {
|
163 |
-
$relation = ( isset( $
|
164 |
$taxQ['relation'] = $relation;
|
165 |
}
|
166 |
}
|
@@ -169,25 +192,28 @@ class AdminAjaxController {
|
|
169 |
$args['tax_query'] = $taxQ;
|
170 |
}
|
171 |
|
172 |
-
|
173 |
-
// Order
|
174 |
if ( in_array( 'order', $adv_filter ) ) {
|
175 |
-
$order_by = ( isset( $
|
176 |
-
$order = ( isset( $
|
|
|
177 |
if ( $order ) {
|
178 |
$args['order'] = $order;
|
179 |
}
|
|
|
180 |
if ( $order_by ) {
|
181 |
$args['orderby'] = $order_by;
|
182 |
-
$meta_key = ! empty( $
|
183 |
-
|
|
|
184 |
$args['orderby'] = $order_by;
|
185 |
$args['meta_key'] = $meta_key;
|
186 |
}
|
187 |
}
|
188 |
}
|
|
|
189 |
if ( isset( $_REQUEST['orderby'] ) ) {
|
190 |
-
$orderby = $_REQUEST['orderby'];
|
|
|
191 |
switch ( $orderby ) {
|
192 |
case 'menu_order':
|
193 |
$args['orderby'] = 'menu_order title';
|
@@ -207,41 +233,43 @@ class AdminAjaxController {
|
|
207 |
$args['meta_key'] = '_price';
|
208 |
$args['order'] = 'DESC';
|
209 |
break;
|
210 |
-
case 'rating'
|
211 |
-
// Sorting handled later though a hook
|
212 |
add_filter( 'posts_clauses', [ $this, 'order_by_rating_post_clauses' ] );
|
213 |
break;
|
214 |
-
case 'title'
|
215 |
$args['orderby'] = 'title';
|
216 |
$args['order'] = 'ASC';
|
217 |
break;
|
218 |
}
|
219 |
}
|
220 |
-
|
221 |
if ( in_array( 'tpg_post_status', $adv_filter ) ) {
|
222 |
-
$post_status = ( isset( $
|
|
|
223 |
if ( ! empty( $post_status ) ) {
|
224 |
$args['post_status'] = $post_status;
|
225 |
}
|
226 |
} else {
|
227 |
$args['post_status'] = 'publish';
|
228 |
}
|
229 |
-
|
230 |
$filterAuthors = [];
|
231 |
-
$author = ( isset( $
|
|
|
232 |
if ( in_array( 'author', $adv_filter ) && ! empty( $author ) ) {
|
233 |
$filterAuthors = $args['author__in'] = $author;
|
234 |
}
|
235 |
-
|
236 |
-
$s = ( isset( $
|
|
|
237 |
if ( in_array( 's', $adv_filter ) && ! empty( $s ) ) {
|
238 |
$args['s'] = $s;
|
239 |
}
|
240 |
|
241 |
-
// Date query
|
242 |
if ( in_array( 'date_range', $adv_filter ) ) {
|
243 |
-
$startDate = ( ! empty( $
|
244 |
-
$endDate = ( ! empty( $
|
245 |
if ( $startDate && $endDate ) {
|
246 |
$args['date_query'] = [
|
247 |
[
|
@@ -256,12 +284,14 @@ class AdminAjaxController {
|
|
256 |
$settings = get_option( rtTPG()->options['settings'] );
|
257 |
$override_items = ! empty( $settings['template_override_items'] ) ? $settings['template_override_items'] : [];
|
258 |
$dataArchive = null;
|
|
|
259 |
if ( ( is_archive() || is_search() || is_tag() || is_author() ) && ! empty( $override_items ) ) {
|
260 |
unset( $args['post_type'] );
|
261 |
unset( $args['tax_query'] );
|
262 |
unset( $args['author__in'] );
|
263 |
$obj = get_queried_object();
|
264 |
$aType = $aValue = null;
|
|
|
265 |
if ( in_array( 'tag-archive', $override_items ) && is_tag() ) {
|
266 |
if ( ! empty( $obj->slug ) ) {
|
267 |
$aValue = $args['tag'] = $obj->slug;
|
@@ -271,6 +301,7 @@ class AdminAjaxController {
|
|
271 |
if ( ! empty( $obj->slug ) ) {
|
272 |
$aValue = $args['category_name'] = $obj->slug;
|
273 |
}
|
|
|
274 |
$aType = 'category';
|
275 |
} elseif ( in_array( 'author-archive', $override_items ) && is_author() ) {
|
276 |
$aValue = $args['author'] = $obj->ID;
|
@@ -279,138 +310,161 @@ class AdminAjaxController {
|
|
279 |
$aValue = $args['s'] = get_search_query();
|
280 |
$aType = 'search';
|
281 |
}
|
|
|
282 |
$dataArchive = " data-archive='{$aType}' data-archive-value='{$aValue}'";
|
283 |
$args['posts_per_archive_page'] = $args['posts_per_page'];
|
284 |
}
|
285 |
|
286 |
-
|
287 |
-
$containerDataAttr = null;
|
288 |
$containerDataAttr .= " data-layout='{$layout}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
|
289 |
-
|
290 |
-
$
|
291 |
-
$
|
|
|
|
|
292 |
if ( $isCarousel ) {
|
293 |
$dCol = $tCol = $mCol = 12;
|
294 |
}
|
|
|
295 |
$arg['grid'] = "rt-col-md-{$dCol} rt-col-sm-{$tCol} rt-col-xs-{$mCol}";
|
296 |
-
|
297 |
-
|
|
|
298 |
$iCol = $iCol > 12 ? 4 : $iCol;
|
299 |
$cCol = 12 - $iCol;
|
300 |
$arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
|
301 |
$arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
|
302 |
}
|
303 |
-
|
304 |
-
|
305 |
-
$arg['
|
|
|
306 |
}
|
307 |
-
|
|
|
308 |
$arg_class = [];
|
309 |
-
$arg_class[] =
|
|
|
310 |
if ( ! $isCarousel && ! $isOffset ) {
|
311 |
-
$arg_class[] = $gridType .
|
312 |
}
|
|
|
313 |
if ( $isOffset ) {
|
314 |
-
$arg_class[] =
|
315 |
}
|
316 |
-
|
317 |
-
$catHaveBg = ( isset( $
|
|
|
318 |
if ( ! empty( $catHaveBg ) ) {
|
319 |
$arg_class[] = 'category-have-bg';
|
320 |
}
|
321 |
-
|
322 |
-
$imgAnimationType = isset( $
|
|
|
323 |
if ( ! empty( $imgAnimationType ) ) {
|
324 |
$arg_class[] = $imgAnimationType;
|
325 |
}
|
326 |
|
327 |
$masonryG = null;
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
|
|
332 |
}
|
|
|
333 |
$preLoader = $preLoaderHtml = null;
|
|
|
334 |
if ( $isIsotope ) {
|
335 |
$arg_class[] = 'isotope-item';
|
336 |
$preLoader = 'tpg-pre-loader';
|
337 |
}
|
|
|
338 |
if ( $isCarousel ) {
|
339 |
$arg_class[] = 'swiper-slide';
|
340 |
$preLoader = 'tpg-pre-loader';
|
341 |
}
|
342 |
-
|
|
|
|
|
343 |
if ( $preLoader ) {
|
344 |
$preLoaderHtml = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>';
|
345 |
}
|
346 |
|
347 |
-
$margin = ! empty( $
|
348 |
-
|
|
|
349 |
$arg_class[] = 'no-margin';
|
350 |
}
|
351 |
-
|
|
|
352 |
$arg_class[] = 'tpg-img-circle';
|
353 |
}
|
354 |
|
355 |
$arg['anchorClass'] = null;
|
356 |
$arg['anchorClass'] = $arg['link_target'] = null;
|
357 |
-
$link = isset( $
|
358 |
-
$link = (
|
359 |
$isSinglePopUp = false;
|
360 |
-
$linkType = ! empty( $
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
|
|
365 |
$arg['anchorClass'] .= ' tpg-single-popup';
|
366 |
-
$isSinglePopUp
|
367 |
} else {
|
368 |
$arg['anchorClass'] .= ' tpg-multi-popup';
|
369 |
}
|
370 |
} else {
|
371 |
-
$arg['link_target'] = ! empty( $
|
372 |
}
|
373 |
} else {
|
374 |
$arg['anchorClass'] = ' disabled';
|
375 |
}
|
|
|
376 |
$isSinglePopUp = false;
|
377 |
-
$linkType = ! empty( $
|
378 |
-
|
379 |
-
|
380 |
-
|
|
|
|
|
381 |
$arg['anchorClass'] .= ' tpg-single-popup';
|
382 |
-
$isSinglePopUp
|
383 |
} else {
|
384 |
$arg['anchorClass'] .= ' tpg-multi-popup';
|
385 |
}
|
386 |
}
|
387 |
|
388 |
-
$parentClass
|
389 |
-
$defaultImgId
|
390 |
-
$customImgSize
|
391 |
-
|
392 |
-
$
|
393 |
-
$customSmallImgSize = ( ! empty( $scMeta['custom_small_image_size'] ) ? $scMeta['custom_small_image_size'] : [] );
|
394 |
|
395 |
-
$arg['items'] = isset( $
|
396 |
-
$arg['scID'] = $scID = $
|
397 |
|
398 |
-
|
399 |
-
if ( isset( $arg['excerpt_type'] ) && $arg['excerpt_type'] === 'full' && ( $key = array_search( 'read_more', $arg['items'] ) ) !== false ) {
|
400 |
unset( $arg['items'][ $key ] );
|
401 |
}
|
402 |
|
403 |
-
if ( isset( $
|
404 |
-
$args['ignore_sticky_posts'] = $
|
405 |
}
|
406 |
-
|
407 |
-
$
|
408 |
-
$
|
|
|
|
|
409 |
if ( $taxHierarchical ) {
|
410 |
$terms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, 0 );
|
411 |
} else {
|
412 |
$terms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true );
|
413 |
}
|
|
|
414 |
if ( $hide_all_button && ! $action_term ) {
|
415 |
if ( ! empty( $terms ) ) {
|
416 |
$allKeys = array_keys( $terms );
|
@@ -428,101 +482,182 @@ class AdminAjaxController {
|
|
428 |
];
|
429 |
}
|
430 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
if ( $pagination && $queryOffset && isset( $args['paged'] ) ) {
|
432 |
$queryOffset = ( $posts_per_page * ( $args['paged'] - 1 ) ) + $queryOffset;
|
433 |
}
|
|
|
434 |
if ( $queryOffset ) {
|
435 |
$args['offset'] = $queryOffset;
|
436 |
}
|
437 |
|
438 |
-
$arg['title_tag'] = ( ! empty( $
|
439 |
-
? esc_attr( $scMeta['title_tag'] ) : 'h3';
|
440 |
|
441 |
$gridQuery = new \WP_Query( $args );
|
442 |
-
|
443 |
-
$
|
444 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
$data .= "<div class='rt-container-fluid rt-tpg-container tpg-shortcode-main-wrapper {$parentClass}' id='{$layoutID}' {$dataArchive} {$containerDataAttr}>";
|
446 |
-
// widget heading
|
447 |
-
$heading_tag = isset( $
|
448 |
-
$heading_style = isset( $
|
449 |
-
$heading_alignment = isset( $
|
450 |
-
$heading_link = isset( $
|
451 |
|
452 |
if ( ! empty( $arg['items'] ) && in_array( 'heading', $arg['items'] ) ) {
|
453 |
$data .= sprintf( '<div class="tpg-widget-heading-wrapper heading-%1$s %2$s">', $heading_style, $heading_alignment );
|
454 |
$data .= '<span class="tpg-widget-heading-line line-left"></span>';
|
|
|
455 |
if ( $heading_link ) {
|
456 |
$data .= sprintf( '<%1$s class="tpg-widget-heading"><a href="%2$s" title="%3$s">%3$s</a></%1$s>', $heading_tag, $heading_link, get_the_title( $scID ) );
|
457 |
} else {
|
458 |
$data .= sprintf( '<%1$s class="tpg-widget-heading">%2$s</%1$s>', $heading_tag, get_the_title( $scID ) );
|
459 |
}
|
|
|
460 |
$data .= '<span class="tpg-widget-heading-line"></span>';
|
461 |
$data .= '</div>';
|
462 |
}
|
463 |
|
464 |
-
$filters = ! empty( $
|
|
|
465 |
if ( ! empty( $filters ) && ( $isGrid || $isOffset || $isWooCom ) ) {
|
466 |
-
$data
|
467 |
-
$allText = apply_filters( 'tpg_filter_all_text',
|
468 |
$selectedSubTermsForButton = null;
|
|
|
469 |
if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter ) {
|
470 |
-
$filterType = ( ! empty( $
|
471 |
-
$post_count = ( ! empty( $
|
472 |
-
$postCountClass = ( $post_count ?
|
473 |
|
474 |
-
$allSelect =
|
475 |
$isTermSelected = false;
|
|
|
476 |
if ( $action_term && $taxFilter ) {
|
477 |
$isTermSelected = true;
|
478 |
$allSelect = null;
|
479 |
}
|
480 |
-
|
481 |
-
|
|
|
482 |
$termDefaultText = $allText;
|
483 |
$dataTerm = 'all';
|
484 |
-
$htmlButton =
|
485 |
$selectedSubTerms = null;
|
486 |
$pCount = 0;
|
|
|
487 |
if ( ! empty( $terms ) ) {
|
488 |
$i = 0;
|
|
|
489 |
foreach ( $terms as $id => $term ) {
|
490 |
$pCount = $pCount + $term['count'];
|
491 |
$sT = null;
|
|
|
492 |
if ( $taxHierarchical ) {
|
493 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
|
|
494 |
if ( ! empty( $subTerms ) ) {
|
495 |
$count = 0;
|
496 |
$item = $allCount = null;
|
|
|
497 |
foreach ( $subTerms as $stId => $t ) {
|
498 |
$count = $count + absint( $t['count'] );
|
499 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
500 |
-
$item
|
501 |
}
|
|
|
502 |
if ( $post_count ) {
|
503 |
$allCount = " (<span class='rt-post-count'>{$count}</span>)";
|
504 |
}
|
|
|
505 |
$sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
|
506 |
$sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
$sT .= '<span class="term-dropdown rt-filter-dropdown">';
|
511 |
$sT .= $item;
|
512 |
$sT .= '</span>';
|
513 |
-
$sT .=
|
514 |
}
|
|
|
515 |
if ( $action_term === $id ) {
|
516 |
$selectedSubTerms = $sT;
|
517 |
}
|
518 |
}
|
|
|
519 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
|
|
520 |
if ( $action_term && $action_term == $id ) {
|
521 |
$termDefaultText = $term['name'] . $postCount;
|
522 |
$dataTerm = $id;
|
523 |
}
|
|
|
524 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
525 |
-
if (
|
526 |
if ( ! in_array( $id, $taxFilterTerms ) && $action_term != $id ) {
|
527 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
528 |
}
|
@@ -534,57 +669,69 @@ class AdminAjaxController {
|
|
534 |
} else {
|
535 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
536 |
}
|
|
|
537 |
$i ++;
|
538 |
}
|
539 |
}
|
|
|
540 |
$pAllCount = null;
|
|
|
541 |
if ( $post_count ) {
|
542 |
$pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
|
543 |
if ( ! $action_term ) {
|
544 |
$termDefaultText = $termDefaultText . $pAllCount;
|
545 |
}
|
546 |
}
|
|
|
547 |
if ( ! $hide_all_button ) {
|
548 |
-
$htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText
|
549 |
-
. "{$pAllCount}</span></span>" . $htmlButton;
|
550 |
}
|
551 |
-
$htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
|
552 |
|
|
|
553 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
|
558 |
$data .= $showAllhtml . $htmlButton;
|
559 |
$data .= '</div>' . $selectedSubTerms;
|
560 |
} else {
|
561 |
$bCount = 0;
|
562 |
$bItems = null;
|
|
|
563 |
if ( ! empty( $terms ) ) {
|
564 |
foreach ( $terms as $id => $term ) {
|
565 |
$bCount = $bCount + absint( $term['count'] );
|
566 |
$sT = null;
|
|
|
567 |
if ( $taxHierarchical ) {
|
568 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
|
|
569 |
if ( ! empty( $subTerms ) ) {
|
570 |
$sT .= "<div class='rt-filter-sub-tax sub-button-group'>";
|
|
|
571 |
foreach ( $subTerms as $stId => $t ) {
|
572 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
573 |
-
$sT
|
574 |
}
|
575 |
-
|
|
|
|
|
576 |
if ( $action_term === $id ) {
|
577 |
$selectedSubTermsForButton = $sT;
|
578 |
}
|
579 |
}
|
580 |
}
|
|
|
581 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
582 |
$termSelected = null;
|
|
|
583 |
if ( $isTermSelected && $id == $action_term ) {
|
584 |
-
$termSelected =
|
585 |
}
|
|
|
586 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
587 |
-
if (
|
588 |
if ( ! in_array( $id, $taxFilterTerms ) ) {
|
589 |
$bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
|
590 |
}
|
@@ -598,36 +745,40 @@ class AdminAjaxController {
|
|
598 |
}
|
599 |
}
|
600 |
}
|
|
|
601 |
$data .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
|
|
602 |
if ( ! $hide_all_button ) {
|
603 |
$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
604 |
-
$data
|
605 |
}
|
|
|
606 |
$data .= $bItems;
|
607 |
-
$data .=
|
608 |
}
|
609 |
}
|
610 |
|
611 |
-
// Author filter
|
612 |
if ( in_array( '_author_filter', $filters ) ) {
|
613 |
-
$filterType = ( ! empty( $
|
614 |
-
$post_count = ( ! empty( $
|
615 |
-
$postCountClass = ( $post_count ?
|
616 |
-
|
617 |
-
$
|
618 |
-
|
619 |
-
$allSelect = " selected";
|
620 |
$isTermSelected = false;
|
|
|
621 |
if ( $action_term && $taxFilter ) {
|
622 |
$isTermSelected = true;
|
623 |
$allSelect = null;
|
624 |
}
|
625 |
-
|
626 |
-
|
|
|
627 |
$termDefaultText = $allText;
|
628 |
$dataAuthor = 'all';
|
629 |
-
$htmlButton =
|
630 |
-
$htmlButton
|
|
|
631 |
if ( ! empty( $users ) ) {
|
632 |
foreach ( $users as $user ) {
|
633 |
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
@@ -653,18 +804,20 @@ class AdminAjaxController {
|
|
653 |
if ( $isTermSelected ) {
|
654 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'>" . $allText . "{$pAllCount}</span>";
|
655 |
}
|
|
|
656 |
$htmlButton .= '</span>';
|
657 |
|
658 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
|
663 |
$data .= $showAllhtml . $htmlButton;
|
664 |
$data .= '</div>';
|
665 |
} else {
|
666 |
$bCount = 0;
|
667 |
$bItems = null;
|
|
|
668 |
if ( ! empty( $users ) ) {
|
669 |
foreach ( $users as $user ) {
|
670 |
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
@@ -676,171 +829,195 @@ class AdminAjaxController {
|
|
676 |
}
|
677 |
}
|
678 |
}
|
|
|
679 |
$data .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
|
|
680 |
if ( ! $hide_all_button ) {
|
681 |
$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
682 |
-
$data
|
683 |
}
|
|
|
684 |
$data .= $bItems;
|
685 |
-
$data .=
|
686 |
}
|
687 |
}
|
688 |
|
689 |
if ( in_array( '_search', $filters ) ) {
|
690 |
$data .= '<div class="rt-filter-item-wrap rt-search-filter-wrap">';
|
691 |
-
$data .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__(
|
692 |
$data .= "<span class='rt-action'>🔍</span>";
|
693 |
$data .= "<span class='rt-loading'></span>";
|
694 |
$data .= '</div>';
|
695 |
}
|
696 |
|
697 |
if ( in_array( '_order_by', $filters ) ) {
|
698 |
-
$wooFeature = ( $postType
|
699 |
$orders = Options::rtPostOrderBy( $wooFeature );
|
700 |
-
$action_orderby = ( ! empty( $args['orderby'] ) ? trim( $args['orderby'] ) :
|
701 |
-
|
702 |
-
|
|
|
703 |
} elseif ( in_array( $action_orderby, array_keys( Options::rtMetaKeyType() ) ) ) {
|
704 |
-
$action_orderby_label =
|
705 |
} else {
|
706 |
$action_orderby_label = $orders[ $action_orderby ];
|
707 |
}
|
708 |
-
|
709 |
-
|
|
|
710 |
}
|
|
|
711 |
$data .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap">';
|
712 |
$data .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
$data .= '<span class="order-by-dropdown rt-filter-dropdown">';
|
717 |
|
718 |
foreach ( $orders as $orderKey => $order ) {
|
719 |
$data .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
|
720 |
}
|
|
|
721 |
$data .= '</span>';
|
722 |
$data .= '</div>';
|
723 |
}
|
724 |
|
725 |
if ( in_array( '_sort_order', $filters ) ) {
|
726 |
-
$action_order = ( ! empty( $args['order'] ) ? strtoupper( trim( $args['order'] ) ) :
|
727 |
-
$data
|
728 |
-
$data
|
729 |
-
$data
|
730 |
}
|
731 |
|
732 |
$data .= "</div>$selectedSubTermsForButton</div>";
|
733 |
}
|
734 |
|
735 |
-
$data .= "<div data-title='" .
|
736 |
-
|
737 |
if ( $gridQuery->have_posts() ) {
|
738 |
if ( $isCarousel ) {
|
739 |
-
$cOpt = ! empty( $
|
740 |
-
$slider_js_options = apply_filters(
|
|
|
741 |
[
|
742 |
-
|
743 |
-
|
744 |
-
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
]
|
753 |
-
|
754 |
-
$data
|
755 |
-
|
|
|
|
|
756 |
}
|
|
|
757 |
$isotope_filter = null;
|
|
|
758 |
if ( $isIsotope ) {
|
759 |
-
$isotope_filter = isset( $
|
760 |
-
$isotope_dropdown_filter = isset( $
|
761 |
$selectedTerms = [];
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
&& isset( $scMeta['tpg_taxonomy'] )
|
766 |
-
&& in_array( $isotope_filter,
|
767 |
-
$scMeta['tpg_taxonomy'] )
|
768 |
-
) {
|
769 |
-
$selectedTerms = ( isset( $scMeta[ 'term_' . $isotope_filter ] ) ? $scMeta[ 'term_' . $isotope_filter ] : [] );
|
770 |
}
|
|
|
771 |
global $wp_version;
|
|
|
772 |
if ( version_compare( $wp_version, '4.5', '>=' ) ) {
|
773 |
-
$terms = get_terms(
|
|
|
774 |
[
|
775 |
'meta_key' => '_rt_order',
|
776 |
'orderby' => 'meta_value_num',
|
777 |
'order' => 'ASC',
|
778 |
'hide_empty' => false,
|
779 |
'include' => $selectedTerms,
|
780 |
-
]
|
|
|
781 |
} else {
|
782 |
-
$terms = get_terms(
|
|
|
783 |
[
|
784 |
'orderby' => 'name',
|
785 |
'order' => 'ASC',
|
786 |
'hide_empty' => false,
|
787 |
'include' => $selectedTerms,
|
788 |
-
]
|
|
|
789 |
}
|
790 |
-
|
|
|
791 |
$htmlButton = $drop = null;
|
792 |
$fSelectTrigger = false;
|
|
|
793 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
|
794 |
foreach ( $terms as $term ) {
|
795 |
-
$tItem = ! empty( $
|
796 |
$fSelected = null;
|
|
|
797 |
if ( $tItem == $term->term_id ) {
|
798 |
$fSelected = 'selected';
|
799 |
$fSelectTrigger = true;
|
800 |
}
|
801 |
-
|
|
|
|
|
802 |
esc_attr( $term->slug ),
|
803 |
-
$fSelected ?
|
804 |
$term->term_id,
|
805 |
$term->name
|
806 |
);
|
807 |
$drop .= "<option value='.iso_{$term->term_id}' {$fSelected}>{$term->name}</option>";
|
808 |
}
|
809 |
}
|
810 |
-
|
|
|
811 |
$fSelect = ( $fSelectTrigger ? null : 'class="selected"' );
|
812 |
-
$htmlButton = "<button data-filter='*' {$fSelect}>" . $arg['show_all_text'] .
|
813 |
$drop = "<option value='*' {$fSelect}>{$arg['show_all_text']}</option>" . $drop;
|
814 |
}
|
815 |
-
|
816 |
-
$
|
817 |
-
$
|
818 |
-
|
|
|
819 |
|
820 |
if ( $isotope_dropdown_filter ) {
|
821 |
$data .= "<select class='isotope-dropdown-filter'>{$drop}</select>";
|
822 |
} else {
|
823 |
$data .= $htmlButton;
|
824 |
}
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
}
|
829 |
-
$data .= '</div>';
|
830 |
|
|
|
831 |
$data .= "<div class='rt-tpg-isotope' id='iso-tpg-{$rand}'>";
|
832 |
}
|
833 |
|
834 |
$l = $offLoop = 0;
|
835 |
$offsetBigHtml = $offsetSmallHtml = null;
|
836 |
$tgCol = 2;
|
837 |
-
|
|
|
838 |
$tgCol = round( 12 / $dCol );
|
839 |
}
|
|
|
840 |
$gridPostCount = 0;
|
841 |
$arg['totalPost'] = $gridQuery->post_count;
|
842 |
|
843 |
-
while ( $gridQuery->have_posts() ) :
|
|
|
|
|
844 |
if ( $tgCol == $l ) {
|
845 |
if ( $this->l4toggle ) {
|
846 |
$this->l4toggle = false;
|
@@ -849,6 +1026,7 @@ class AdminAjaxController {
|
|
849 |
}
|
850 |
$l = 0;
|
851 |
}
|
|
|
852 |
$arg['postCount'] = $gridPostCount ++;
|
853 |
$pID = get_the_ID();
|
854 |
$arg['pID'] = $pID;
|
@@ -864,142 +1042,166 @@ class AdminAjaxController {
|
|
864 |
$arg['tags'] = get_the_term_list( $pID, 'post_tag', null, ', ' );
|
865 |
$arg['post_count'] = get_post_meta( $pID, Fns::get_post_view_count_meta_key(), true );
|
866 |
$arg['responsiveCol'] = [ $dCol, $tCol, $mCol ];
|
|
|
867 |
if ( $isIsotope ) {
|
868 |
-
$termAs = wp_get_post_terms( $pID, $isotope_filter, [
|
869 |
$isoFilter = [];
|
|
|
870 |
if ( ! empty( $termAs ) ) {
|
871 |
foreach ( $termAs as $term ) {
|
872 |
-
$isoFilter[] =
|
873 |
-
$isoFilter[] =
|
874 |
}
|
875 |
}
|
876 |
-
|
|
|
877 |
}
|
|
|
878 |
$deptClass = null;
|
|
|
879 |
if ( ! empty( $deptAs ) ) {
|
880 |
foreach ( $deptAs as $dept ) {
|
881 |
-
$deptClass .=
|
882 |
}
|
883 |
}
|
|
|
884 |
if ( comments_open() ) {
|
885 |
$arg['comment'] = "<a href='" . get_comments_link( $pID ) . "'>{$comments_text} </a>";
|
886 |
} else {
|
887 |
$arg['comment'] = "{$comments_text}";
|
888 |
}
|
|
|
889 |
$imgSrc = null;
|
890 |
-
$arg['smallImgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
|
|
891 |
$fSmallImgSize,
|
892 |
$mediaSource,
|
893 |
$defaultImgId,
|
894 |
-
$customSmallImgSize
|
|
|
|
|
895 |
if ( $isOffset ) {
|
896 |
-
if ( $offLoop
|
897 |
-
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
|
|
898 |
$fImgSize,
|
899 |
$mediaSource,
|
900 |
$defaultImgId,
|
901 |
-
$customImgSize
|
|
|
902 |
$arg['offset'] = 'big';
|
903 |
$offsetBigHtml = Fns::get_template_html( 'layouts/' . $layout, $arg );
|
904 |
} else {
|
905 |
$arg['offset'] = 'small';
|
906 |
$arg['offsetCol'] = [ $dCol, $tCol, $mCol ];
|
907 |
-
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
|
|
908 |
'thumbnail',
|
909 |
$mediaSource,
|
910 |
$defaultImgId,
|
911 |
-
$customImgSize
|
912 |
-
|
|
|
913 |
}
|
914 |
} else {
|
915 |
-
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
|
|
916 |
$fImgSize,
|
917 |
$mediaSource,
|
918 |
$defaultImgId,
|
919 |
-
$customImgSize
|
920 |
-
|
|
|
921 |
}
|
922 |
$offLoop ++;
|
923 |
$l ++;
|
924 |
endwhile;
|
|
|
925 |
if ( $isOffset ) {
|
926 |
$oDCol = Fns::get_offset_col( $dCol );
|
927 |
$oTCol = Fns::get_offset_col( $tCol );
|
928 |
$oMCol = Fns::get_offset_col( $mCol );
|
929 |
-
|
|
|
930 |
$oDCol['big'] = $oTCol['big'] = $oDCol['small'] = $oTCol['small'] = 6;
|
931 |
$oMCol['big'] = $oMCol['small'] = 12;
|
932 |
-
} elseif ( $layout
|
933 |
$oDCol['big'] = 7;
|
934 |
$oDCol['small'] = 5;
|
935 |
}
|
|
|
936 |
$data .= "<div class='rt-col-md-{$oDCol['big']} rt-col-sm-{$oTCol['big']} rt-col-xs-{$oMCol['big']}'><div class='rt-row'>{$offsetBigHtml}</div></div>";
|
937 |
$data .= "<div class='rt-col-md-{$oDCol['small']} rt-col-sm-{$oTCol['small']} rt-col-xs-{$oMCol['small']}'><div class='rt-row offset-small-wrap'>{$offsetSmallHtml}</div></div>";
|
938 |
}
|
|
|
939 |
if ( $isIsotope || $isCarousel ) {
|
940 |
-
$data .= '</div>'; // End isotope / Carousel item holder
|
|
|
941 |
if ( $isCarousel ) {
|
942 |
if ( in_array( 'pagination', $cOpt ) ) {
|
943 |
$data .= '<div class="swiper-pagination"></div>';
|
944 |
}
|
|
|
945 |
$data .= '</div>';
|
|
|
946 |
if ( in_array( 'nav_button', $cOpt ) ) {
|
947 |
$data .= '<div class="swiper-navigation"><div class="slider-btn swiper-button-prev"></div><div class="slider-btn swiper-button-next"></div></div>';
|
948 |
}
|
949 |
}
|
950 |
}
|
951 |
} else {
|
952 |
-
$not_found_text = isset( $
|
953 |
-
|
954 |
-
$data .= "<p>" . $not_found_text . "</p>";
|
955 |
}
|
956 |
-
|
957 |
-
$data
|
|
|
958 |
$htmlUtility = null;
|
|
|
959 |
if ( $pagination && ! $isCarousel ) {
|
960 |
if ( $isOffset || $isGridHover ) {
|
961 |
-
$posts_loading_type =
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
|
|
966 |
} else {
|
967 |
-
if ( $posts_loading_type
|
968 |
if ( $isGrid && empty( $filters ) ) {
|
969 |
$htmlUtility .= Fns::rt_pagination( $gridQuery, $args['posts_per_page'] );
|
970 |
}
|
971 |
-
} elseif ( $posts_loading_type
|
972 |
if ( $isGrid ) {
|
973 |
$htmlUtility .= "<div class='rt-page-numbers'></div>";
|
974 |
} else {
|
975 |
$htmlUtility .= Fns::rt_pagination( $gridQuery, $args['posts_per_page'], true );
|
976 |
}
|
977 |
-
} elseif ( $posts_loading_type
|
978 |
-
|
979 |
-
$load_more_btn_text
|
980 |
-
$load_more_text = $load_more_btn_text ? esc_html( $load_more_btn_text ) : __( 'Load More', 'the-post-grid' );
|
981 |
|
982 |
if ( $isGrid ) {
|
983 |
$htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style'>
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
} else {
|
988 |
$htmlUtility .= "<div class='rt-tpg-load-more'>
|
989 |
-
|
990 |
-
|
991 |
}
|
992 |
-
} elseif ( $posts_loading_type
|
993 |
if ( $isGrid ) {
|
994 |
-
$htmlUtility .= "<div class='rt-infinite-action'>
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
} else {
|
1002 |
-
$htmlUtility .=
|
1003 |
}
|
1004 |
}
|
1005 |
}
|
@@ -1007,30 +1209,32 @@ class AdminAjaxController {
|
|
1007 |
|
1008 |
if ( $htmlUtility ) {
|
1009 |
$l4toggle = null;
|
1010 |
-
|
1011 |
-
|
|
|
1012 |
}
|
|
|
1013 |
if ( $isGrid || $isOffset || $isWooCom ) {
|
1014 |
-
$data .=
|
1015 |
-
. $htmlUtility . "</div>";
|
1016 |
} else {
|
1017 |
-
$data .=
|
1018 |
}
|
1019 |
}
|
1020 |
|
1021 |
-
$data .=
|
1022 |
-
|
1023 |
|
1024 |
} else {
|
1025 |
-
$msg =
|
1026 |
}
|
1027 |
|
1028 |
-
wp_send_json(
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
|
|
|
|
1033 |
die();
|
1034 |
}
|
1035 |
|
1036 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Admin Ajax class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers\Admin;
|
9 |
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
use RT\ThePostGrid\Helpers\Options;
|
12 |
|
13 |
+
// Do not allow directly accessing this file.
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit( 'This script cannot be accessed directly.' );
|
16 |
+
}
|
17 |
|
18 |
+
/**
|
19 |
+
* Admin Ajax class.
|
20 |
+
*/
|
21 |
+
class AdminAjaxController {
|
22 |
+
/**
|
23 |
+
* Layout 4 toggle
|
24 |
+
*
|
25 |
+
* @var boolean
|
26 |
+
*/
|
27 |
private $l4toggle = false;
|
28 |
|
29 |
+
/**
|
30 |
+
* Class Construct
|
31 |
+
*/
|
32 |
public function __construct() {
|
33 |
add_action( 'wp_ajax_tpgPreviewAjaxCall', [ $this, 'tpgPreviewAjaxCall' ] );
|
34 |
}
|
35 |
|
36 |
/**
|
37 |
* Preview rendering
|
38 |
+
*
|
39 |
+
* @return void
|
40 |
*/
|
41 |
+
public function tpgPreviewAjaxCall() {
|
42 |
$msg = $data = null;
|
43 |
$error = true;
|
44 |
+
|
45 |
if ( Fns::verifyNonce() ) {
|
46 |
+
$error = false;
|
47 |
+
$rand = wp_rand();
|
48 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
49 |
|
50 |
+
$layout = ( isset( $_REQUEST['layout'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['layout'] ) ) : 'layout1' );
|
|
|
51 |
|
52 |
+
if ( ! in_array( $layout, array_keys( Options::rtTPGLayouts() ), true ) ) {
|
|
|
53 |
$layout = 'layout1';
|
54 |
}
|
55 |
|
60 |
$isOffset = preg_match( '/offset/', $layout );
|
61 |
$isGridHover = preg_match( '/grid_hover/', $layout );
|
62 |
|
63 |
+
$dCol = ( isset( $_REQUEST['column'] ) ? absint( $_REQUEST['column'] ) : 3 );
|
64 |
+
$tCol = ( isset( $_REQUEST['tpg_tab_column'] ) ? absint( $_REQUEST['tpg_tab_column'] ) : 2 );
|
65 |
+
$mCol = ( isset( $_REQUEST['tpg_mobile_column'] ) ? absint( $_REQUEST['tpg_mobile_column'] ) : 1 );
|
66 |
+
|
67 |
+
if ( ! in_array( $dCol, array_keys( Options::scColumns() ), true ) ) {
|
68 |
$dCol = 3;
|
69 |
}
|
70 |
+
|
71 |
+
if ( ! in_array( $tCol, array_keys( Options::scColumns() ), true ) ) {
|
72 |
$tCol = 2;
|
73 |
}
|
74 |
+
|
75 |
+
if ( ! in_array( $dCol, array_keys( Options::scColumns() ), true ) ) {
|
76 |
$mCol = 1;
|
77 |
}
|
78 |
|
81 |
$tCol = ( $tCol < 3 ? 2 : $tCol );
|
82 |
$mCol = ( $mCol < 3 ? 1 : $mCol );
|
83 |
}
|
84 |
+
|
85 |
$arg = [];
|
86 |
+
$fImg = ! empty( $_REQUEST['feature_image'] );
|
87 |
+
$fImgSize = ( isset( $_REQUEST['featured_image_size'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['featured_image_size'] ) ) : 'medium' );
|
88 |
+
$mediaSource = ( isset( $_REQUEST['media_source'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['media_source'] ) ) : 'feature_image' );
|
89 |
+
$arg['excerpt_type'] = ( isset( $_REQUEST['tgp_excerpt_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tgp_excerpt_type'] ) ) : 'character' );
|
90 |
+
$arg['title_limit_type'] = ( isset( $_REQUEST['tpg_title_limit_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_title_limit_type'] ) ) : 'character' );
|
91 |
+
$arg['excerpt_limit'] = ( isset( $_REQUEST['excerpt_limit'] ) ? absint( $_REQUEST['excerpt_limit'] ) : 0 );
|
92 |
+
$arg['title_limit'] = ( isset( $_REQUEST['tpg_title_limit'] ) ? absint( $_REQUEST['tpg_title_limit'] ) : 0 );
|
93 |
+
$arg['excerpt_more_text'] = ( isset( $_REQUEST['tgp_excerpt_more_text'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tgp_excerpt_more_text'] ) ) : null );
|
94 |
+
$arg['read_more_text'] = ( ! empty( $_REQUEST['tgp_read_more_text'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tgp_read_more_text'] ) ) : esc_html__( 'Read More', 'the-post-grid' ) );
|
95 |
+
$arg['show_all_text'] = ( ! empty( $_REQUEST['tpg_show_all_text'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_show_all_text'] ) ) : esc_html__( 'Show all', 'the-post-grid' ) );
|
96 |
+
$arg['tpg_title_position'] = isset( $_REQUEST['tpg_title_position'] ) && ! empty( $_REQUEST['tpg_title_position'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_title_position'] ) ) : null;
|
97 |
+
$arg['btn_alignment_class'] = isset( $_REQUEST['tpg_read_more_button_alignment'] ) && ! empty( $_REQUEST['tpg_read_more_button_alignment'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_read_more_button_alignment'] ) ) : '';
|
98 |
+
$arg['category_position'] = isset( $_REQUEST['tpg_category_position'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_category_position'] ) ) : null;
|
99 |
+
$arg['category_style'] = ! empty( $_REQUEST['tpg_category_style'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_category_style'] ) ) : '';
|
100 |
+
$arg['catIcon'] = isset( $_REQUEST['tpg_category_icon'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_category_icon'] ) ) : true;
|
101 |
+
$arg['metaPosition'] = isset( $_REQUEST['tpg_meta_position'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_meta_position'] ) ) : null;
|
102 |
+
$arg['metaIcon'] = ! empty( $_REQUEST['tpg_meta_icon'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_meta_icon'] ) ) : true;
|
103 |
+
$arg['metaSeparator'] = ! empty( $_REQUEST['tpg_meta_separator'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_meta_separator'] ) ) : '';
|
104 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
$args = [];
|
106 |
+
$postType = ( isset( $_REQUEST['tpg_post_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_post_type'] ) ) : null );
|
107 |
|
108 |
if ( $postType ) {
|
109 |
$args['post_type'] = $postType;
|
110 |
}
|
111 |
|
|
|
112 |
/* post__in */
|
113 |
+
$post__in = ( isset( $_REQUEST['post__in'] ) ? absint( $_REQUEST['post__in'] ) : null );
|
114 |
+
|
115 |
if ( $post__in ) {
|
116 |
$post__in = explode( ',', $post__in );
|
117 |
$args['post__in'] = $post__in;
|
118 |
}
|
119 |
+
|
120 |
/* post__not_in */
|
121 |
+
$post__not_in = ( isset( $_REQUEST['post__not_in'] ) ? absint( $_REQUEST['post__not_in'] ) : null );
|
122 |
+
|
123 |
if ( $post__not_in ) {
|
124 |
$post__not_in = explode( ',', $post__not_in );
|
125 |
$args['post__not_in'] = $post__not_in;
|
126 |
}
|
127 |
|
128 |
/* LIMIT */
|
129 |
+
$limit = ( ( empty( $_REQUEST['limit'] ) || '-1' === $_REQUEST['limit'] ) ? -1 : absint( $_REQUEST['limit'] ) );
|
130 |
+
$queryOffset = empty( $_REQUEST['offset'] ) ? 0 : absint( $_REQUEST['offset'] );
|
131 |
$args['posts_per_page'] = $limit;
|
132 |
+
$pagination = isset( $_REQUEST['pagination'] ) && ! empty( $_REQUEST['pagination'] );
|
133 |
+
$posts_loading_type = ( ! empty( $_REQUEST['posts_loading_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['posts_loading_type'] ) ) : 'pagination' );
|
134 |
+
|
135 |
if ( $pagination ) {
|
136 |
+
$posts_per_page = ( isset( $_REQUEST['posts_per_page'] ) ? absint( $_REQUEST['posts_per_page'] ) : $limit );
|
137 |
+
|
138 |
+
if ( $posts_per_page > $limit && $limit != '-1' ) {
|
139 |
$posts_per_page = $limit;
|
140 |
}
|
141 |
+
|
142 |
$args['posts_per_page'] = $posts_per_page;
|
143 |
|
144 |
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
|
146 |
$offset = $posts_per_page * ( (int) $paged - 1 );
|
147 |
$args['paged'] = $paged;
|
148 |
|
149 |
+
if ( intval( $args['posts_per_page'] ) > $limit - $offset && $limit != '-1' ) {
|
|
|
150 |
$args['posts_per_page'] = $limit - $offset;
|
151 |
}
|
152 |
}
|
153 |
|
154 |
+
$adv_filter = ( isset( $_REQUEST['post_filter'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['post_filter'] ) ) : [] );
|
155 |
+
$taxFilter = ( ! empty( $_REQUEST['tgp_filter_taxonomy'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tgp_filter_taxonomy'] ) ) : null );
|
156 |
+
$taxHierarchical = ! empty( $_REQUEST['tgp_filter_taxonomy_hierarchical'] );
|
|
|
157 |
$taxFilterTerms = [];
|
158 |
+
$taxFilterOperator = 'IN';
|
159 |
+
|
160 |
$taxQ = [];
|
161 |
+
|
162 |
+
if ( in_array( 'tpg_taxonomy', $adv_filter ) && isset( $_REQUEST['tpg_taxonomy'] ) ) {
|
163 |
+
$tpgTaxonomy = array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['tpg_taxonomy'] ) );
|
164 |
+
|
165 |
+
if ( is_array( $tpgTaxonomy ) && ! empty( $tpgTaxonomy ) ) {
|
166 |
+
foreach ( $tpgTaxonomy as $taxonomy ) {
|
167 |
+
$terms = ( isset( $_REQUEST[ 'term_' . $taxonomy ] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST[ 'term_' . $taxonomy ] ) ) : [] );
|
168 |
+
|
169 |
if ( $taxonomy == $taxFilter ) {
|
170 |
$taxFilterTerms = $terms;
|
171 |
}
|
172 |
+
|
173 |
if ( is_array( $terms ) && ! empty( $terms ) ) {
|
174 |
+
$operator = ( isset( $_REQUEST[ 'term_operator_' . $taxonomy ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 'term_operator_' . $taxonomy ] ) ) : 'IN' );
|
175 |
$taxQ[] = [
|
176 |
'taxonomy' => $taxonomy,
|
177 |
'field' => 'term_id',
|
181 |
}
|
182 |
}
|
183 |
}
|
184 |
+
|
185 |
if ( count( $taxQ ) >= 2 ) {
|
186 |
+
$relation = ( isset( $_REQUEST['taxonomy_relation'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['taxonomy_relation'] ) ) : 'AND' );
|
187 |
$taxQ['relation'] = $relation;
|
188 |
}
|
189 |
}
|
192 |
$args['tax_query'] = $taxQ;
|
193 |
}
|
194 |
|
|
|
|
|
195 |
if ( in_array( 'order', $adv_filter ) ) {
|
196 |
+
$order_by = ( isset( $_REQUEST['order_by'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['order_by'] ) ) : null );
|
197 |
+
$order = ( isset( $_REQUEST['order'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) : null );
|
198 |
+
|
199 |
if ( $order ) {
|
200 |
$args['order'] = $order;
|
201 |
}
|
202 |
+
|
203 |
if ( $order_by ) {
|
204 |
$args['orderby'] = $order_by;
|
205 |
+
$meta_key = ! empty( $_REQUEST['tpg_meta_key'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_meta_key'] ) ) : null;
|
206 |
+
|
207 |
+
if ( in_array( $order_by, array_keys( Options::rtMetaKeyType() ), true ) && $meta_key ) {
|
208 |
$args['orderby'] = $order_by;
|
209 |
$args['meta_key'] = $meta_key;
|
210 |
}
|
211 |
}
|
212 |
}
|
213 |
+
|
214 |
if ( isset( $_REQUEST['orderby'] ) ) {
|
215 |
+
$orderby = sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) );
|
216 |
+
|
217 |
switch ( $orderby ) {
|
218 |
case 'menu_order':
|
219 |
$args['orderby'] = 'menu_order title';
|
233 |
$args['meta_key'] = '_price';
|
234 |
$args['order'] = 'DESC';
|
235 |
break;
|
236 |
+
case 'rating':
|
237 |
+
// Sorting handled later though a hook.
|
238 |
add_filter( 'posts_clauses', [ $this, 'order_by_rating_post_clauses' ] );
|
239 |
break;
|
240 |
+
case 'title':
|
241 |
$args['orderby'] = 'title';
|
242 |
$args['order'] = 'ASC';
|
243 |
break;
|
244 |
}
|
245 |
}
|
246 |
+
|
247 |
if ( in_array( 'tpg_post_status', $adv_filter ) ) {
|
248 |
+
$post_status = ( isset( $_REQUEST['tpg_post_status'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['tpg_post_status'] ) ) : [] );
|
249 |
+
|
250 |
if ( ! empty( $post_status ) ) {
|
251 |
$args['post_status'] = $post_status;
|
252 |
}
|
253 |
} else {
|
254 |
$args['post_status'] = 'publish';
|
255 |
}
|
256 |
+
|
257 |
$filterAuthors = [];
|
258 |
+
$author = ( isset( $_REQUEST['author'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['author'] ) ) : [] );
|
259 |
+
|
260 |
if ( in_array( 'author', $adv_filter ) && ! empty( $author ) ) {
|
261 |
$filterAuthors = $args['author__in'] = $author;
|
262 |
}
|
263 |
+
|
264 |
+
$s = ( isset( $_REQUEST['s'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : [] );
|
265 |
+
|
266 |
if ( in_array( 's', $adv_filter ) && ! empty( $s ) ) {
|
267 |
$args['s'] = $s;
|
268 |
}
|
269 |
|
|
|
270 |
if ( in_array( 'date_range', $adv_filter ) ) {
|
271 |
+
$startDate = ( ! empty( $_REQUEST['date_range_start'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['date_range_start'] ) ) : null );
|
272 |
+
$endDate = ( ! empty( $_REQUEST['date_range_end'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['date_range_end'] ) ) : null );
|
273 |
if ( $startDate && $endDate ) {
|
274 |
$args['date_query'] = [
|
275 |
[
|
284 |
$settings = get_option( rtTPG()->options['settings'] );
|
285 |
$override_items = ! empty( $settings['template_override_items'] ) ? $settings['template_override_items'] : [];
|
286 |
$dataArchive = null;
|
287 |
+
|
288 |
if ( ( is_archive() || is_search() || is_tag() || is_author() ) && ! empty( $override_items ) ) {
|
289 |
unset( $args['post_type'] );
|
290 |
unset( $args['tax_query'] );
|
291 |
unset( $args['author__in'] );
|
292 |
$obj = get_queried_object();
|
293 |
$aType = $aValue = null;
|
294 |
+
|
295 |
if ( in_array( 'tag-archive', $override_items ) && is_tag() ) {
|
296 |
if ( ! empty( $obj->slug ) ) {
|
297 |
$aValue = $args['tag'] = $obj->slug;
|
301 |
if ( ! empty( $obj->slug ) ) {
|
302 |
$aValue = $args['category_name'] = $obj->slug;
|
303 |
}
|
304 |
+
|
305 |
$aType = 'category';
|
306 |
} elseif ( in_array( 'author-archive', $override_items ) && is_author() ) {
|
307 |
$aValue = $args['author'] = $obj->ID;
|
310 |
$aValue = $args['s'] = get_search_query();
|
311 |
$aType = 'search';
|
312 |
}
|
313 |
+
|
314 |
$dataArchive = " data-archive='{$aType}' data-archive-value='{$aValue}'";
|
315 |
$args['posts_per_archive_page'] = $args['posts_per_page'];
|
316 |
}
|
317 |
|
318 |
+
$containerDataAttr = null;
|
|
|
319 |
$containerDataAttr .= " data-layout='{$layout}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
|
320 |
+
|
321 |
+
$dCol = 5 === $dCol ? '24' : round( 12 / $dCol );
|
322 |
+
$tCol = 5 === $dCol ? '24' : round( 12 / $tCol );
|
323 |
+
$mCol = 5 === $dCol ? '24' : round( 12 / $mCol );
|
324 |
+
|
325 |
if ( $isCarousel ) {
|
326 |
$dCol = $tCol = $mCol = 12;
|
327 |
}
|
328 |
+
|
329 |
$arg['grid'] = "rt-col-md-{$dCol} rt-col-sm-{$tCol} rt-col-xs-{$mCol}";
|
330 |
+
|
331 |
+
if ( ( 'layout2' === $layout ) || ( 'layout3' === $layout ) ) {
|
332 |
+
$iCol = ( isset( $_REQUEST['tgp_layout2_image_column'] ) ? absint( $_REQUEST['tgp_layout2_image_column'] ) : 4 );
|
333 |
$iCol = $iCol > 12 ? 4 : $iCol;
|
334 |
$cCol = 12 - $iCol;
|
335 |
$arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
|
336 |
$arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
|
337 |
}
|
338 |
+
|
339 |
+
if ( 'layout4' === $layout ) {
|
340 |
+
$arg['image_area'] = 'rt-col-lg-6 rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ';
|
341 |
+
$arg['content_area'] = 'rt-col-lg-6 rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ';
|
342 |
}
|
343 |
+
|
344 |
+
$gridType = ! empty( $_REQUEST['grid_style'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['grid_style'] ) ) : 'even';
|
345 |
$arg_class = [];
|
346 |
+
$arg_class[] = ' rt-grid-item';
|
347 |
+
|
348 |
if ( ! $isCarousel && ! $isOffset ) {
|
349 |
+
$arg_class[] = $gridType . '-grid-item';
|
350 |
}
|
351 |
+
|
352 |
if ( $isOffset ) {
|
353 |
+
$arg_class[] = 'rt-offset-item';
|
354 |
}
|
355 |
+
|
356 |
+
$catHaveBg = ( isset( $_REQUEST['tpg_category_bg'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_category_bg'] ) ) : '' );
|
357 |
+
|
358 |
if ( ! empty( $catHaveBg ) ) {
|
359 |
$arg_class[] = 'category-have-bg';
|
360 |
}
|
361 |
+
|
362 |
+
$imgAnimationType = isset( $_REQUEST['tpg_image_animation'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_image_animation'] ) ) : '';
|
363 |
+
|
364 |
if ( ! empty( $imgAnimationType ) ) {
|
365 |
$arg_class[] = $imgAnimationType;
|
366 |
}
|
367 |
|
368 |
$masonryG = null;
|
369 |
+
|
370 |
+
if ( 'even' === $gridType && ! $isIsotope && ! $isCarousel ) {
|
371 |
+
$masonryG = 'tpg-even';
|
372 |
+
} elseif ( 'masonry' === $gridType && ! $isIsotope && ! $isCarousel ) {
|
373 |
+
$masonryG = ' tpg-masonry';
|
374 |
}
|
375 |
+
|
376 |
$preLoader = $preLoaderHtml = null;
|
377 |
+
|
378 |
if ( $isIsotope ) {
|
379 |
$arg_class[] = 'isotope-item';
|
380 |
$preLoader = 'tpg-pre-loader';
|
381 |
}
|
382 |
+
|
383 |
if ( $isCarousel ) {
|
384 |
$arg_class[] = 'swiper-slide';
|
385 |
$preLoader = 'tpg-pre-loader';
|
386 |
}
|
387 |
+
|
388 |
+
$arg['class'] = implode( ' ', $arg_class );
|
389 |
+
|
390 |
if ( $preLoader ) {
|
391 |
$preLoaderHtml = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>';
|
392 |
}
|
393 |
|
394 |
+
$margin = ! empty( $_REQUEST['margin_option'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['margin_option'] ) ) : 'default';
|
395 |
+
|
396 |
+
if ( 'no' === $margin ) {
|
397 |
$arg_class[] = 'no-margin';
|
398 |
}
|
399 |
+
|
400 |
+
if ( ! empty( $_REQUEST['tpg_image_type'] ) && 'circle' === $_REQUEST['tpg_image_type'] ) {
|
401 |
$arg_class[] = 'tpg-img-circle';
|
402 |
}
|
403 |
|
404 |
$arg['anchorClass'] = null;
|
405 |
$arg['anchorClass'] = $arg['link_target'] = null;
|
406 |
+
$link = isset( $_REQUEST['link_to_detail_page'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['link_to_detail_page'] ) ) : '1';
|
407 |
+
$link = ( 'yes' === $link ) ? '1' : $link;
|
408 |
$isSinglePopUp = false;
|
409 |
+
$linkType = ! empty( $_REQUEST['detail_page_link_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['detail_page_link_type'] ) ) : 'popup';
|
410 |
+
|
411 |
+
if ( '1' === $link ) {
|
412 |
+
if ( 'popup' === $linkType && rtTPG()->hasPro() ) {
|
413 |
+
$popupType = ! empty( $_REQUEST['popup_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['popup_type'] ) ) : 'single';
|
414 |
+
if ( 'single' === $popupType ) {
|
415 |
$arg['anchorClass'] .= ' tpg-single-popup';
|
416 |
+
$isSinglePopUp = true;
|
417 |
} else {
|
418 |
$arg['anchorClass'] .= ' tpg-multi-popup';
|
419 |
}
|
420 |
} else {
|
421 |
+
$arg['link_target'] = ! empty( $_REQUEST['link_target'] ) ? ' target="' . sanitize_text_field( wp_unslash( $_REQUEST['link_target'] ) ) . '"' : null;
|
422 |
}
|
423 |
} else {
|
424 |
$arg['anchorClass'] = ' disabled';
|
425 |
}
|
426 |
+
|
427 |
$isSinglePopUp = false;
|
428 |
+
$linkType = ! empty( $_REQUEST['detail_page_link_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['detail_page_link_type'] ) ) : 'popup';
|
429 |
+
|
430 |
+
if ( '1' === $link && 'popup' === $linkType && rtTPG()->hasPro() ) {
|
431 |
+
$popupType = ! empty( $_REQUEST['popup_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['popup_type'] ) ) : 'single';
|
432 |
+
|
433 |
+
if ( 'single' === $popupType ) {
|
434 |
$arg['anchorClass'] .= ' tpg-single-popup';
|
435 |
+
$isSinglePopUp = true;
|
436 |
} else {
|
437 |
$arg['anchorClass'] .= ' tpg-multi-popup';
|
438 |
}
|
439 |
}
|
440 |
|
441 |
+
$parentClass = ( ! empty( $_REQUEST['parent_class'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['parent_class'] ) ) : null );
|
442 |
+
$defaultImgId = ( ! empty( $_REQUEST['default_preview_image'] ) ? absint( $_REQUEST['default_preview_image'] ) : null );
|
443 |
+
$customImgSize = ( ! empty( $_REQUEST['custom_image_size'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['custom_image_size'] ) ) : [] );
|
444 |
+
$fSmallImgSize = ( isset( $_REQUEST['featured_small_image_size'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['featured_small_image_size'] ) ) : 'medium' );
|
445 |
+
$customSmallImgSize = ( ! empty( $_REQUEST['custom_small_image_size'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['custom_small_image_size'] ) ) : [] );
|
|
|
446 |
|
447 |
+
$arg['items'] = isset( $_REQUEST['item_fields'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['item_fields'] ) ) : [];
|
448 |
+
$arg['scID'] = $scID = isset( $_REQUEST['sc_id'] ) ? absint( $_REQUEST['sc_id'] ) : null;
|
449 |
|
450 |
+
if ( isset( $arg['excerpt_type'] ) && 'full' === $arg['excerpt_type'] && ( $key = array_search( 'read_more', $arg['items'] ) ) !== false ) {
|
|
|
451 |
unset( $arg['items'][ $key ] );
|
452 |
}
|
453 |
|
454 |
+
if ( isset( $_REQUEST['ignore_sticky_posts'] ) ) {
|
455 |
+
$args['ignore_sticky_posts'] = isset( $_REQUEST['ignore_sticky_posts'] );
|
456 |
}
|
457 |
+
|
458 |
+
$filters = ! empty( $_REQUEST['tgp_filter'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['tgp_filter'] ) ) : [];
|
459 |
+
$action_term = ! empty( $_REQUEST['tgp_default_filter'] ) ? absint( $_REQUEST['tgp_default_filter'] ) : 0;
|
460 |
+
$hide_all_button = ! empty( $_REQUEST['tpg_hide_all_button'] ) ? true : false;
|
461 |
+
|
462 |
if ( $taxHierarchical ) {
|
463 |
$terms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, 0 );
|
464 |
} else {
|
465 |
$terms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true );
|
466 |
}
|
467 |
+
|
468 |
if ( $hide_all_button && ! $action_term ) {
|
469 |
if ( ! empty( $terms ) ) {
|
470 |
$allKeys = array_keys( $terms );
|
482 |
];
|
483 |
}
|
484 |
|
485 |
+
if ( $limit != - 1 && $pagination ) {
|
486 |
+
$tempArgs = $args;
|
487 |
+
$tempArgs['posts_per_page'] = $limit;
|
488 |
+
$tempArgs['paged'] = 1;
|
489 |
+
$tempArgs['fields'] = 'ids';
|
490 |
+
$tempQ = new \WP_Query( $tempArgs );
|
491 |
+
|
492 |
+
if ( ! empty( $tempQ->posts ) ) {
|
493 |
+
$args['post__in'] = $tempQ->posts;
|
494 |
+
}
|
495 |
+
}
|
496 |
+
|
497 |
if ( $pagination && $queryOffset && isset( $args['paged'] ) ) {
|
498 |
$queryOffset = ( $posts_per_page * ( $args['paged'] - 1 ) ) + $queryOffset;
|
499 |
}
|
500 |
+
|
501 |
if ( $queryOffset ) {
|
502 |
$args['offset'] = $queryOffset;
|
503 |
}
|
504 |
|
505 |
+
$arg['title_tag'] = ( ! empty( $_REQUEST['title_tag'] ) && in_array( $_REQUEST['title_tag'], array_keys( Options::getTitleTags() ) ) ) ? sanitize_text_field( wp_unslash( $_REQUEST['title_tag'] ) ) : 'h3';
|
|
|
506 |
|
507 |
$gridQuery = new \WP_Query( $args );
|
508 |
+
|
509 |
+
$styleMeta = [
|
510 |
+
'primary_color' => isset( $_REQUEST['primary_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['primary_color'] ) ) : null,
|
511 |
+
'button_bg_color' => isset( $_REQUEST['button_bg_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['button_bg_color'] ) ) : null,
|
512 |
+
'button_active_bg_color' => isset( $_REQUEST['button_active_bg_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['button_active_bg_color'] ) ) : null,
|
513 |
+
'button_hover_bg_color' => isset( $_REQUEST['button_hover_bg_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['button_hover_bg_color'] ) ) : null,
|
514 |
+
'button_text_color' => isset( $_REQUEST['button_text_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['button_text_color'] ) ) : null,
|
515 |
+
'button_text_bg_color' => isset( $_REQUEST['button_text_bg_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['button_text_bg_color'] ) ) : null,
|
516 |
+
'button_border_color' => isset( $_REQUEST['button_border_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['button_border_color'] ) ) : null,
|
517 |
+
'button_hover_text_color' => isset( $_REQUEST['button_hover_text_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['button_hover_text_color'] ) ) : null,
|
518 |
+
'overlay_color' => isset( $_REQUEST['overlay_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['overlay_color'] ) ) : null,
|
519 |
+
'overlay_opacity' => isset( $_REQUEST['overlay_opacity'] ) ? absint( $_REQUEST['overlay_opacity'] ) : null,
|
520 |
+
'overlay_padding' => isset( $_REQUEST['overlay_padding'] ) ? absint( $_REQUEST['overlay_padding'] ) : null,
|
521 |
+
'tgp_gutter' => isset( $_REQUEST['tgp_gutter'] ) ? absint( $_REQUEST['tgp_gutter'] ) : null,
|
522 |
+
'tpg_read_more_button_border_radius' => isset( $_REQUEST['tpg_read_more_button_border_radius'] ) ? absint( $_REQUEST['tpg_read_more_button_border_radius'] ) : null,
|
523 |
+
'tpg_full_area_bg' => isset( $_REQUEST['tpg_full_area_bg'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_full_area_bg'] ) ) : null,
|
524 |
+
'tpg_full_area_margin' => isset( $_REQUEST['tpg_full_area_margin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_full_area_margin'] ) ) : null,
|
525 |
+
'tpg_full_area_padding' => isset( $_REQUEST['tpg_full_area_margin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_full_area_margin'] ) ) : null,
|
526 |
+
'tpg_content_wrap_bg' => isset( $_REQUEST['tpg_content_wrap_bg'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_content_wrap_bg'] ) ) : null,
|
527 |
+
'tpg_content_wrap_border' => isset( $_REQUEST['tpg_content_wrap_border'] ) ? absint( $_REQUEST['tpg_content_wrap_border'] ) : null,
|
528 |
+
'tpg_content_wrap_border_color' => isset( $_REQUEST['tpg_content_wrap_border_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_content_wrap_border_color'] ) ) : null,
|
529 |
+
'tpg_content_wrap_border_radius' => isset( $_REQUEST['tpg_content_wrap_border_radius'] ) ? absint( $_REQUEST['tpg_content_wrap_border_radius'] ) : null,
|
530 |
+
'tpg_content_wrap_shadow' => isset( $_REQUEST['tpg_content_wrap_shadow'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_content_wrap_shadow'] ) ) : null,
|
531 |
+
'tpg_box_padding' => isset( $_REQUEST['tpg_box_padding'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_box_padding'] ) ) : null,
|
532 |
+
'tpg_content_padding' => isset( $_REQUEST['tpg_content_padding'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_content_padding'] ) ) : null,
|
533 |
+
'tpg_heading_bg' => isset( $_REQUEST['tpg_heading_bg'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_heading_bg'] ) ) : null,
|
534 |
+
'tpg_heading_color' => isset( $_REQUEST['tpg_heading_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_heading_color'] ) ) : null,
|
535 |
+
'tpg_heading_border_color' => isset( $_REQUEST['tpg_heading_border_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_heading_border_color'] ) ) : null,
|
536 |
+
'tpg_heading_border_size' => isset( $_REQUEST['tpg_heading_border_size'] ) ? absint( $_REQUEST['tpg_heading_border_size'] ) : null,
|
537 |
+
'tpg_heading_margin' => isset( $_REQUEST['tpg_heading_margin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_heading_margin'] ) ) : null,
|
538 |
+
'tpg_heading_padding' => isset( $_REQUEST['tpg_heading_padding'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_heading_padding'] ) ) : null,
|
539 |
+
'tpg_category_bg' => isset( $_REQUEST['tpg_category_bg'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_category_bg'] ) ) : null,
|
540 |
+
'tpg_category_color' => isset( $_REQUEST['tpg_category_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['tpg_category_color'] ) ) : null,
|
541 |
+
'tpg_category_border_radius' => isset( $_REQUEST['tpg_category_border_radius'] ) ? absint( $_REQUEST['tpg_category_border_radius'] ) : null,
|
542 |
+
'tpg_category_margin' => isset( $_REQUEST['tpg_category_margin'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_category_margin'] ) ) : null,
|
543 |
+
'tpg_category_padding' => isset( $_REQUEST['tpg_category_padding'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_category_padding'] ) ) : null,
|
544 |
+
'rt_tpg_category_font_size' => isset( $_REQUEST['rt_tpg_category_font_size'] ) ? absint( $_REQUEST['rt_tpg_category_font_size'] ) : null,
|
545 |
+
'tpg_image_border_radius' => isset( $_REQUEST['tpg_image_border_radius'] ) ? absint( $_REQUEST['tpg_image_border_radius'] ) : null,
|
546 |
+
'title_color' => isset( $_REQUEST['title_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['title_color'] ) ) : null,
|
547 |
+
'title_size' => isset( $_REQUEST['title_size'] ) ? absint( $_REQUEST['title_size'] ) : null,
|
548 |
+
'title_weight' => isset( $_REQUEST['title_weight'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['title_weight'] ) ) : null,
|
549 |
+
'title_alignment' => isset( $_REQUEST['title_alignment'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['title_alignment'] ) ) : null,
|
550 |
+
'title_hover_color' => isset( $_REQUEST['title_hover_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['title_hover_color'] ) ) : null,
|
551 |
+
'excerpt_color' => isset( $_REQUEST['excerpt_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['excerpt_color'] ) ) : null,
|
552 |
+
'excerpt_size' => isset( $_REQUEST['excerpt_size'] ) ? absint( $_REQUEST['excerpt_size'] ) : null,
|
553 |
+
'excerpt_weight' => isset( $_REQUEST['excerpt_weight'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['excerpt_weight'] ) ) : null,
|
554 |
+
'excerpt_alignment' => isset( $_REQUEST['excerpt_alignment'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['excerpt_alignment'] ) ) : null,
|
555 |
+
'meta_data_color' => isset( $_REQUEST['meta_data_color'] ) ? sanitize_hex_color( wp_unslash( $_REQUEST['meta_data_color'] ) ) : null,
|
556 |
+
'meta_data_size' => isset( $_REQUEST['meta_data_size'] ) ? absint( $_REQUEST['meta_data_size'] ) : null,
|
557 |
+
'meta_data_weight' => isset( $_REQUEST['meta_data_weight'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['meta_data_weight'] ) ) : null,
|
558 |
+
'meta_data_alignment' => isset( $_REQUEST['meta_data_alignment'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['meta_data_alignment'] ) ) : null,
|
559 |
+
];
|
560 |
+
|
561 |
+
$data .= Fns::layoutStyle( $layoutID, $styleMeta, $layout );
|
562 |
+
$containerDataAttr .= '';
|
563 |
$data .= "<div class='rt-container-fluid rt-tpg-container tpg-shortcode-main-wrapper {$parentClass}' id='{$layoutID}' {$dataArchive} {$containerDataAttr}>";
|
564 |
+
// widget heading.
|
565 |
+
$heading_tag = isset( $_REQUEST['tpg_heading_tag'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_heading_tag'] ) ) : 'h2';
|
566 |
+
$heading_style = isset( $_REQUEST['tpg_heading_style'] ) && ! empty( $_REQUEST['tpg_heading_style'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_heading_style'] ) ) : 'style1';
|
567 |
+
$heading_alignment = isset( $_REQUEST['tpg_heading_alignment'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_heading_alignment'] ) ) : '';
|
568 |
+
$heading_link = isset( $_REQUEST['tpg_heading_link'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_heading_link'] ) ) : '';
|
569 |
|
570 |
if ( ! empty( $arg['items'] ) && in_array( 'heading', $arg['items'] ) ) {
|
571 |
$data .= sprintf( '<div class="tpg-widget-heading-wrapper heading-%1$s %2$s">', $heading_style, $heading_alignment );
|
572 |
$data .= '<span class="tpg-widget-heading-line line-left"></span>';
|
573 |
+
|
574 |
if ( $heading_link ) {
|
575 |
$data .= sprintf( '<%1$s class="tpg-widget-heading"><a href="%2$s" title="%3$s">%3$s</a></%1$s>', $heading_tag, $heading_link, get_the_title( $scID ) );
|
576 |
} else {
|
577 |
$data .= sprintf( '<%1$s class="tpg-widget-heading">%2$s</%1$s>', $heading_tag, get_the_title( $scID ) );
|
578 |
}
|
579 |
+
|
580 |
$data .= '<span class="tpg-widget-heading-line"></span>';
|
581 |
$data .= '</div>';
|
582 |
}
|
583 |
|
584 |
+
$filters = ! empty( $_REQUEST['tgp_filter'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['tgp_filter'] ) ) : [];
|
585 |
+
|
586 |
if ( ! empty( $filters ) && ( $isGrid || $isOffset || $isWooCom ) ) {
|
587 |
+
$data .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
|
588 |
+
$allText = apply_filters( 'tpg_filter_all_text', esc_html__( 'All', 'the-post-grid' ), $_REQUEST );
|
589 |
$selectedSubTermsForButton = null;
|
590 |
+
|
591 |
if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter ) {
|
592 |
+
$filterType = ( ! empty( $_REQUEST['tgp_filter_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tgp_filter_type'] ) ) : null );
|
593 |
+
$post_count = ( ! empty( $_REQUEST['tpg_post_count'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_post_count'] ) ) : null );
|
594 |
+
$postCountClass = ( $post_count ? ' has-post-count' : null );
|
595 |
|
596 |
+
$allSelect = ' selected';
|
597 |
$isTermSelected = false;
|
598 |
+
|
599 |
if ( $action_term && $taxFilter ) {
|
600 |
$isTermSelected = true;
|
601 |
$allSelect = null;
|
602 |
}
|
603 |
+
|
604 |
+
if ( ! $filterType || 'dropdown' === $filterType ) {
|
605 |
+
$data .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
606 |
$termDefaultText = $allText;
|
607 |
$dataTerm = 'all';
|
608 |
+
$htmlButton = '';
|
609 |
$selectedSubTerms = null;
|
610 |
$pCount = 0;
|
611 |
+
|
612 |
if ( ! empty( $terms ) ) {
|
613 |
$i = 0;
|
614 |
+
|
615 |
foreach ( $terms as $id => $term ) {
|
616 |
$pCount = $pCount + $term['count'];
|
617 |
$sT = null;
|
618 |
+
|
619 |
if ( $taxHierarchical ) {
|
620 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
621 |
+
|
622 |
if ( ! empty( $subTerms ) ) {
|
623 |
$count = 0;
|
624 |
$item = $allCount = null;
|
625 |
+
|
626 |
foreach ( $subTerms as $stId => $t ) {
|
627 |
$count = $count + absint( $t['count'] );
|
628 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
629 |
+
$item .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$stId}'><span class='rt-text'>{$t['name']}{$sTPostCount}</span></span>";
|
630 |
}
|
631 |
+
|
632 |
if ( $post_count ) {
|
633 |
$allCount = " (<span class='rt-post-count'>{$count}</span>)";
|
634 |
}
|
635 |
+
|
636 |
$sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
|
637 |
$sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
|
638 |
+
<span class='rt-text'>" . $allText . "{$allCount}</span>
|
639 |
+
<i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
|
640 |
+
</span>";
|
641 |
$sT .= '<span class="term-dropdown rt-filter-dropdown">';
|
642 |
$sT .= $item;
|
643 |
$sT .= '</span>';
|
644 |
+
$sT .= '</div>';
|
645 |
}
|
646 |
+
|
647 |
if ( $action_term === $id ) {
|
648 |
$selectedSubTerms = $sT;
|
649 |
}
|
650 |
}
|
651 |
+
|
652 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
653 |
+
|
654 |
if ( $action_term && $action_term == $id ) {
|
655 |
$termDefaultText = $term['name'] . $postCount;
|
656 |
$dataTerm = $id;
|
657 |
}
|
658 |
+
|
659 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
660 |
+
if ( 'NOT IN' === $taxFilterOperator ) {
|
661 |
if ( ! in_array( $id, $taxFilterTerms ) && $action_term != $id ) {
|
662 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
663 |
}
|
669 |
} else {
|
670 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
671 |
}
|
672 |
+
|
673 |
$i ++;
|
674 |
}
|
675 |
}
|
676 |
+
|
677 |
$pAllCount = null;
|
678 |
+
|
679 |
if ( $post_count ) {
|
680 |
$pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
|
681 |
if ( ! $action_term ) {
|
682 |
$termDefaultText = $termDefaultText . $pAllCount;
|
683 |
}
|
684 |
}
|
685 |
+
|
686 |
if ( ! $hide_all_button ) {
|
687 |
+
$htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText . "{$pAllCount}</span></span>" . $htmlButton;
|
|
|
688 |
}
|
|
|
689 |
|
690 |
+
$htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
|
691 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
|
692 |
+
<span class="rt-text">' . $termDefaultText . '</span>
|
693 |
+
<i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
|
694 |
+
</span>';
|
695 |
|
696 |
$data .= $showAllhtml . $htmlButton;
|
697 |
$data .= '</div>' . $selectedSubTerms;
|
698 |
} else {
|
699 |
$bCount = 0;
|
700 |
$bItems = null;
|
701 |
+
|
702 |
if ( ! empty( $terms ) ) {
|
703 |
foreach ( $terms as $id => $term ) {
|
704 |
$bCount = $bCount + absint( $term['count'] );
|
705 |
$sT = null;
|
706 |
+
|
707 |
if ( $taxHierarchical ) {
|
708 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
709 |
+
|
710 |
if ( ! empty( $subTerms ) ) {
|
711 |
$sT .= "<div class='rt-filter-sub-tax sub-button-group'>";
|
712 |
+
|
713 |
foreach ( $subTerms as $stId => $t ) {
|
714 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
715 |
+
$sT .= "<span class='rt-filter-button-item' data-term='{$stId}'>{$t['name']}{$sTPostCount}</span>";
|
716 |
}
|
717 |
+
|
718 |
+
$sT .= '</div>';
|
719 |
+
|
720 |
if ( $action_term === $id ) {
|
721 |
$selectedSubTermsForButton = $sT;
|
722 |
}
|
723 |
}
|
724 |
}
|
725 |
+
|
726 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
727 |
$termSelected = null;
|
728 |
+
|
729 |
if ( $isTermSelected && $id == $action_term ) {
|
730 |
+
$termSelected = ' selected';
|
731 |
}
|
732 |
+
|
733 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
734 |
+
if ( 'NOT IN' === $taxFilterOperator ) {
|
735 |
if ( ! in_array( $id, $taxFilterTerms ) ) {
|
736 |
$bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
|
737 |
}
|
745 |
}
|
746 |
}
|
747 |
}
|
748 |
+
|
749 |
$data .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
750 |
+
|
751 |
if ( ! $hide_all_button ) {
|
752 |
$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
753 |
+
$data .= "<span class='term-button-item rt-filter-button-item {$allSelect}' data-term='all'>" . $allText . "{$pCountH}</span>";
|
754 |
}
|
755 |
+
|
756 |
$data .= $bItems;
|
757 |
+
$data .= '</div>';
|
758 |
}
|
759 |
}
|
760 |
|
761 |
+
// Author filter.
|
762 |
if ( in_array( '_author_filter', $filters ) ) {
|
763 |
+
$filterType = ( ! empty( $_REQUEST['tgp_filter_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tgp_filter_type'] ) ) : null );
|
764 |
+
$post_count = ( ! empty( $_REQUEST['tpg_post_count'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_post_count'] ) ) : null );
|
765 |
+
$postCountClass = ( $post_count ? ' has-post-count' : null );
|
766 |
+
$users = get_users( apply_filters( 'tpg_author_arg', [] ) );
|
767 |
+
$allSelect = ' selected';
|
|
|
|
|
768 |
$isTermSelected = false;
|
769 |
+
|
770 |
if ( $action_term && $taxFilter ) {
|
771 |
$isTermSelected = true;
|
772 |
$allSelect = null;
|
773 |
}
|
774 |
+
|
775 |
+
if ( ! $filterType || 'dropdown' === $filterType ) {
|
776 |
+
$data .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}'>";
|
777 |
$termDefaultText = $allText;
|
778 |
$dataAuthor = 'all';
|
779 |
+
$htmlButton = '';
|
780 |
+
$htmlButton .= '<span class="author-dropdown rt-filter-dropdown">';
|
781 |
+
|
782 |
if ( ! empty( $users ) ) {
|
783 |
foreach ( $users as $user ) {
|
784 |
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
804 |
if ( $isTermSelected ) {
|
805 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'>" . $allText . "{$pAllCount}</span>";
|
806 |
}
|
807 |
+
|
808 |
$htmlButton .= '</span>';
|
809 |
|
810 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
|
811 |
+
<span class="rt-text">' . $termDefaultText . '</span>
|
812 |
+
<i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
|
813 |
+
</span>';
|
814 |
|
815 |
$data .= $showAllhtml . $htmlButton;
|
816 |
$data .= '</div>';
|
817 |
} else {
|
818 |
$bCount = 0;
|
819 |
$bItems = null;
|
820 |
+
|
821 |
if ( ! empty( $users ) ) {
|
822 |
foreach ( $users as $user ) {
|
823 |
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
829 |
}
|
830 |
}
|
831 |
}
|
832 |
+
|
833 |
$data .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
834 |
+
|
835 |
if ( ! $hide_all_button ) {
|
836 |
$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
837 |
+
$data .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . "{$pCountH}</span>";
|
838 |
}
|
839 |
+
|
840 |
$data .= $bItems;
|
841 |
+
$data .= '</div>';
|
842 |
}
|
843 |
}
|
844 |
|
845 |
if ( in_array( '_search', $filters ) ) {
|
846 |
$data .= '<div class="rt-filter-item-wrap rt-search-filter-wrap">';
|
847 |
+
$data .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__( 'Search...', 'the-post-grid' ) );
|
848 |
$data .= "<span class='rt-action'>🔍</span>";
|
849 |
$data .= "<span class='rt-loading'></span>";
|
850 |
$data .= '</div>';
|
851 |
}
|
852 |
|
853 |
if ( in_array( '_order_by', $filters ) ) {
|
854 |
+
$wooFeature = ( 'product' === $postType ? true : false );
|
855 |
$orders = Options::rtPostOrderBy( $wooFeature );
|
856 |
+
$action_orderby = ( ! empty( $args['orderby'] ) ? trim( $args['orderby'] ) : 'none' );
|
857 |
+
|
858 |
+
if ( 'none' === $action_orderby ) {
|
859 |
+
$action_orderby_label = esc_html__( 'Sort By None', 'the-post-grid' );
|
860 |
} elseif ( in_array( $action_orderby, array_keys( Options::rtMetaKeyType() ) ) ) {
|
861 |
+
$action_orderby_label = esc_html__( 'Meta value', 'the-post-grid' );
|
862 |
} else {
|
863 |
$action_orderby_label = $orders[ $action_orderby ];
|
864 |
}
|
865 |
+
|
866 |
+
if ( 'none' !== $action_orderby ) {
|
867 |
+
$orders['none'] = esc_html__( 'Sort By None', 'the-post-grid' );
|
868 |
}
|
869 |
+
|
870 |
$data .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap">';
|
871 |
$data .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
|
872 |
+
<span class='rt-text-order-by'>{$action_orderby_label}</span>
|
873 |
+
<i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
|
874 |
+
</span>";
|
875 |
$data .= '<span class="order-by-dropdown rt-filter-dropdown">';
|
876 |
|
877 |
foreach ( $orders as $orderKey => $order ) {
|
878 |
$data .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
|
879 |
}
|
880 |
+
|
881 |
$data .= '</span>';
|
882 |
$data .= '</div>';
|
883 |
}
|
884 |
|
885 |
if ( in_array( '_sort_order', $filters ) ) {
|
886 |
+
$action_order = ( ! empty( $args['order'] ) ? strtoupper( trim( $args['order'] ) ) : 'DESC' );
|
887 |
+
$data .= '<div class="rt-filter-item-wrap rt-sort-order-action">';
|
888 |
+
$data .= "<span class='rt-sort-order-action-arrow' data-sort-order='{$action_order}'> <span></span></span>";
|
889 |
+
$data .= '</div>';
|
890 |
}
|
891 |
|
892 |
$data .= "</div>$selectedSubTermsForButton</div>";
|
893 |
}
|
894 |
|
895 |
+
$data .= "<div data-title='" . esc_html__( 'Loading ...', 'the-post-grid' ) . "' class='rt-row rt-content-loader {$layout} {$masonryG} {$preLoader}'>";
|
896 |
+
|
897 |
if ( $gridQuery->have_posts() ) {
|
898 |
if ( $isCarousel ) {
|
899 |
+
$cOpt = ! empty( $_REQUEST['carousel_property'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['carousel_property'] ) ) : [];
|
900 |
+
$slider_js_options = apply_filters(
|
901 |
+
'rttpg_slider_js_options',
|
902 |
[
|
903 |
+
'speed' => ! empty( $_REQUEST['tpg_carousel_speed'] ) ? absint( $_REQUEST['tpg_carousel_speed'] ) : 250,
|
904 |
+
'autoPlayTimeOut' => ! empty( $_REQUEST['tpg_carousel_autoplay_timeout'] ) ? absint( $_REQUEST['tpg_carousel_autoplay_timeout'] ) : 5000,
|
905 |
+
'autoPlay' => in_array( 'auto_play', $cOpt ) ? true : false,
|
906 |
+
'stopOnHover' => in_array( 'stop_hover', $cOpt ) ? true : false,
|
907 |
+
'nav' => in_array( 'nav_button', $cOpt ) ? true : false,
|
908 |
+
'dots' => in_array( 'pagination', $cOpt ) ? true : false,
|
909 |
+
'loop' => in_array( 'loop', $cOpt ) ? true : false,
|
910 |
+
'lazyLoad' => in_array( 'lazyLoad', $cOpt ) ? true : false,
|
911 |
+
'autoHeight' => in_array( 'auto_height', $cOpt ) ? true : false,
|
912 |
+
'rtl' => in_array( 'rtl', $cOpt ) ? true : false,
|
913 |
+
]
|
914 |
+
);
|
915 |
+
$data .= sprintf(
|
916 |
+
'<div class="rt-swiper-holder swiper" data-rtowl-options="%s"><div class="swiper-wrapper">',
|
917 |
+
htmlspecialchars( wp_json_encode( $slider_js_options ) )
|
918 |
+
);
|
919 |
}
|
920 |
+
|
921 |
$isotope_filter = null;
|
922 |
+
|
923 |
if ( $isIsotope ) {
|
924 |
+
$isotope_filter = isset( $_REQUEST['isotope_filter'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['isotope_filter'] ) ) : null;
|
925 |
+
$isotope_dropdown_filter = isset( $_REQUEST['isotope_filter_dropdown'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['isotope_filter_dropdown'] ) ) : null;
|
926 |
$selectedTerms = [];
|
927 |
+
|
928 |
+
if ( isset( $_REQUEST['post_filter'] ) && in_array( 'tpg_taxonomy', $_REQUEST['post_filter'] ) && isset( $_REQUEST['tpg_taxonomy'] ) && in_array( $isotope_filter, $_REQUEST['tpg_taxonomy'] ) ) {
|
929 |
+
$selectedTerms = ( isset( $_REQUEST[ 'term_' . $isotope_filter ] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST[ 'term_' . $isotope_filter ] ) ) : [] );
|
|
|
|
|
|
|
|
|
|
|
930 |
}
|
931 |
+
|
932 |
global $wp_version;
|
933 |
+
|
934 |
if ( version_compare( $wp_version, '4.5', '>=' ) ) {
|
935 |
+
$terms = get_terms(
|
936 |
+
$isotope_filter,
|
937 |
[
|
938 |
'meta_key' => '_rt_order',
|
939 |
'orderby' => 'meta_value_num',
|
940 |
'order' => 'ASC',
|
941 |
'hide_empty' => false,
|
942 |
'include' => $selectedTerms,
|
943 |
+
]
|
944 |
+
);
|
945 |
} else {
|
946 |
+
$terms = get_terms(
|
947 |
+
$isotope_filter,
|
948 |
[
|
949 |
'orderby' => 'name',
|
950 |
'order' => 'ASC',
|
951 |
'hide_empty' => false,
|
952 |
'include' => $selectedTerms,
|
953 |
+
]
|
954 |
+
);
|
955 |
}
|
956 |
+
|
957 |
+
$data .= '<div class="tpg-iso-filter">';
|
958 |
$htmlButton = $drop = null;
|
959 |
$fSelectTrigger = false;
|
960 |
+
|
961 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
|
962 |
foreach ( $terms as $term ) {
|
963 |
+
$tItem = ! empty( $_REQUEST['isotope_default_filter'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['isotope_default_filter'] ) ) : null;
|
964 |
$fSelected = null;
|
965 |
+
|
966 |
if ( $tItem == $term->term_id ) {
|
967 |
$fSelected = 'selected';
|
968 |
$fSelectTrigger = true;
|
969 |
}
|
970 |
+
|
971 |
+
$htmlButton .= sprintf(
|
972 |
+
'<button class="rt-iso-btn-%s%s" data-filter=".iso_%d">%s</button>',
|
973 |
esc_attr( $term->slug ),
|
974 |
+
$fSelected ? ' ' . $fSelected : '',
|
975 |
$term->term_id,
|
976 |
$term->name
|
977 |
);
|
978 |
$drop .= "<option value='.iso_{$term->term_id}' {$fSelected}>{$term->name}</option>";
|
979 |
}
|
980 |
}
|
981 |
+
|
982 |
+
if ( empty( $_REQUEST['isotope_filter_show_all'] ) ) {
|
983 |
$fSelect = ( $fSelectTrigger ? null : 'class="selected"' );
|
984 |
+
$htmlButton = "<button data-filter='*' {$fSelect}>" . $arg['show_all_text'] . '</button>' . $htmlButton;
|
985 |
$drop = "<option value='*' {$fSelect}>{$arg['show_all_text']}</option>" . $drop;
|
986 |
}
|
987 |
+
|
988 |
+
$filter_count = ! empty( $_REQUEST['isotope_filter_count'] );
|
989 |
+
$filter_url = ! empty( $_REQUEST['isotope_filter_url'] );
|
990 |
+
|
991 |
+
$htmlButton = "<div id='iso-button-{$rand}' class='rt-tpg-isotope-buttons button-group filter-button-group option-set' data-url='{$filter_url}' data-count='{$filter_count}'>{$htmlButton}</div>";
|
992 |
|
993 |
if ( $isotope_dropdown_filter ) {
|
994 |
$data .= "<select class='isotope-dropdown-filter'>{$drop}</select>";
|
995 |
} else {
|
996 |
$data .= $htmlButton;
|
997 |
}
|
998 |
+
|
999 |
+
if ( ! empty( $_REQUEST['isotope_search_filter'] ) ) {
|
1000 |
+
$data .= "<div class='iso-search'><input type='text' class='iso-search-input' placeholder='" . esc_html__( 'Search', 'the-post-grid' ) . "' /></div>";
|
1001 |
}
|
|
|
1002 |
|
1003 |
+
$data .= '</div>';
|
1004 |
$data .= "<div class='rt-tpg-isotope' id='iso-tpg-{$rand}'>";
|
1005 |
}
|
1006 |
|
1007 |
$l = $offLoop = 0;
|
1008 |
$offsetBigHtml = $offsetSmallHtml = null;
|
1009 |
$tgCol = 2;
|
1010 |
+
|
1011 |
+
if ( 'layout4' === $layout ) {
|
1012 |
$tgCol = round( 12 / $dCol );
|
1013 |
}
|
1014 |
+
|
1015 |
$gridPostCount = 0;
|
1016 |
$arg['totalPost'] = $gridQuery->post_count;
|
1017 |
|
1018 |
+
while ( $gridQuery->have_posts() ) :
|
1019 |
+
$gridQuery->the_post();
|
1020 |
+
|
1021 |
if ( $tgCol == $l ) {
|
1022 |
if ( $this->l4toggle ) {
|
1023 |
$this->l4toggle = false;
|
1026 |
}
|
1027 |
$l = 0;
|
1028 |
}
|
1029 |
+
|
1030 |
$arg['postCount'] = $gridPostCount ++;
|
1031 |
$pID = get_the_ID();
|
1032 |
$arg['pID'] = $pID;
|
1042 |
$arg['tags'] = get_the_term_list( $pID, 'post_tag', null, ', ' );
|
1043 |
$arg['post_count'] = get_post_meta( $pID, Fns::get_post_view_count_meta_key(), true );
|
1044 |
$arg['responsiveCol'] = [ $dCol, $tCol, $mCol ];
|
1045 |
+
|
1046 |
if ( $isIsotope ) {
|
1047 |
+
$termAs = wp_get_post_terms( $pID, $isotope_filter, [ 'fields' => 'all' ] );
|
1048 |
$isoFilter = [];
|
1049 |
+
|
1050 |
if ( ! empty( $termAs ) ) {
|
1051 |
foreach ( $termAs as $term ) {
|
1052 |
+
$isoFilter[] = 'iso_' . $term->term_id;
|
1053 |
+
$isoFilter[] = 'rt-item-' . esc_attr( $term->slug );
|
1054 |
}
|
1055 |
}
|
1056 |
+
|
1057 |
+
$arg['isoFilter'] = ! empty( $isoFilter ) ? implode( ' ', $isoFilter ) : '';
|
1058 |
}
|
1059 |
+
|
1060 |
$deptClass = null;
|
1061 |
+
|
1062 |
if ( ! empty( $deptAs ) ) {
|
1063 |
foreach ( $deptAs as $dept ) {
|
1064 |
+
$deptClass .= ' ' . $dept->slug;
|
1065 |
}
|
1066 |
}
|
1067 |
+
|
1068 |
if ( comments_open() ) {
|
1069 |
$arg['comment'] = "<a href='" . get_comments_link( $pID ) . "'>{$comments_text} </a>";
|
1070 |
} else {
|
1071 |
$arg['comment'] = "{$comments_text}";
|
1072 |
}
|
1073 |
+
|
1074 |
$imgSrc = null;
|
1075 |
+
$arg['smallImgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
1076 |
+
$pID,
|
1077 |
$fSmallImgSize,
|
1078 |
$mediaSource,
|
1079 |
$defaultImgId,
|
1080 |
+
$customSmallImgSize
|
1081 |
+
) : null;
|
1082 |
+
|
1083 |
if ( $isOffset ) {
|
1084 |
+
if ( 0 === $offLoop ) {
|
1085 |
+
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
1086 |
+
$pID,
|
1087 |
$fImgSize,
|
1088 |
$mediaSource,
|
1089 |
$defaultImgId,
|
1090 |
+
$customImgSize
|
1091 |
+
) : null;
|
1092 |
$arg['offset'] = 'big';
|
1093 |
$offsetBigHtml = Fns::get_template_html( 'layouts/' . $layout, $arg );
|
1094 |
} else {
|
1095 |
$arg['offset'] = 'small';
|
1096 |
$arg['offsetCol'] = [ $dCol, $tCol, $mCol ];
|
1097 |
+
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
1098 |
+
$pID,
|
1099 |
'thumbnail',
|
1100 |
$mediaSource,
|
1101 |
$defaultImgId,
|
1102 |
+
$customImgSize
|
1103 |
+
) : null;
|
1104 |
+
$offsetSmallHtml .= Fns::get_template_html( 'layouts/' . $layout, $arg );
|
1105 |
}
|
1106 |
} else {
|
1107 |
+
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
1108 |
+
$pID,
|
1109 |
$fImgSize,
|
1110 |
$mediaSource,
|
1111 |
$defaultImgId,
|
1112 |
+
$customImgSize
|
1113 |
+
) : null;
|
1114 |
+
$data .= Fns::get_template_html( 'layouts/' . $layout, $arg );
|
1115 |
}
|
1116 |
$offLoop ++;
|
1117 |
$l ++;
|
1118 |
endwhile;
|
1119 |
+
|
1120 |
if ( $isOffset ) {
|
1121 |
$oDCol = Fns::get_offset_col( $dCol );
|
1122 |
$oTCol = Fns::get_offset_col( $tCol );
|
1123 |
$oMCol = Fns::get_offset_col( $mCol );
|
1124 |
+
|
1125 |
+
if ( 'offset03' === $layout || 'offset04' === $layout ) {
|
1126 |
$oDCol['big'] = $oTCol['big'] = $oDCol['small'] = $oTCol['small'] = 6;
|
1127 |
$oMCol['big'] = $oMCol['small'] = 12;
|
1128 |
+
} elseif ( 'offset06' === $layout ) {
|
1129 |
$oDCol['big'] = 7;
|
1130 |
$oDCol['small'] = 5;
|
1131 |
}
|
1132 |
+
|
1133 |
$data .= "<div class='rt-col-md-{$oDCol['big']} rt-col-sm-{$oTCol['big']} rt-col-xs-{$oMCol['big']}'><div class='rt-row'>{$offsetBigHtml}</div></div>";
|
1134 |
$data .= "<div class='rt-col-md-{$oDCol['small']} rt-col-sm-{$oTCol['small']} rt-col-xs-{$oMCol['small']}'><div class='rt-row offset-small-wrap'>{$offsetSmallHtml}</div></div>";
|
1135 |
}
|
1136 |
+
|
1137 |
if ( $isIsotope || $isCarousel ) {
|
1138 |
+
$data .= '</div>'; // End isotope / Carousel item holder.
|
1139 |
+
|
1140 |
if ( $isCarousel ) {
|
1141 |
if ( in_array( 'pagination', $cOpt ) ) {
|
1142 |
$data .= '<div class="swiper-pagination"></div>';
|
1143 |
}
|
1144 |
+
|
1145 |
$data .= '</div>';
|
1146 |
+
|
1147 |
if ( in_array( 'nav_button', $cOpt ) ) {
|
1148 |
$data .= '<div class="swiper-navigation"><div class="slider-btn swiper-button-prev"></div><div class="slider-btn swiper-button-next"></div></div>';
|
1149 |
}
|
1150 |
}
|
1151 |
}
|
1152 |
} else {
|
1153 |
+
$not_found_text = isset( $_REQUEST['tgp_not_found_text'] ) && ! empty( $_REQUEST['tgp_not_found_text'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tgp_not_found_text'] ) ) : esc_html__( 'No post found', 'the-post-grid' );
|
1154 |
+
$data .= '<p>' . $not_found_text . '</p>';
|
|
|
1155 |
}
|
1156 |
+
|
1157 |
+
$data .= $preLoaderHtml;
|
1158 |
+
$data .= '</div>'; // End row.
|
1159 |
$htmlUtility = null;
|
1160 |
+
|
1161 |
if ( $pagination && ! $isCarousel ) {
|
1162 |
if ( $isOffset || $isGridHover ) {
|
1163 |
+
$posts_loading_type = 'page_prev_next';
|
1164 |
+
|
1165 |
+
$htmlUtility .= "<div class='rt-cb-page-prev-next'>
|
1166 |
+
<span class='rt-cb-prev-btn'><i class='fa fa-angle-left' aria-hidden='true'></i></span>
|
1167 |
+
<span class='rt-cb-next-btn'><i class='fa fa-angle-right' aria-hidden='true'></i></span>
|
1168 |
+
</div>";
|
1169 |
} else {
|
1170 |
+
if ( 'pagination' === $posts_loading_type ) {
|
1171 |
if ( $isGrid && empty( $filters ) ) {
|
1172 |
$htmlUtility .= Fns::rt_pagination( $gridQuery, $args['posts_per_page'] );
|
1173 |
}
|
1174 |
+
} elseif ( 'pagination_ajax' === $posts_loading_type && ! $isIsotope ) {
|
1175 |
if ( $isGrid ) {
|
1176 |
$htmlUtility .= "<div class='rt-page-numbers'></div>";
|
1177 |
} else {
|
1178 |
$htmlUtility .= Fns::rt_pagination( $gridQuery, $args['posts_per_page'], true );
|
1179 |
}
|
1180 |
+
} elseif ( 'load_more' === $posts_loading_type ) {
|
1181 |
+
$load_more_btn_text = ( ! empty( $_REQUEST['load_more_text'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['load_more_text'] ) ) : '' );
|
1182 |
+
$load_more_text = $load_more_btn_text ? $load_more_btn_text : esc_html__( 'Load More', 'the-post-grid' );
|
|
|
1183 |
|
1184 |
if ( $isGrid ) {
|
1185 |
$htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style'>
|
1186 |
+
<span class='rt-loadmore-text'>" . esc_html( $load_more_text ) . "</span>
|
1187 |
+
<div class='rt-loadmore-loading rt-ball-scale-multiple rt-2x'><div></div><div></div><div></div></div>
|
1188 |
+
</div>";
|
1189 |
} else {
|
1190 |
$htmlUtility .= "<div class='rt-tpg-load-more'>
|
1191 |
+
<button data-sc-id='' data-paged='2'>" . esc_html( $load_more_text ) . '</button>
|
1192 |
+
</div>';
|
1193 |
}
|
1194 |
+
} elseif ( 'load_on_scroll' === $posts_loading_type ) {
|
1195 |
if ( $isGrid ) {
|
1196 |
+
$htmlUtility .= "<div class='rt-infinite-action'>
|
1197 |
+
<div class='rt-infinite-loading la-fire la-2x'>
|
1198 |
+
<div></div>
|
1199 |
+
<div></div>
|
1200 |
+
<div></div>
|
1201 |
+
</div>
|
1202 |
+
</div>";
|
1203 |
} else {
|
1204 |
+
$htmlUtility .= '<div class="rt-tpg-scroll-load-more" data-trigger="1" data-sc-id="' . absint( $scID ) . '" data-paged="2"></div>';
|
1205 |
}
|
1206 |
}
|
1207 |
}
|
1209 |
|
1210 |
if ( $htmlUtility ) {
|
1211 |
$l4toggle = null;
|
1212 |
+
|
1213 |
+
if ( 'layout4' === $layout ) {
|
1214 |
+
$l4toggle = 'data-l4toggle="' . $this->l4toggle . '"';
|
1215 |
}
|
1216 |
+
|
1217 |
if ( $isGrid || $isOffset || $isWooCom ) {
|
1218 |
+
$data .= '<div class="rt-pagination-wrap" data-total-pages="' . absint( $gridQuery->max_num_pages ) . '" data-posts-per-page="' . absint( $args['posts_per_page'] ) . '" data-type="' . esc_attr( $posts_loading_type ) . '" ' . $l4toggle . ' >' . $htmlUtility . '</div>';
|
|
|
1219 |
} else {
|
1220 |
+
$data .= '<div class="rt-tpg-utility" ' . $l4toggle . '>' . $htmlUtility . '</div>';
|
1221 |
}
|
1222 |
}
|
1223 |
|
1224 |
+
$data .= '</div>'; // container rt-tpg.
|
|
|
1225 |
|
1226 |
} else {
|
1227 |
+
$msg = esc_html__( 'Session Error !!', 'the-post-grid' );
|
1228 |
}
|
1229 |
|
1230 |
+
wp_send_json(
|
1231 |
+
[
|
1232 |
+
'error' => $error,
|
1233 |
+
'msg' => $msg,
|
1234 |
+
'data' => $data,
|
1235 |
+
]
|
1236 |
+
);
|
1237 |
die();
|
1238 |
}
|
1239 |
|
1240 |
+
}
|
app/Controllers/Admin/MetaController.php
CHANGED
@@ -1,23 +1,42 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
namespace RT\ThePostGrid\Controllers\Admin;
|
5 |
|
6 |
-
|
7 |
use RT\ThePostGrid\Helpers\Fns;
|
8 |
use RT\ThePostGrid\Helpers\Options;
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
class MetaController {
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
add_action( '
|
16 |
-
add_action( '
|
17 |
-
|
18 |
-
add_action( '
|
|
|
|
|
19 |
}
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
public function manage_rttpg_columns( $column ) {
|
22 |
switch ( $column ) {
|
23 |
case 'shortcode':
|
@@ -28,26 +47,36 @@ class MetaController {
|
|
28 |
}
|
29 |
}
|
30 |
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
return array_slice( $columns, 0, 2, true ) + $shortcode + array_slice( $columns, 1, null, true );
|
35 |
}
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
global $pagenow, $typenow;
|
40 |
|
41 |
-
if (
|
42 |
wp_enqueue_style( 'rt-tpg-admin' );
|
43 |
}
|
44 |
|
45 |
-
|
46 |
-
if ( ! in_array( $pagenow, array( 'post.php', 'post-new.php' ) ) ) {
|
47 |
return;
|
48 |
}
|
49 |
|
50 |
-
if (
|
51 |
return;
|
52 |
}
|
53 |
|
@@ -63,183 +92,240 @@ class MetaController {
|
|
63 |
$select2Id = 'select2-avada-js';
|
64 |
}
|
65 |
|
66 |
-
// scripts
|
67 |
-
wp_enqueue_script(
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
wp_enqueue_style( array(
|
80 |
-
'wp-color-picker',
|
81 |
-
'rt-select2',
|
82 |
-
'rt-fontawsome',
|
83 |
-
'rt-tpg-admin',
|
84 |
-
'rt-tpg-admin-preview',
|
85 |
-
) );
|
86 |
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
'
|
91 |
-
'
|
92 |
-
|
|
|
|
|
|
|
|
|
93 |
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
|
96 |
-
|
97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
add_meta_box(
|
99 |
'rttpg_meta',
|
100 |
-
|
101 |
-
|
102 |
rtTPG()->post_type,
|
103 |
'normal',
|
104 |
-
'high'
|
|
|
105 |
|
106 |
add_meta_box(
|
107 |
rtTPG()->post_type . '_sc_preview_meta',
|
108 |
-
|
109 |
-
|
110 |
rtTPG()->post_type,
|
111 |
'normal',
|
112 |
-
'high'
|
|
|
113 |
|
114 |
add_meta_box(
|
115 |
'rt_plugin_sc_pro_information',
|
116 |
-
|
117 |
-
|
118 |
rtTPG()->post_type,
|
119 |
'side',
|
120 |
'low'
|
121 |
);
|
122 |
-
|
123 |
}
|
124 |
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
$html = '';
|
127 |
-
|
|
|
128 |
$html .= '<div class="rt-document-box rt-update-pro-btn-wrap">
|
129 |
-
|
130 |
-
|
131 |
} else {
|
132 |
if ( ! rtTPG()->hasPro() ) {
|
133 |
-
$html .= sprintf(
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
}
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
|
|
146 |
);
|
147 |
|
|
|
|
|
|
|
|
|
148 |
$html .= '<div class="rt-document-box">
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
}
|
160 |
|
161 |
/**
|
162 |
-
*
|
|
|
|
|
163 |
*/
|
164 |
-
function tpg_sc_preview_selection() {
|
165 |
-
$html
|
166 |
$html .= "<div class='rt-response'></div>";
|
167 |
$html .= "<div id='tpg-preview-container'></div>";
|
168 |
-
echo $html;
|
169 |
|
|
|
170 |
}
|
171 |
|
172 |
-
|
173 |
-
|
174 |
-
|
|
|
|
|
|
|
|
|
175 |
if ( rtTPG()->post_type !== $post->post_type ) {
|
176 |
return;
|
177 |
}
|
178 |
-
|
|
|
179 |
$html .= '<div class="postbox rt-after-title" style="margin-bottom: 0;"><div class="inside">';
|
180 |
-
$html .= '<p
|
181 |
-
|
182 |
-
|
|
|
183 |
$html .= '</div></div>';
|
184 |
|
185 |
-
|
186 |
}
|
187 |
|
188 |
-
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
190 |
$last_tab = trim( get_post_meta( $post->ID, '_tpg_last_active_tab', true ) );
|
191 |
$last_tab = $last_tab ? $last_tab : 'sc-post-post-source';
|
192 |
-
$post =
|
193 |
-
'post' => $post
|
194 |
-
|
|
|
195 |
wp_nonce_field( rtTPG()->nonceText(), rtTPG()->nonceId() );
|
196 |
-
|
|
|
197 |
$html .= '<div id="sc-tabs" class="rttpg-wrapper rt-tab-container rt-setting-holder">';
|
198 |
-
$html .= sprintf(
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
|
|
215 |
);
|
216 |
|
217 |
-
|
|
|
218 |
$html .= Fns::view( 'settings.post-source', $post, true );
|
219 |
$html .= '</div>';
|
220 |
|
221 |
-
|
|
|
222 |
$html .= Fns::view( 'settings.layout-settings', $post, true );
|
223 |
$html .= '</div>';
|
224 |
|
225 |
-
|
|
|
226 |
$html .= Fns::view( 'settings.sc-settings', $post, true );
|
227 |
$html .= '</div>';
|
228 |
|
229 |
-
|
|
|
230 |
$html .= Fns::view( 'settings.item-fields', $post, true );
|
231 |
$html .= '</div>';
|
232 |
|
233 |
-
|
|
|
234 |
$html .= Fns::view( 'settings.style', $post, true );
|
235 |
$html .= '</div>';
|
236 |
$html .= sprintf( '<input type="hidden" id="_tpg_last_active_tab" name="_tpg_last_active_tab" value="%s"/>', $last_tab );
|
237 |
$html .= '</div>';
|
238 |
-
echo $html;
|
239 |
-
}
|
240 |
|
241 |
-
|
|
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
244 |
return $post_id;
|
245 |
}
|
@@ -248,14 +334,16 @@ class MetaController {
|
|
248 |
return $post_id;
|
249 |
}
|
250 |
|
251 |
-
if ( rtTPG()->post_type
|
252 |
return $post_id;
|
253 |
}
|
254 |
|
255 |
$mates = Fns::rtAllOptionFields();
|
|
|
256 |
foreach ( $mates as $metaKey => $field ) {
|
257 |
$rValue = ! empty( $_REQUEST[ $metaKey ] ) ? $_REQUEST[ $metaKey ] : null;
|
258 |
$value = Fns::sanitize( $field, $rValue );
|
|
|
259 |
if ( empty( $field['multiple'] ) ) {
|
260 |
update_post_meta( $post_id, $metaKey, $value );
|
261 |
} else {
|
@@ -268,70 +356,87 @@ class MetaController {
|
|
268 |
}
|
269 |
}
|
270 |
|
271 |
-
$post_filter = ( isset( $_REQUEST['post_filter'] ) ? $_REQUEST['post_filter']
|
272 |
$advFilter = Options::rtTPAdvanceFilters();
|
|
|
273 |
foreach ( $advFilter['post_filter']['options'] as $filter => $fValue ) {
|
274 |
if ( $filter == 'tpg_taxonomy' ) {
|
275 |
delete_post_meta( $post_id, $filter );
|
|
|
276 |
if ( ! empty( $_REQUEST[ $filter ] ) && is_array( $_REQUEST[ $filter ] ) ) {
|
277 |
foreach ( $_REQUEST[ $filter ] as $tax ) {
|
278 |
if ( in_array( $filter, $post_filter ) ) {
|
279 |
add_post_meta( $post_id, $filter, trim( $tax ) );
|
280 |
}
|
|
|
281 |
delete_post_meta( $post_id, 'term_' . $tax );
|
282 |
-
|
|
|
|
|
283 |
if ( is_array( $tt ) && ! empty( $tt ) && in_array( $filter, $post_filter ) ) {
|
284 |
foreach ( $tt as $termID ) {
|
285 |
add_post_meta( $post_id, 'term_' . $tax, trim( $termID ) );
|
286 |
}
|
287 |
}
|
288 |
-
|
|
|
|
|
289 |
if ( $tto ) {
|
290 |
update_post_meta( $post_id, 'term_operator_' . $tax, trim( $tto ) );
|
291 |
}
|
292 |
}
|
293 |
-
|
294 |
-
$
|
|
|
|
|
295 |
if ( count( $filterCount ) > 1 && $tr ) {
|
296 |
update_post_meta( $post_id, 'taxonomy_relation', trim( $tr ) );
|
297 |
} else {
|
298 |
delete_post_meta( $post_id, 'taxonomy_relation' );
|
299 |
}
|
300 |
-
|
301 |
}
|
302 |
-
}
|
303 |
delete_post_meta( $post_id, 'author' );
|
304 |
-
|
|
|
|
|
305 |
if ( is_array( $authors ) && ! empty( $authors ) && in_array( 'author', $post_filter ) ) {
|
306 |
foreach ( $authors as $authorID ) {
|
307 |
add_post_meta( $post_id, 'author', trim( $authorID ) );
|
308 |
}
|
309 |
}
|
310 |
-
}
|
311 |
delete_post_meta( $post_id, $filter );
|
312 |
-
|
|
|
|
|
313 |
if ( is_array( $statuses ) && ! empty( $statuses ) && in_array( $filter, $post_filter ) ) {
|
314 |
foreach ( $statuses as $post_status ) {
|
315 |
add_post_meta( $post_id, $filter, trim( $post_status ) );
|
316 |
}
|
317 |
}
|
318 |
-
}
|
319 |
delete_post_meta( $post_id, 's' );
|
320 |
-
|
|
|
|
|
321 |
if ( $s && in_array( 's', $post_filter ) ) {
|
322 |
update_post_meta( $post_id, 's', sanitize_text_field( trim( $s ) ) );
|
323 |
}
|
324 |
-
}
|
325 |
if ( in_array( 'order', $post_filter ) ) {
|
326 |
-
$order
|
|
|
|
|
|
|
327 |
if ( $order && in_array( 'order', $post_filter ) ) {
|
328 |
update_post_meta( $post_id, 'order', sanitize_text_field( trim( $order ) ) );
|
329 |
}
|
330 |
-
|
331 |
if ( $order_by && in_array( 'order', $post_filter ) ) {
|
332 |
update_post_meta( $post_id, 'order_by', sanitize_text_field( trim( $order_by ) ) );
|
333 |
}
|
334 |
-
|
335 |
if ( in_array( $order_by, array_keys( Options::rtMetaKeyType() ) ) && $tpg_meta_key && in_array( 'order', $post_filter ) ) {
|
336 |
update_post_meta( $post_id, 'tpg_meta_key', sanitize_text_field( trim( $tpg_meta_key ) ) );
|
337 |
} else {
|
@@ -342,10 +447,11 @@ class MetaController {
|
|
342 |
delete_post_meta( $post_id, 'tpg_meta_key' );
|
343 |
delete_post_meta( $post_id, 'order_by' );
|
344 |
}
|
345 |
-
}
|
346 |
if ( in_array( 'date_range', $post_filter ) ) {
|
347 |
-
$start = ! empty( $_REQUEST[ $filter . '_start' ] ) ? $_REQUEST[ $filter . '_start' ] : null;
|
348 |
-
$end = ! empty( $_REQUEST[ $filter . '_end' ] ) ? $_REQUEST[ $filter . '_end' ] : null;
|
|
|
349 |
update_post_meta( $post_id, $filter . '_start', trim( $start ) );
|
350 |
update_post_meta( $post_id, $filter . '_end', trim( $end ) );
|
351 |
} else {
|
@@ -355,25 +461,24 @@ class MetaController {
|
|
355 |
}
|
356 |
}
|
357 |
|
358 |
-
// Extra css
|
359 |
-
|
360 |
$extraFields = Options::extraStyle();
|
361 |
-
$extraTypes =
|
362 |
|
363 |
foreach ( $extraFields as $key => $title ) {
|
364 |
foreach ( $extraTypes as $type ) {
|
365 |
$newKew = $key . "_{$type}";
|
366 |
if ( isset( $_REQUEST[ $newKew ] ) ) {
|
367 |
-
$value =
|
|
|
368 |
update_post_meta( $post_id, $newKew, $value );
|
369 |
}
|
370 |
}
|
371 |
}
|
372 |
|
373 |
-
|
374 |
-
|
375 |
-
update_post_meta( $post_id, '_tpg_last_active_tab', $_POST['_tpg_last_active_tab'] );
|
376 |
}
|
377 |
|
378 |
-
}
|
379 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Meta Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers\Admin;
|
9 |
|
|
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
use RT\ThePostGrid\Helpers\Options;
|
12 |
|
13 |
+
// Do not allow directly accessing this file.
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit( 'This script cannot be accessed directly.' );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Meta Controller class.
|
20 |
+
*/
|
21 |
class MetaController {
|
22 |
+
/**
|
23 |
+
* Class constructor
|
24 |
+
*/
|
25 |
+
public function __construct() {
|
26 |
+
add_action( 'admin_head', [ $this, 'admin_head' ] );
|
27 |
+
add_action( 'edit_form_after_title', [ $this, 'tpg_sc_after_title' ] );
|
28 |
+
add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ] );
|
29 |
+
add_action( 'save_post', [ $this, 'save_post' ], 10, 2 );
|
30 |
+
add_filter( 'manage_edit-rttpg_columns', [ $this, 'arrange_rttpg_columns' ] );
|
31 |
+
add_action( 'manage_rttpg_posts_custom_column', [ $this, 'manage_rttpg_columns' ], 10, 2 );
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* manage Column
|
36 |
+
*
|
37 |
+
* @param string $column Column.
|
38 |
+
* @return void
|
39 |
+
*/
|
40 |
public function manage_rttpg_columns( $column ) {
|
41 |
switch ( $column ) {
|
42 |
case 'shortcode':
|
47 |
}
|
48 |
}
|
49 |
|
50 |
+
/**
|
51 |
+
* Arrange Columns
|
52 |
+
*
|
53 |
+
* @param array $columns Columns.
|
54 |
+
* @return array
|
55 |
+
*/
|
56 |
+
public function arrange_rttpg_columns( $columns ) {
|
57 |
+
$shortcode = [ 'shortcode' => esc_html__( 'Shortcode', 'the-post-grid' ) ];
|
58 |
|
59 |
return array_slice( $columns, 0, 2, true ) + $shortcode + array_slice( $columns, 1, null, true );
|
60 |
}
|
61 |
|
62 |
+
/**
|
63 |
+
* Admin Scripts
|
64 |
+
*
|
65 |
+
* @return void
|
66 |
+
*/
|
67 |
+
public function admin_enqueue_scripts() {
|
68 |
|
69 |
global $pagenow, $typenow;
|
70 |
|
71 |
+
if ( 'tpg_builder' === $typenow ) {
|
72 |
wp_enqueue_style( 'rt-tpg-admin' );
|
73 |
}
|
74 |
|
75 |
+
if ( ! in_array( $pagenow, [ 'post.php', 'post-new.php' ], true ) ) {
|
|
|
76 |
return;
|
77 |
}
|
78 |
|
79 |
+
if ( rtTPG()->post_type !== $typenow ) {
|
80 |
return;
|
81 |
}
|
82 |
|
92 |
$select2Id = 'select2-avada-js';
|
93 |
}
|
94 |
|
95 |
+
// scripts.
|
96 |
+
wp_enqueue_script(
|
97 |
+
[
|
98 |
+
'jquery',
|
99 |
+
'jquery-ui-datepicker',
|
100 |
+
'wp-color-picker',
|
101 |
+
$select2Id,
|
102 |
+
'imagesloaded',
|
103 |
+
'rt-isotope-js',
|
104 |
+
'rt-tpg-admin',
|
105 |
+
'rt-tpg-admin-preview',
|
106 |
+
]
|
107 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
// styles.
|
110 |
+
wp_enqueue_style(
|
111 |
+
[
|
112 |
+
'wp-color-picker',
|
113 |
+
'rt-select2',
|
114 |
+
'rt-fontawsome',
|
115 |
+
'rt-tpg-admin',
|
116 |
+
'rt-tpg-admin-preview',
|
117 |
+
]
|
118 |
+
);
|
119 |
|
120 |
+
wp_localize_script(
|
121 |
+
'rt-tpg-admin',
|
122 |
+
'rttpg',
|
123 |
+
[
|
124 |
+
'nonceID' => esc_attr( rtTPG()->nonceId() ),
|
125 |
+
'nonce' => esc_attr( wp_create_nonce( rtTPG()->nonceText() ) ),
|
126 |
+
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
|
127 |
+
]
|
128 |
+
);
|
129 |
|
130 |
+
}
|
131 |
|
132 |
+
/**
|
133 |
+
* Add Metabox.
|
134 |
+
*
|
135 |
+
* @return void
|
136 |
+
*/
|
137 |
+
public function admin_head() {
|
138 |
add_meta_box(
|
139 |
'rttpg_meta',
|
140 |
+
esc_html__( 'Short Code Generator', 'the-post-grid' ),
|
141 |
+
[ $this, 'rttpg_meta_settings_selection' ],
|
142 |
rtTPG()->post_type,
|
143 |
'normal',
|
144 |
+
'high'
|
145 |
+
);
|
146 |
|
147 |
add_meta_box(
|
148 |
rtTPG()->post_type . '_sc_preview_meta',
|
149 |
+
esc_html__( 'Layout Preview', 'the-post-grid' ),
|
150 |
+
[ $this, 'tpg_sc_preview_selection' ],
|
151 |
rtTPG()->post_type,
|
152 |
'normal',
|
153 |
+
'high'
|
154 |
+
);
|
155 |
|
156 |
add_meta_box(
|
157 |
'rt_plugin_sc_pro_information',
|
158 |
+
esc_html__( 'Documentation', 'the-post-grid' ),
|
159 |
+
[ $this, 'rt_plugin_sc_pro_information' ],
|
160 |
rtTPG()->post_type,
|
161 |
'side',
|
162 |
'low'
|
163 |
);
|
|
|
164 |
}
|
165 |
|
166 |
+
/**
|
167 |
+
* Marketing.
|
168 |
+
*
|
169 |
+
* @param string $post Post.
|
170 |
+
* @return void
|
171 |
+
*/
|
172 |
+
public function rt_plugin_sc_pro_information( $post ) {
|
173 |
$html = '';
|
174 |
+
|
175 |
+
if ( 'settings' === $post ) {
|
176 |
$html .= '<div class="rt-document-box rt-update-pro-btn-wrap">
|
177 |
+
<a href="' . esc_url( rtTpg()->proLink() ) . '" target="_blank" class="rt-update-pro-btn">' . esc_html__( 'Update Pro To Get More Features', 'the-post-grid' ) . '</a>
|
178 |
+
</div>';
|
179 |
} else {
|
180 |
if ( ! rtTPG()->hasPro() ) {
|
181 |
+
$html .= sprintf(
|
182 |
+
'<div class="rt-document-box"><div class="rt-box-icon"><i class="dashicons dashicons-megaphone"></i></div><div class="rt-box-content"><h3 class="rt-box-title">%1$s</h3>%2$s</div></div>',
|
183 |
+
esc_html__( 'Pro Features', 'the-post-grid' ),
|
184 |
+
Options::get_pro_feature_list()
|
185 |
+
);
|
186 |
}
|
187 |
}
|
188 |
+
|
189 |
+
$html .= sprintf(
|
190 |
+
'<div class="rt-document-box">
|
191 |
+
<div class="rt-box-icon"><i class="dashicons dashicons-media-document"></i></div>
|
192 |
+
<div class="rt-box-content">
|
193 |
+
<h3 class="rt-box-title">%1$s</h3>
|
194 |
+
<p>%2$s</p>
|
195 |
+
<a href="' . esc_url( rtTpg()->docLink() ) . '" target="_blank" class="rt-admin-btn">%1$s</a>
|
196 |
+
</div>
|
197 |
+
</div>',
|
198 |
+
esc_html__( 'Documentation', 'the-post-grid' ),
|
199 |
+
esc_html__( 'Get started by spending some time with the documentation we included step by step process with screenshots with video.', 'the-post-grid' )
|
200 |
);
|
201 |
|
202 |
+
$rtContact = 'https://www.radiustheme.com/contact/';
|
203 |
+
$rtFb = 'https://www.facebook.com/groups/234799147426640/';
|
204 |
+
$rtsite = 'https://www.radiustheme.com/';
|
205 |
+
|
206 |
$html .= '<div class="rt-document-box">
|
207 |
+
<div class="rt-box-icon"><i class="dashicons dashicons-sos"></i></div>
|
208 |
+
<div class="rt-box-content">
|
209 |
+
<h3 class="rt-box-title">Need Help?</h3>
|
210 |
+
<p>Stuck with something? Please create a
|
211 |
+
<a href="' . esc_url( $rtContact ) . '">ticket here</a> or post on <a href="' . esc_url( $rtFb ) . '">facebook group</a>. For emergency case join our <a href="' . esc_url( $rtsite ) . '">live chat</a>.</p>
|
212 |
+
<a href="' . esc_url( $rtContact ) . '" target="_blank" class="rt-admin-btn">' . esc_html__( 'Get Support', 'the-post-grid' ) . '</a>
|
213 |
+
</div>
|
214 |
+
</div>';
|
215 |
+
|
216 |
+
Fns::print_html( $html );
|
217 |
}
|
218 |
|
219 |
/**
|
220 |
+
* Preview
|
221 |
+
*
|
222 |
+
* @return void
|
223 |
*/
|
224 |
+
public function tpg_sc_preview_selection() {
|
225 |
+
$html = null;
|
226 |
$html .= "<div class='rt-response'></div>";
|
227 |
$html .= "<div id='tpg-preview-container'></div>";
|
|
|
228 |
|
229 |
+
Fns::print_html( $html, true );
|
230 |
}
|
231 |
|
232 |
+
/**
|
233 |
+
* Text after title
|
234 |
+
*
|
235 |
+
* @param object $post Post object.
|
236 |
+
* @return void
|
237 |
+
*/
|
238 |
+
public function tpg_sc_after_title( $post ) {
|
239 |
if ( rtTPG()->post_type !== $post->post_type ) {
|
240 |
return;
|
241 |
}
|
242 |
+
|
243 |
+
$html = null;
|
244 |
$html .= '<div class="postbox rt-after-title" style="margin-bottom: 0;"><div class="inside">';
|
245 |
+
$html .= '<p>
|
246 |
+
<input type="text" onfocus="this.select();" readonly="readonly" value="[the-post-grid id="' . absint( $post->ID ) . '" title="' . esc_attr( $post->post_title ) . '"]" class="large-text code rt-code-sc">
|
247 |
+
<input type="text" onfocus="this.select();" readonly="readonly" value="<?php echo do_shortcode( '[the-post-grid id="' . absint( $post->ID ) . '" title="' . esc_attr( $post->post_title ) . '"]' ); ?>" class="large-text code rt-code-sc">
|
248 |
+
</p>';
|
249 |
$html .= '</div></div>';
|
250 |
|
251 |
+
Fns::print_html( $html, true );
|
252 |
}
|
253 |
|
254 |
+
/**
|
255 |
+
* Meta settings
|
256 |
+
*
|
257 |
+
* @param object $post Post object.
|
258 |
+
* @return void
|
259 |
+
*/
|
260 |
+
public function rttpg_meta_settings_selection( $post ) {
|
261 |
$last_tab = trim( get_post_meta( $post->ID, '_tpg_last_active_tab', true ) );
|
262 |
$last_tab = $last_tab ? $last_tab : 'sc-post-post-source';
|
263 |
+
$post = [
|
264 |
+
'post' => $post,
|
265 |
+
];
|
266 |
+
|
267 |
wp_nonce_field( rtTPG()->nonceText(), rtTPG()->nonceId() );
|
268 |
+
|
269 |
+
$html = null;
|
270 |
$html .= '<div id="sc-tabs" class="rttpg-wrapper rt-tab-container rt-setting-holder">';
|
271 |
+
$html .= sprintf(
|
272 |
+
'<ul class="rt-tab-nav">
|
273 |
+
<li%s><a href="#sc-post-post-source">%s</a></li>
|
274 |
+
<li%s><a href="#sc-post-layout-settings">%s</a></li>
|
275 |
+
<li%s><a href="#sc-settings">%s</a></li>
|
276 |
+
<li%s><a href="#sc-field-selection">%s</a></li>
|
277 |
+
<li%s><a href="#sc-style">%s</a></li>
|
278 |
+
</ul>',
|
279 |
+
'sc-post-post-source' === $last_tab ? ' class="active"' : '',
|
280 |
+
esc_html__( 'Query Build', 'the-post-grid' ),
|
281 |
+
'sc-post-layout-settings' === $last_tab ? ' class="active"' : '',
|
282 |
+
esc_html__( 'Layout Settings', 'the-post-grid' ),
|
283 |
+
'sc-settings' === $last_tab ? ' class="active"' : '',
|
284 |
+
esc_html__( 'Settings', 'the-post-grid' ),
|
285 |
+
'sc-field-selection' === $last_tab ? ' class="active"' : '',
|
286 |
+
esc_html__( 'Field Selection', 'the-post-grid' ),
|
287 |
+
'sc-style' === $last_tab ? ' class="active"' : '',
|
288 |
+
esc_html__( 'Style', 'the-post-grid' )
|
289 |
);
|
290 |
|
291 |
+
// Query Build tab.
|
292 |
+
$html .= sprintf( '<div id="sc-post-post-source" class="rt-tab-content"%s>', 'sc-post-post-source' === $last_tab ? ' style="display:block"' : '' );
|
293 |
$html .= Fns::view( 'settings.post-source', $post, true );
|
294 |
$html .= '</div>';
|
295 |
|
296 |
+
// Layout Setting tab.
|
297 |
+
$html .= sprintf( '<div id="sc-post-layout-settings" class="rt-tab-content"%s>', 'sc-post-layout-settings' === $last_tab ? ' style="display:block"' : '' );
|
298 |
$html .= Fns::view( 'settings.layout-settings', $post, true );
|
299 |
$html .= '</div>';
|
300 |
|
301 |
+
// Settings tab.
|
302 |
+
$html .= sprintf( '<div id="sc-settings" class="rt-tab-content"%s>', 'sc-settings' === $last_tab ? ' style="display:block"' : '' );
|
303 |
$html .= Fns::view( 'settings.sc-settings', $post, true );
|
304 |
$html .= '</div>';
|
305 |
|
306 |
+
// Field Selection tab.
|
307 |
+
$html .= sprintf( '<div id="sc-field-selection" class="rt-tab-content"%s>', 'sc-field-selection' === $last_tab ? ' style="display:block"' : '' );
|
308 |
$html .= Fns::view( 'settings.item-fields', $post, true );
|
309 |
$html .= '</div>';
|
310 |
|
311 |
+
// Style tab.
|
312 |
+
$html .= sprintf( '<div id="sc-style" class="rt-tab-content"%s>', 'sc-style' === $last_tab ? ' style="display:block"' : '' );
|
313 |
$html .= Fns::view( 'settings.style', $post, true );
|
314 |
$html .= '</div>';
|
315 |
$html .= sprintf( '<input type="hidden" id="_tpg_last_active_tab" name="_tpg_last_active_tab" value="%s"/>', $last_tab );
|
316 |
$html .= '</div>';
|
|
|
|
|
317 |
|
318 |
+
Fns::print_html( $html, true );
|
319 |
+
}
|
320 |
|
321 |
+
/**
|
322 |
+
* Save meta box.
|
323 |
+
*
|
324 |
+
* @param int $post_id Post ID.
|
325 |
+
* @param object $post Post object.
|
326 |
+
* @return mixed
|
327 |
+
*/
|
328 |
+
public function save_post( $post_id, $post ) {
|
329 |
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
|
330 |
return $post_id;
|
331 |
}
|
334 |
return $post_id;
|
335 |
}
|
336 |
|
337 |
+
if ( rtTPG()->post_type !== $post->post_type ) {
|
338 |
return $post_id;
|
339 |
}
|
340 |
|
341 |
$mates = Fns::rtAllOptionFields();
|
342 |
+
|
343 |
foreach ( $mates as $metaKey => $field ) {
|
344 |
$rValue = ! empty( $_REQUEST[ $metaKey ] ) ? $_REQUEST[ $metaKey ] : null;
|
345 |
$value = Fns::sanitize( $field, $rValue );
|
346 |
+
|
347 |
if ( empty( $field['multiple'] ) ) {
|
348 |
update_post_meta( $post_id, $metaKey, $value );
|
349 |
} else {
|
356 |
}
|
357 |
}
|
358 |
|
359 |
+
$post_filter = ( isset( $_REQUEST['post_filter'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['post_filter'] ) ) : [] );
|
360 |
$advFilter = Options::rtTPAdvanceFilters();
|
361 |
+
|
362 |
foreach ( $advFilter['post_filter']['options'] as $filter => $fValue ) {
|
363 |
if ( $filter == 'tpg_taxonomy' ) {
|
364 |
delete_post_meta( $post_id, $filter );
|
365 |
+
|
366 |
if ( ! empty( $_REQUEST[ $filter ] ) && is_array( $_REQUEST[ $filter ] ) ) {
|
367 |
foreach ( $_REQUEST[ $filter ] as $tax ) {
|
368 |
if ( in_array( $filter, $post_filter ) ) {
|
369 |
add_post_meta( $post_id, $filter, trim( $tax ) );
|
370 |
}
|
371 |
+
|
372 |
delete_post_meta( $post_id, 'term_' . $tax );
|
373 |
+
|
374 |
+
$tt = isset( $_REQUEST[ 'term_' . $tax ] ) ? $_REQUEST[ 'term_' . $tax ] : [];
|
375 |
+
|
376 |
if ( is_array( $tt ) && ! empty( $tt ) && in_array( $filter, $post_filter ) ) {
|
377 |
foreach ( $tt as $termID ) {
|
378 |
add_post_meta( $post_id, 'term_' . $tax, trim( $termID ) );
|
379 |
}
|
380 |
}
|
381 |
+
|
382 |
+
$tto = isset( $_REQUEST[ 'term_operator_' . $tax ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ 'term_operator_' . $tax ] ) ) : null;
|
383 |
+
|
384 |
if ( $tto ) {
|
385 |
update_post_meta( $post_id, 'term_operator_' . $tax, trim( $tto ) );
|
386 |
}
|
387 |
}
|
388 |
+
|
389 |
+
$filterCount = isset( $_REQUEST[ $filter ] ) ? $_REQUEST[ $filter ] : [];
|
390 |
+
$tr = isset( $_REQUEST['taxonomy_relation'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['taxonomy_relation'] ) ) : null;
|
391 |
+
|
392 |
if ( count( $filterCount ) > 1 && $tr ) {
|
393 |
update_post_meta( $post_id, 'taxonomy_relation', trim( $tr ) );
|
394 |
} else {
|
395 |
delete_post_meta( $post_id, 'taxonomy_relation' );
|
396 |
}
|
|
|
397 |
}
|
398 |
+
} elseif ( $filter == 'author' ) {
|
399 |
delete_post_meta( $post_id, 'author' );
|
400 |
+
|
401 |
+
$authors = ( isset( $_REQUEST['author'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['author'] ) ) : [] );
|
402 |
+
|
403 |
if ( is_array( $authors ) && ! empty( $authors ) && in_array( 'author', $post_filter ) ) {
|
404 |
foreach ( $authors as $authorID ) {
|
405 |
add_post_meta( $post_id, 'author', trim( $authorID ) );
|
406 |
}
|
407 |
}
|
408 |
+
} elseif ( $filter == 'tpg_post_status' ) {
|
409 |
delete_post_meta( $post_id, $filter );
|
410 |
+
|
411 |
+
$statuses = isset( $_REQUEST[ $filter ] ) ? $_REQUEST[ $filter ] : [];
|
412 |
+
|
413 |
if ( is_array( $statuses ) && ! empty( $statuses ) && in_array( $filter, $post_filter ) ) {
|
414 |
foreach ( $statuses as $post_status ) {
|
415 |
add_post_meta( $post_id, $filter, trim( $post_status ) );
|
416 |
}
|
417 |
}
|
418 |
+
} elseif ( $filter == 's' ) {
|
419 |
delete_post_meta( $post_id, 's' );
|
420 |
+
|
421 |
+
$s = ( isset( $_REQUEST['s'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ) : null );
|
422 |
+
|
423 |
if ( $s && in_array( 's', $post_filter ) ) {
|
424 |
update_post_meta( $post_id, 's', sanitize_text_field( trim( $s ) ) );
|
425 |
}
|
426 |
+
} elseif ( $filter == 'order' ) {
|
427 |
if ( in_array( 'order', $post_filter ) ) {
|
428 |
+
$order = ( isset( $_REQUEST['order'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ) : null );
|
429 |
+
$order_by = ( isset( $_REQUEST['order_by'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['order_by'] ) ) : null );
|
430 |
+
$tpg_meta_key = isset( $_REQUEST['tpg_meta_key'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tpg_meta_key'] ) ) : null;
|
431 |
+
|
432 |
if ( $order && in_array( 'order', $post_filter ) ) {
|
433 |
update_post_meta( $post_id, 'order', sanitize_text_field( trim( $order ) ) );
|
434 |
}
|
435 |
+
|
436 |
if ( $order_by && in_array( 'order', $post_filter ) ) {
|
437 |
update_post_meta( $post_id, 'order_by', sanitize_text_field( trim( $order_by ) ) );
|
438 |
}
|
439 |
+
|
440 |
if ( in_array( $order_by, array_keys( Options::rtMetaKeyType() ) ) && $tpg_meta_key && in_array( 'order', $post_filter ) ) {
|
441 |
update_post_meta( $post_id, 'tpg_meta_key', sanitize_text_field( trim( $tpg_meta_key ) ) );
|
442 |
} else {
|
447 |
delete_post_meta( $post_id, 'tpg_meta_key' );
|
448 |
delete_post_meta( $post_id, 'order_by' );
|
449 |
}
|
450 |
+
} elseif ( $filter == 'date_range' ) {
|
451 |
if ( in_array( 'date_range', $post_filter ) ) {
|
452 |
+
$start = ! empty( $_REQUEST[ $filter . '_start' ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $filter . '_start' ] ) ) : null;
|
453 |
+
$end = ! empty( $_REQUEST[ $filter . '_end' ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $filter . '_end' ] ) ) : null;
|
454 |
+
|
455 |
update_post_meta( $post_id, $filter . '_start', trim( $start ) );
|
456 |
update_post_meta( $post_id, $filter . '_end', trim( $end ) );
|
457 |
} else {
|
461 |
}
|
462 |
}
|
463 |
|
464 |
+
// Extra css.
|
|
|
465 |
$extraFields = Options::extraStyle();
|
466 |
+
$extraTypes = [ 'color', 'size', 'weight', 'alignment' ];
|
467 |
|
468 |
foreach ( $extraFields as $key => $title ) {
|
469 |
foreach ( $extraTypes as $type ) {
|
470 |
$newKew = $key . "_{$type}";
|
471 |
if ( isset( $_REQUEST[ $newKew ] ) ) {
|
472 |
+
$value = sanitize_text_field( wp_unslash( $_REQUEST[ $newKew ] ) );
|
473 |
+
|
474 |
update_post_meta( $post_id, $newKew, $value );
|
475 |
}
|
476 |
}
|
477 |
}
|
478 |
|
479 |
+
if ( isset( $_POST['_tpg_last_active_tab'] ) && $active_tab = sanitize_text_field( wp_unslash( $_POST['_tpg_last_active_tab'] ) ) ) {
|
480 |
+
update_post_meta( $post_id, '_tpg_last_active_tab', $active_tab );
|
|
|
481 |
}
|
482 |
|
483 |
+
}
|
484 |
+
}
|
app/Controllers/Admin/NoticeController.php
CHANGED
@@ -1,10 +1,24 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
namespace RT\ThePostGrid\Controllers\Admin;
|
5 |
|
|
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
7 |
class NoticeController {
|
|
|
|
|
|
|
8 |
public function __construct() {
|
9 |
$current = time();
|
10 |
$black_friday = mktime( 0, 0, 0, 11, 22, 2021 ) <= $current && $current <= mktime( 0, 0, 0, 12, 6, 2021 );
|
@@ -20,43 +34,61 @@ class NoticeController {
|
|
20 |
add_action( 'admin_init', [ __CLASS__, 'rttpg_notice' ] );
|
21 |
}
|
22 |
|
|
|
|
|
|
|
|
|
|
|
23 |
public static function rttpg_notice() {
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
}
|
56 |
-
|
57 |
-
} );
|
58 |
}
|
59 |
|
|
|
|
|
|
|
|
|
|
|
60 |
public static function black_friday_notice() {
|
61 |
if ( get_option( 'rttpg_bf_2021' ) != '1' ) {
|
62 |
if ( ! isset( $GLOBALS['rt_tpg_2021_notice'] ) ) {
|
@@ -66,78 +98,93 @@ class NoticeController {
|
|
66 |
}
|
67 |
}
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
add_action(
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
|
128 |
-
|
|
|
|
|
|
|
|
|
129 |
public static function rttpg_activation_time() {
|
130 |
$get_activation_time = strtotime( "now" );
|
131 |
add_option( 'rttpg_plugin_activation_time', $get_activation_time );
|
132 |
}
|
133 |
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
public static function rttpg_check_installation_time() {
|
|
|
|
|
136 |
|
137 |
-
|
138 |
-
$nobug = get_option( 'rttpg_spare_me', "0" );
|
139 |
-
|
140 |
-
if ( $nobug == "1" || $nobug == "3" ) {
|
141 |
return;
|
142 |
}
|
143 |
|
@@ -146,20 +193,21 @@ class NoticeController {
|
|
146 |
|
147 |
$remind_time = get_option( 'rttpg_remind_me' );
|
148 |
$remind_due = strtotime( '+15 days', $remind_time );
|
149 |
-
$now = strtotime(
|
150 |
|
151 |
if ( $now >= $remind_due ) {
|
152 |
add_action( 'admin_notices', [ __CLASS__, 'rttpg_display_admin_notice' ] );
|
153 |
-
}
|
154 |
add_action( 'admin_notices', [ __CLASS__, 'rttpg_display_admin_notice' ] );
|
155 |
}
|
156 |
}
|
157 |
|
158 |
/**
|
159 |
* Display Admin Notice, asking for a review
|
160 |
-
|
|
|
|
|
161 |
public static function rttpg_display_admin_notice() {
|
162 |
-
// wordpress global variable
|
163 |
global $pagenow;
|
164 |
|
165 |
$exclude = [
|
@@ -181,138 +229,151 @@ class NoticeController {
|
|
181 |
'export.php',
|
182 |
'site-health.php',
|
183 |
'export-personal-data.php',
|
184 |
-
'erase-personal-data.php'
|
185 |
];
|
186 |
|
187 |
if ( ! in_array( $pagenow, $exclude ) ) {
|
188 |
-
$dont_disturb =
|
189 |
-
$remind_me =
|
190 |
-
$rated =
|
191 |
-
$reviewurl =
|
192 |
-
|
193 |
-
printf(
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
313 |
}
|
314 |
}
|
315 |
|
|
|
|
|
|
|
|
|
|
|
316 |
protected static function rttpg_current_admin_url() {
|
317 |
$uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
|
318 |
$uri = preg_replace( '|^.*/wp-admin/|i', '', $uri );
|
@@ -321,39 +382,50 @@ class NoticeController {
|
|
321 |
return '';
|
322 |
}
|
323 |
|
324 |
-
return remove_query_arg(
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
|
|
|
|
|
|
331 |
}
|
332 |
|
333 |
-
|
|
|
|
|
|
|
|
|
334 |
public static function rttpg_spare_me() {
|
335 |
if ( isset( $_GET['rttpg_spare_me'] ) && ! empty( $_GET['rttpg_spare_me'] ) ) {
|
336 |
-
$spare_me = $_GET['rttpg_spare_me'];
|
|
|
337 |
if ( 1 == $spare_me ) {
|
338 |
-
update_option( 'rttpg_spare_me',
|
339 |
}
|
340 |
}
|
341 |
|
342 |
if ( isset( $_GET['rttpg_remind_me'] ) && ! empty( $_GET['rttpg_remind_me'] ) ) {
|
343 |
-
$remind_me = $_GET['rttpg_remind_me'];
|
|
|
344 |
if ( 1 == $remind_me ) {
|
345 |
-
$get_activation_time = strtotime(
|
|
|
346 |
update_option( 'rttpg_remind_me', $get_activation_time );
|
347 |
-
update_option( 'rttpg_spare_me',
|
348 |
}
|
349 |
}
|
350 |
|
351 |
if ( isset( $_GET['rttpg_rated'] ) && ! empty( $_GET['rttpg_rated'] ) ) {
|
352 |
-
$rttpg_rated = $_GET['rttpg_rated'];
|
|
|
353 |
if ( 1 == $rttpg_rated ) {
|
354 |
update_option( 'rttpg_rated', 'yes' );
|
355 |
-
update_option( 'rttpg_spare_me',
|
356 |
}
|
357 |
}
|
358 |
}
|
359 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Notice Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers\Admin;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
+
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Notice Controller class.
|
17 |
+
*/
|
18 |
class NoticeController {
|
19 |
+
/**
|
20 |
+
* Class Constructor
|
21 |
+
*/
|
22 |
public function __construct() {
|
23 |
$current = time();
|
24 |
$black_friday = mktime( 0, 0, 0, 11, 22, 2021 ) <= $current && $current <= mktime( 0, 0, 0, 12, 6, 2021 );
|
34 |
add_action( 'admin_init', [ __CLASS__, 'rttpg_notice' ] );
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* Notice
|
39 |
+
*
|
40 |
+
* @return void
|
41 |
+
*/
|
42 |
public static function rttpg_notice() {
|
43 |
+
add_action(
|
44 |
+
'admin_notices',
|
45 |
+
function () {
|
46 |
+
$settings = get_option( 'rt_the_post_grid_settings' );
|
47 |
+
$screen = get_current_screen();
|
48 |
+
|
49 |
+
if ( isset( $settings['tpg_block_type'] ) ) {
|
50 |
+
if ( in_array( $screen->id, [ 'edit-rttpg', 'rttpg' ], true ) && 'elementor' === $settings['tpg_block_type'] ) { ?>
|
51 |
+
<div class="notice notice-for-warning">
|
52 |
+
<p>
|
53 |
+
<?php
|
54 |
+
echo sprintf(
|
55 |
+
'%1$s<a style="color: #fff;" href="%2$s">%3$s</a>',
|
56 |
+
esc_html__( 'You have selected only Elementor method. To use Shortcode Generator please enable shortcode or default from ', 'the-post-grid' ),
|
57 |
+
esc_url( admin_url( 'edit.php?post_type=rttpg&page=rttpg_settings' ) ),
|
58 |
+
esc_html__( 'Settings => Common Settings => Resource Load Type', 'the-post-grid' )
|
59 |
+
);
|
60 |
+
?>
|
61 |
+
</p>
|
62 |
+
</div>
|
63 |
+
<?php
|
64 |
+
}
|
65 |
+
|
66 |
+
if ( 'edit-tpg_builder' === $screen->id && 'shortcode' === $settings['tpg_block_type'] ) {
|
67 |
+
?>
|
68 |
+
<div class="notice notice-for-warning">
|
69 |
+
<p>
|
70 |
+
<?php
|
71 |
+
echo sprintf(
|
72 |
+
'%1$s<a style="color: #fff;" href="%2$s">%3$s</a>',
|
73 |
+
esc_html__( 'You have selected only Shortcode Generator method. To use Elementor please enable Elementor or default from ', 'the-post-grid' ),
|
74 |
+
esc_url( admin_url( 'edit.php?post_type=rttpg&page=rttpg_settings§ion=common-settings' ) ),
|
75 |
+
esc_html__( 'Settings => Common Settings => Resource Load Type', 'the-post-grid' )
|
76 |
+
);
|
77 |
+
?>
|
78 |
+
</p>
|
79 |
+
</div>
|
80 |
+
<?php
|
81 |
+
}
|
82 |
}
|
83 |
}
|
84 |
+
);
|
|
|
85 |
}
|
86 |
|
87 |
+
/**
|
88 |
+
* Black friday notice.
|
89 |
+
*
|
90 |
+
* @return void
|
91 |
+
*/
|
92 |
public static function black_friday_notice() {
|
93 |
if ( get_option( 'rttpg_bf_2021' ) != '1' ) {
|
94 |
if ( ! isset( $GLOBALS['rt_tpg_2021_notice'] ) ) {
|
98 |
}
|
99 |
}
|
100 |
|
101 |
+
/**
|
102 |
+
* Black friday notice.
|
103 |
+
*
|
104 |
+
* @return void
|
105 |
+
*/
|
106 |
+
public static function notice() {
|
107 |
+
add_action(
|
108 |
+
'admin_enqueue_scripts',
|
109 |
+
function () {
|
110 |
+
wp_enqueue_script( 'jquery' );
|
111 |
+
}
|
112 |
+
);
|
113 |
+
|
114 |
+
add_action(
|
115 |
+
'admin_notices',
|
116 |
+
function () {
|
117 |
+
$plugin_name = 'The Post Grid';
|
118 |
+
$download_link = 'https://www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/'; ?>
|
119 |
+
<div class="notice notice-info is-dismissible" data-rttpg-dismissable="rttpg_bf_2021" style="display:grid;grid-template-columns: 100px auto;padding-top: 25px; padding-bottom: 22px;">
|
120 |
+
<img alt="<?php echo esc_attr( $plugin_name ); ?>" src="<?php echo esc_url( rtTPG()->get_assets_uri( 'images/icon-128x128.png' ) ); ?>" width="74px" height="74px" style="grid-row: 1 / 4; align-self: center;justify-self: center"/>
|
121 |
+
<h3 style="margin:0;"><?php echo sprintf( '%s Black Friday Deal!!', esc_html( $plugin_name ) ); ?></h3>
|
122 |
+
<p style="margin:0 0 2px;">Don't miss out on our biggest sale of the year! Get your <b><?php echo esc_html( $plugin_name ); ?> plan</b> with <b>UPTO 50% OFF</b>! Limited time offer expires on December 5.</p>
|
123 |
+
<p style="margin:0;">
|
124 |
+
<a class="button button-primary" href="<?php echo esc_url( $download_link ); ?>" target="_blank">Buy Now</a>
|
125 |
+
<a class="button button-dismiss" href="#">Dismiss</a>
|
126 |
+
</p>
|
127 |
+
</div>
|
128 |
+
<?php
|
129 |
+
}
|
130 |
+
);
|
131 |
+
|
132 |
+
add_action(
|
133 |
+
'admin_footer',
|
134 |
+
function () {
|
135 |
+
?>
|
136 |
+
<script type="text/javascript">
|
137 |
+
( function ( $ ) {
|
138 |
+
$( function () {
|
139 |
+
setTimeout( function () {
|
140 |
+
$( 'div[data-rttpg-dismissable] .notice-dismiss, div[data-rttpg-dismissable] .button-dismiss' )
|
141 |
+
.on( 'click', function ( e ) {
|
142 |
+
e.preventDefault();
|
143 |
+
$.post( ajaxurl, {
|
144 |
+
'action': 'rttpg_dismiss_admin_notice',
|
145 |
+
'nonce': <?php echo wp_json_encode( wp_create_nonce( 'rttpg-dismissible-notice' ) ); ?>
|
146 |
+
} );
|
147 |
+
$( e.target ).closest( '.is-dismissible' ).remove();
|
148 |
+
} );
|
149 |
+
}, 1000 );
|
150 |
+
} );
|
151 |
+
} )( jQuery );
|
152 |
+
</script>
|
153 |
+
<?php
|
154 |
+
}
|
155 |
+
);
|
156 |
+
|
157 |
+
add_action(
|
158 |
+
'wp_ajax_rttpg_dismiss_admin_notice',
|
159 |
+
function () {
|
160 |
+
check_ajax_referer( 'rttpg-dismissible-notice', 'nonce' );
|
161 |
+
|
162 |
+
update_option( 'rttpg_bf_2021', '1' );
|
163 |
+
wp_die();
|
164 |
+
}
|
165 |
+
);
|
166 |
}
|
167 |
|
168 |
+
/**
|
169 |
+
* Plugin activation time
|
170 |
+
*
|
171 |
+
* @return void
|
172 |
+
*/
|
173 |
public static function rttpg_activation_time() {
|
174 |
$get_activation_time = strtotime( "now" );
|
175 |
add_option( 'rttpg_plugin_activation_time', $get_activation_time );
|
176 |
}
|
177 |
|
178 |
+
/**
|
179 |
+
* Check if review notice should be shown or not
|
180 |
+
*
|
181 |
+
* @return void
|
182 |
+
*/
|
183 |
public static function rttpg_check_installation_time() {
|
184 |
+
// Added Lines Start.
|
185 |
+
$nobug = get_option( 'rttpg_spare_me', '0' );
|
186 |
|
187 |
+
if ( $nobug == '1' || $nobug == '3' ) {
|
|
|
|
|
|
|
188 |
return;
|
189 |
}
|
190 |
|
193 |
|
194 |
$remind_time = get_option( 'rttpg_remind_me' );
|
195 |
$remind_due = strtotime( '+15 days', $remind_time );
|
196 |
+
$now = strtotime( 'now' );
|
197 |
|
198 |
if ( $now >= $remind_due ) {
|
199 |
add_action( 'admin_notices', [ __CLASS__, 'rttpg_display_admin_notice' ] );
|
200 |
+
} elseif ( ( $past_date >= $install_date ) && '2' !== $nobug ) {
|
201 |
add_action( 'admin_notices', [ __CLASS__, 'rttpg_display_admin_notice' ] );
|
202 |
}
|
203 |
}
|
204 |
|
205 |
/**
|
206 |
* Display Admin Notice, asking for a review
|
207 |
+
*
|
208 |
+
* @return void
|
209 |
+
*/
|
210 |
public static function rttpg_display_admin_notice() {
|
|
|
211 |
global $pagenow;
|
212 |
|
213 |
$exclude = [
|
229 |
'export.php',
|
230 |
'site-health.php',
|
231 |
'export-personal-data.php',
|
232 |
+
'erase-personal-data.php',
|
233 |
];
|
234 |
|
235 |
if ( ! in_array( $pagenow, $exclude ) ) {
|
236 |
+
$dont_disturb = add_query_arg( 'rttpg_spare_me', '1', self::rttpg_current_admin_url() );
|
237 |
+
$remind_me = add_query_arg( 'rttpg_remind_me', '1', self::rttpg_current_admin_url() );
|
238 |
+
$rated = add_query_arg( 'rttpg_rated', '1', self::rttpg_current_admin_url() );
|
239 |
+
$reviewurl = 'https://wordpress.org/support/plugin/the-post-grid/reviews/?filter=5#new-post';
|
240 |
+
|
241 |
+
printf(
|
242 |
+
'<div class="notice rttpg-review-notice rttpg-review-notice--extended">
|
243 |
+
<div class="rttpg-review-notice_content">
|
244 |
+
<h3>%1$s</h3>
|
245 |
+
<p>%2$s</p>
|
246 |
+
<div class="rttpg-review-notice_actions">
|
247 |
+
<a href="%3$s" class="rttpg-review-button rttpg-review-button--cta" target="_blank"><span>⭐ Yes, You Deserve It!</span></a>
|
248 |
+
<a href="%4$s" class="rttpg-review-button rttpg-review-button--cta rttpg-review-button--outline"><span>😀 Already Rated!</span></a>
|
249 |
+
<a href="%5$s" class="rttpg-review-button rttpg-review-button--cta rttpg-review-button--outline"><span>🔔 Remind Me Later</span></a>
|
250 |
+
<a href="%6$s" class="rttpg-review-button rttpg-review-button--cta rttpg-review-button--error rttpg-review-button--outline"><span>😐 No Thanks</span></a>
|
251 |
+
</div>
|
252 |
+
</div>
|
253 |
+
</div>',
|
254 |
+
esc_html__( 'Enjoying The Post Grid?', 'the-post-grid' ),
|
255 |
+
esc_html__( 'Thank you for choosing The Post Grid. If you have found our plugin useful and makes you smile, please consider giving us a 5-star rating on WordPress.org. It will help us to grow.', 'the-post-grid' ),
|
256 |
+
esc_url( $reviewurl ),
|
257 |
+
esc_url( $rated ),
|
258 |
+
esc_url( $remind_me ),
|
259 |
+
esc_url( $dont_disturb )
|
260 |
+
);
|
261 |
+
|
262 |
+
echo '<style>
|
263 |
+
.rttpg-review-button--cta {
|
264 |
+
--e-button-context-color: #4C6FFF;
|
265 |
+
--e-button-context-color-dark: #4C6FFF;
|
266 |
+
--e-button-context-tint: rgb(75 47 157/4%);
|
267 |
+
--e-focus-color: rgb(75 47 157/40%);
|
268 |
+
}
|
269 |
+
.rttpg-review-notice {
|
270 |
+
position: relative;
|
271 |
+
margin: 5px 20px 5px 2px;
|
272 |
+
border: 1px solid #ccd0d4;
|
273 |
+
background: #fff;
|
274 |
+
box-shadow: 0 1px 4px rgba(0,0,0,0.15);
|
275 |
+
font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
|
276 |
+
border-inline-start-width: 4px;
|
277 |
+
}
|
278 |
+
.rttpg-review-notice.notice {
|
279 |
+
padding: 0;
|
280 |
+
}
|
281 |
+
.rttpg-review-notice:before {
|
282 |
+
position: absolute;
|
283 |
+
top: -1px;
|
284 |
+
bottom: -1px;
|
285 |
+
left: -4px;
|
286 |
+
display: block;
|
287 |
+
width: 4px;
|
288 |
+
background: -webkit-linear-gradient(bottom, #4C6FFF 0%, #6939c6 100%);
|
289 |
+
background: linear-gradient(0deg, #4C6FFF 0%, #6939c6 100%);
|
290 |
+
content: "";
|
291 |
+
}
|
292 |
+
.rttpg-review-notice_content {
|
293 |
+
padding: 20px;
|
294 |
+
}
|
295 |
+
.rttpg-review-notice_actions > * + * {
|
296 |
+
margin-inline-start: 8px;
|
297 |
+
-webkit-margin-start: 8px;
|
298 |
+
-moz-margin-start: 8px;
|
299 |
+
}
|
300 |
+
.rttpg-review-notice p {
|
301 |
+
margin: 0;
|
302 |
+
padding: 0;
|
303 |
+
line-height: 1.5;
|
304 |
+
}
|
305 |
+
p + .rttpg-review-notice_actions {
|
306 |
+
margin-top: 1rem;
|
307 |
+
}
|
308 |
+
.rttpg-review-notice h3 {
|
309 |
+
margin: 0;
|
310 |
+
font-size: 1.0625rem;
|
311 |
+
line-height: 1.2;
|
312 |
+
}
|
313 |
+
.rttpg-review-notice h3 + p {
|
314 |
+
margin-top: 8px;
|
315 |
+
}
|
316 |
+
.rttpg-review-button {
|
317 |
+
display: inline-block;
|
318 |
+
padding: 0.4375rem 0.75rem;
|
319 |
+
border: 0;
|
320 |
+
border-radius: 3px;;
|
321 |
+
background: var(--e-button-context-color);
|
322 |
+
color: #fff;
|
323 |
+
vertical-align: middle;
|
324 |
+
text-align: center;
|
325 |
+
text-decoration: none;
|
326 |
+
white-space: nowrap;
|
327 |
+
}
|
328 |
+
.rttpg-review-button:active {
|
329 |
+
background: var(--e-button-context-color-dark);
|
330 |
+
color: #fff;
|
331 |
+
text-decoration: none;
|
332 |
+
}
|
333 |
+
.rttpg-review-button:focus {
|
334 |
+
outline: 0;
|
335 |
+
background: var(--e-button-context-color-dark);
|
336 |
+
box-shadow: 0 0 0 2px var(--e-focus-color);
|
337 |
+
color: #fff;
|
338 |
+
text-decoration: none;
|
339 |
+
}
|
340 |
+
.rttpg-review-button:hover {
|
341 |
+
background: var(--e-button-context-color-dark);
|
342 |
+
color: #fff;
|
343 |
+
text-decoration: none;
|
344 |
+
}
|
345 |
+
.rttpg-review-button.focus {
|
346 |
+
outline: 0;
|
347 |
+
box-shadow: 0 0 0 2px var(--e-focus-color);
|
348 |
+
}
|
349 |
+
.rttpg-review-button--error {
|
350 |
+
--e-button-context-color: #d72b3f;
|
351 |
+
--e-button-context-color-dark: #ae2131;
|
352 |
+
--e-button-context-tint: rgba(215,43,63,0.04);
|
353 |
+
--e-focus-color: rgba(215,43,63,0.4);
|
354 |
+
}
|
355 |
+
.rttpg-review-button.rttpg-review-button--outline {
|
356 |
+
border: 1px solid;
|
357 |
+
background: 0 0;
|
358 |
+
color: var(--e-button-context-color);
|
359 |
+
}
|
360 |
+
.rttpg-review-button.rttpg-review-button--outline:focus {
|
361 |
+
background: var(--e-button-context-tint);
|
362 |
+
color: var(--e-button-context-color-dark);
|
363 |
+
}
|
364 |
+
.rttpg-review-button.rttpg-review-button--outline:hover {
|
365 |
+
background: var(--e-button-context-tint);
|
366 |
+
color: var(--e-button-context-color-dark);
|
367 |
+
}
|
368 |
+
</style>';
|
369 |
}
|
370 |
}
|
371 |
|
372 |
+
/**
|
373 |
+
* Current admin URL.
|
374 |
+
*
|
375 |
+
* @return string
|
376 |
+
*/
|
377 |
protected static function rttpg_current_admin_url() {
|
378 |
$uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
|
379 |
$uri = preg_replace( '|^.*/wp-admin/|i', '', $uri );
|
382 |
return '';
|
383 |
}
|
384 |
|
385 |
+
return remove_query_arg(
|
386 |
+
[
|
387 |
+
'_wpnonce',
|
388 |
+
'_wc_notice_nonce',
|
389 |
+
'wc_db_update',
|
390 |
+
'wc_db_update_nonce',
|
391 |
+
'wc-hide-notice'
|
392 |
+
],
|
393 |
+
admin_url( $uri )
|
394 |
+
);
|
395 |
}
|
396 |
|
397 |
+
/**
|
398 |
+
* Remove the notice for the user if review already done
|
399 |
+
*
|
400 |
+
* @return void
|
401 |
+
*/
|
402 |
public static function rttpg_spare_me() {
|
403 |
if ( isset( $_GET['rttpg_spare_me'] ) && ! empty( $_GET['rttpg_spare_me'] ) ) {
|
404 |
+
$spare_me = absint( $_GET['rttpg_spare_me'] );
|
405 |
+
|
406 |
if ( 1 == $spare_me ) {
|
407 |
+
update_option( 'rttpg_spare_me', '1' );
|
408 |
}
|
409 |
}
|
410 |
|
411 |
if ( isset( $_GET['rttpg_remind_me'] ) && ! empty( $_GET['rttpg_remind_me'] ) ) {
|
412 |
+
$remind_me = absint( $_GET['rttpg_remind_me'] );
|
413 |
+
|
414 |
if ( 1 == $remind_me ) {
|
415 |
+
$get_activation_time = strtotime( 'now' );
|
416 |
+
|
417 |
update_option( 'rttpg_remind_me', $get_activation_time );
|
418 |
+
update_option( 'rttpg_spare_me', '2' );
|
419 |
}
|
420 |
}
|
421 |
|
422 |
if ( isset( $_GET['rttpg_rated'] ) && ! empty( $_GET['rttpg_rated'] ) ) {
|
423 |
+
$rttpg_rated = absint( $_GET['rttpg_rated'] );
|
424 |
+
|
425 |
if ( 1 == $rttpg_rated ) {
|
426 |
update_option( 'rttpg_rated', 'yes' );
|
427 |
+
update_option( 'rttpg_spare_me', '3' );
|
428 |
}
|
429 |
}
|
430 |
}
|
431 |
+
}
|
app/Controllers/Admin/PostTypeController.php
CHANGED
@@ -1,44 +1,63 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
namespace RT\ThePostGrid\Controllers\Admin;
|
5 |
|
6 |
-
|
|
|
|
|
|
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
public function __construct() {
|
9 |
-
add_action( 'init', [
|
10 |
-
add_action( 'admin_init', [
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
public function the_post_grid_remove_all_meta_box() {
|
14 |
-
// if ( is_admin() && apply_filters( 'rttpg_remove_all_extra_metabox_from_shordcode', true ) ) {
|
15 |
-
// add_filter( "get_user_option_meta-box-order_" . rtTPG()->post_type, [ &$this, 'remove_all_meta_boxes_tgp_sc', ] );
|
16 |
-
// }
|
17 |
-
|
18 |
if ( get_option( 'rttpg_activation_redirect', false ) ) {
|
19 |
delete_option( 'rttpg_activation_redirect' );
|
20 |
-
|
21 |
}
|
22 |
}
|
23 |
|
|
|
|
|
|
|
|
|
|
|
24 |
public function register_post_types() {
|
25 |
-
|
26 |
-
// Create the post grid post type
|
27 |
$labels = [
|
28 |
-
'name' =>
|
29 |
-
'singular_name' =>
|
30 |
-
'add_new' =>
|
31 |
-
'all_items' =>
|
32 |
-
'add_new_item' =>
|
33 |
-
'edit_item' =>
|
34 |
-
'new_item' =>
|
35 |
-
'view_item' =>
|
36 |
-
'search_items' =>
|
37 |
-
'not_found' =>
|
38 |
-
'not_found_in_trash' =>
|
39 |
];
|
40 |
|
41 |
-
register_post_type(
|
|
|
42 |
[
|
43 |
'labels' => $labels,
|
44 |
'public' => false,
|
@@ -54,20 +73,19 @@ class PostTypeController {
|
|
54 |
],
|
55 |
'show_in_menu' => true,
|
56 |
'menu_position' => 20,
|
57 |
-
]
|
58 |
-
|
59 |
|
60 |
}
|
61 |
|
62 |
-
|
63 |
/**
|
64 |
-
*
|
|
|
|
|
65 |
*/
|
66 |
public function remove_all_meta_boxes_tgp_sc() {
|
67 |
global $wp_meta_boxes;
|
68 |
-
if ( isset( $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_meta'] )
|
69 |
-
&& $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_sc_preview_meta']
|
70 |
-
&& $wp_meta_boxes[ rtTPG()->post_type ]['side']['low']['rt_plugin_sc_pro_information']
|
71 |
) {
|
72 |
|
73 |
$publishBox = $wp_meta_boxes[ rtTPG()->post_type ]['side']['core']['submitdiv'];
|
@@ -90,4 +108,4 @@ class PostTypeController {
|
|
90 |
}
|
91 |
}
|
92 |
|
93 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Post Type Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers\Admin;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
+
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Post Type Controller class.
|
17 |
+
*/
|
18 |
+
class PostTypeController {
|
19 |
+
/**
|
20 |
+
* Class constructor
|
21 |
+
*/
|
22 |
public function __construct() {
|
23 |
+
add_action( 'init', [ $this, 'register_post_types' ], 1 );
|
24 |
+
add_action( 'admin_init', [ $this, 'the_post_grid_remove_all_meta_box' ], 9999 );
|
25 |
}
|
26 |
|
27 |
+
/**
|
28 |
+
* Remove meta box.
|
29 |
+
*
|
30 |
+
* @return void
|
31 |
+
*/
|
32 |
public function the_post_grid_remove_all_meta_box() {
|
|
|
|
|
|
|
|
|
33 |
if ( get_option( 'rttpg_activation_redirect', false ) ) {
|
34 |
delete_option( 'rttpg_activation_redirect' );
|
35 |
+
wp_safe_redirect( admin_url( 'edit.php?post_type=rttpg&page=rttpg_settings§ion=common-settings' ) );
|
36 |
}
|
37 |
}
|
38 |
|
39 |
+
/**
|
40 |
+
* Register post type
|
41 |
+
*
|
42 |
+
* @return void
|
43 |
+
*/
|
44 |
public function register_post_types() {
|
|
|
|
|
45 |
$labels = [
|
46 |
+
'name' => esc_html__( 'The Post Grid', 'the-post-grid' ),
|
47 |
+
'singular_name' => esc_html__( 'The Post Grid', 'the-post-grid' ),
|
48 |
+
'add_new' => esc_html__( 'Add New Grid', 'the-post-grid' ),
|
49 |
+
'all_items' => esc_html__( 'All Grids', 'the-post-grid' ),
|
50 |
+
'add_new_item' => esc_html__( 'Add New Post Grid', 'the-post-grid' ),
|
51 |
+
'edit_item' => esc_html__( 'Edit Post Grid', 'the-post-grid' ),
|
52 |
+
'new_item' => esc_html__( 'New Post Grid', 'the-post-grid' ),
|
53 |
+
'view_item' => esc_html__( 'View Post Grid', 'the-post-grid' ),
|
54 |
+
'search_items' => esc_html__( 'Search Post Grids', 'the-post-grid' ),
|
55 |
+
'not_found' => esc_html__( 'No Post Grids found', 'the-post-grid' ),
|
56 |
+
'not_found_in_trash' => esc_html__( 'No Post Grids found in Trash', 'the-post-grid' ),
|
57 |
];
|
58 |
|
59 |
+
register_post_type(
|
60 |
+
rtTPG()->post_type,
|
61 |
[
|
62 |
'labels' => $labels,
|
63 |
'public' => false,
|
73 |
],
|
74 |
'show_in_menu' => true,
|
75 |
'menu_position' => 20,
|
76 |
+
]
|
77 |
+
);
|
78 |
|
79 |
}
|
80 |
|
|
|
81 |
/**
|
82 |
+
* Remove meta box
|
83 |
+
*
|
84 |
+
* @return array
|
85 |
*/
|
86 |
public function remove_all_meta_boxes_tgp_sc() {
|
87 |
global $wp_meta_boxes;
|
88 |
+
if ( isset( $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_meta'] ) && $wp_meta_boxes[ rtTPG()->post_type ]['normal']['high']['rttpg_sc_preview_meta'] && $wp_meta_boxes[ rtTPG()->post_type ]['side']['low']['rt_plugin_sc_pro_information']
|
|
|
|
|
89 |
) {
|
90 |
|
91 |
$publishBox = $wp_meta_boxes[ rtTPG()->post_type ]['side']['core']['submitdiv'];
|
108 |
}
|
109 |
}
|
110 |
|
111 |
+
}
|
app/Controllers/Admin/SettingsController.php
CHANGED
@@ -1,75 +1,96 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
namespace RT\ThePostGrid\Controllers\Admin;
|
5 |
|
6 |
-
|
7 |
use RT\ThePostGrid\Helpers\Fns;
|
8 |
|
9 |
-
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
private $sc_tag = 'rt_tpg_scg';
|
12 |
|
|
|
|
|
|
|
|
|
|
|
13 |
public function init() {
|
14 |
-
add_action( 'admin_menu', [
|
15 |
-
add_filter( 'plugin_action_links_' . RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME, [
|
16 |
-
add_action( 'admin_enqueue_scripts', [
|
17 |
-
add_action( 'wp_print_styles', [
|
18 |
add_action( 'admin_footer', [ $this, 'pro_alert_html' ] );
|
19 |
add_action( 'admin_head', [ $this, 'admin_head' ] );
|
20 |
}
|
21 |
|
22 |
/**
|
23 |
-
*
|
24 |
-
* calls your functions into the correct filters
|
25 |
*
|
26 |
* @return void
|
27 |
*/
|
28 |
-
function admin_head() {
|
29 |
-
// check user permissions
|
30 |
if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
|
31 |
return;
|
32 |
}
|
33 |
-
|
34 |
if ( 'true' == get_user_option( 'rich_editing' ) ) {
|
35 |
add_filter( 'mce_external_plugins', [ $this, 'mce_external_plugins' ] );
|
36 |
add_filter( 'mce_buttons', [ $this, 'mce_buttons' ] );
|
37 |
-
echo
|
38 |
-
echo
|
39 |
-
echo "background: url('" . rtTPG()->get_assets_uri( 'images/icon-20x20.png' ) . "');";
|
40 |
-
echo
|
41 |
-
echo
|
42 |
}
|
43 |
}
|
44 |
|
45 |
/**
|
46 |
-
*
|
47 |
-
* Adds our tinymce plugin
|
48 |
*
|
49 |
-
* @param
|
50 |
*
|
51 |
* @return array
|
52 |
*/
|
53 |
-
function mce_external_plugins( $plugin_array ) {
|
54 |
$plugin_array[ $this->sc_tag ] = rtTPG()->get_assets_uri( 'js/mce-button.js' );
|
55 |
|
56 |
return $plugin_array;
|
57 |
}
|
58 |
|
59 |
/**
|
60 |
-
*
|
61 |
-
* Adds our tinymce button
|
62 |
*
|
63 |
-
* @param
|
64 |
*
|
65 |
* @return array
|
66 |
*/
|
67 |
-
function mce_buttons( $buttons ) {
|
68 |
array_push( $buttons, $this->sc_tag );
|
69 |
|
70 |
return $buttons;
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
73 |
public function pro_alert_html() {
|
74 |
global $typenow;
|
75 |
|
@@ -77,24 +98,29 @@ class SettingsController {
|
|
77 |
return;
|
78 |
}
|
79 |
|
80 |
-
if ( ( isset( $_GET['page'] ) && $_GET['page']
|
81 |
return;
|
82 |
}
|
83 |
|
84 |
-
$html
|
85 |
$html .= '<div class="rt-document-box rt-alert rt-pro-alert">
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
}
|
97 |
|
|
|
|
|
|
|
|
|
|
|
98 |
public function tpg_dequeue_unnecessary_styles() {
|
99 |
$settings = get_option( rtTPG()->options['settings'] );
|
100 |
|
@@ -104,70 +130,98 @@ class SettingsController {
|
|
104 |
}
|
105 |
}
|
106 |
|
|
|
|
|
|
|
|
|
|
|
107 |
public function settings_admin_enqueue_scripts() {
|
108 |
global $pagenow, $typenow;
|
109 |
|
110 |
-
|
111 |
-
if ( ! in_array( $pagenow, [ 'edit.php' ] ) ) {
|
112 |
return;
|
113 |
}
|
114 |
-
if (
|
115 |
return;
|
116 |
}
|
117 |
|
118 |
wp_enqueue_script( 'jquery' );
|
119 |
wp_enqueue_script( 'rt-tpg-admin' );
|
120 |
|
121 |
-
// styles
|
122 |
wp_enqueue_style( 'rt-tpg-admin' );
|
123 |
|
124 |
$nonce = wp_create_nonce( rtTPG()->nonceText() );
|
125 |
-
|
|
|
|
|
126 |
'rttpg',
|
127 |
[
|
128 |
-
'nonceID' => rtTPG()->nonceId(),
|
129 |
-
'nonce' => $nonce,
|
130 |
-
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
131 |
-
]
|
|
|
132 |
}
|
133 |
|
134 |
-
|
135 |
-
|
136 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
if ( ! rtTPG()->hasPro() ) {
|
138 |
-
$links[] = '<a target="_blank" style="color: #39b54a;font-weight: 700;" href="' . esc_url(
|
139 |
-
. '">Get Pro</a>';
|
140 |
}
|
141 |
|
142 |
return $links;
|
143 |
}
|
144 |
|
|
|
|
|
|
|
|
|
|
|
145 |
public function register() {
|
146 |
add_submenu_page(
|
147 |
'edit.php?post_type=' . rtTPG()->post_type,
|
148 |
-
|
149 |
-
|
150 |
'administrator',
|
151 |
'rttpg_settings',
|
152 |
-
[
|
|
|
153 |
|
154 |
-
add_submenu_page(
|
155 |
-
|
156 |
-
|
|
|
157 |
'administrator',
|
158 |
'rttpg_get_help',
|
159 |
-
[
|
160 |
-
|
161 |
-
'get_help',
|
162 |
-
] );
|
163 |
}
|
164 |
|
165 |
-
|
166 |
-
|
|
|
|
|
|
|
|
|
|
|
167 |
}
|
168 |
|
|
|
|
|
|
|
|
|
|
|
169 |
public function settings() {
|
170 |
Fns::view( 'settings.settings' );
|
171 |
}
|
172 |
|
173 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Settings Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers\Admin;
|
9 |
|
|
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
|
12 |
+
// Do not allow directly accessing this file.
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit( 'This script cannot be accessed directly.' );
|
15 |
+
}
|
16 |
|
17 |
+
/**
|
18 |
+
* Settings Controller class.
|
19 |
+
*/
|
20 |
+
class SettingsController {
|
21 |
+
/**
|
22 |
+
* Shortcode tag
|
23 |
+
*
|
24 |
+
* @var string
|
25 |
+
*/
|
26 |
private $sc_tag = 'rt_tpg_scg';
|
27 |
|
28 |
+
/**
|
29 |
+
* Class init.
|
30 |
+
*
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
public function init() {
|
34 |
+
add_action( 'admin_menu', [ $this, 'register' ] );
|
35 |
+
add_filter( 'plugin_action_links_' . RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME, [ $this, 'marketing' ] );
|
36 |
+
add_action( 'admin_enqueue_scripts', [ $this, 'settings_admin_enqueue_scripts' ] );
|
37 |
+
add_action( 'wp_print_styles', [ $this, 'tpg_dequeue_unnecessary_styles' ], 99 );
|
38 |
add_action( 'admin_footer', [ $this, 'pro_alert_html' ] );
|
39 |
add_action( 'admin_head', [ $this, 'admin_head' ] );
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
+
* Calls functions into the correct filters
|
|
|
44 |
*
|
45 |
* @return void
|
46 |
*/
|
47 |
+
public function admin_head() {
|
|
|
48 |
if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
|
49 |
return;
|
50 |
}
|
51 |
+
|
52 |
if ( 'true' == get_user_option( 'rich_editing' ) ) {
|
53 |
add_filter( 'mce_external_plugins', [ $this, 'mce_external_plugins' ] );
|
54 |
add_filter( 'mce_buttons', [ $this, 'mce_buttons' ] );
|
55 |
+
echo '<style>';
|
56 |
+
echo 'i.mce-i-rt_tpg_scg{';
|
57 |
+
echo "background: url('" . esc_url( rtTPG()->get_assets_uri( 'images/icon-20x20.png' ) ) . "');";
|
58 |
+
echo '}';
|
59 |
+
echo '</style>';
|
60 |
}
|
61 |
}
|
62 |
|
63 |
/**
|
64 |
+
* Adds tinymce plugin
|
|
|
65 |
*
|
66 |
+
* @param array $plugin_array Plugins.
|
67 |
*
|
68 |
* @return array
|
69 |
*/
|
70 |
+
public function mce_external_plugins( $plugin_array ) {
|
71 |
$plugin_array[ $this->sc_tag ] = rtTPG()->get_assets_uri( 'js/mce-button.js' );
|
72 |
|
73 |
return $plugin_array;
|
74 |
}
|
75 |
|
76 |
/**
|
77 |
+
* Adds tinymce button
|
|
|
78 |
*
|
79 |
+
* @param array $buttons Buttons.
|
80 |
*
|
81 |
* @return array
|
82 |
*/
|
83 |
+
public function mce_buttons( $buttons ) {
|
84 |
array_push( $buttons, $this->sc_tag );
|
85 |
|
86 |
return $buttons;
|
87 |
}
|
88 |
|
89 |
+
/**
|
90 |
+
* Pro alert
|
91 |
+
*
|
92 |
+
* @return void
|
93 |
+
*/
|
94 |
public function pro_alert_html() {
|
95 |
global $typenow;
|
96 |
|
98 |
return;
|
99 |
}
|
100 |
|
101 |
+
if ( ( isset( $_GET['page'] ) && 'rttpg_settings' !== $_GET['page'] ) || rtTPG()->post_type !== $typenow ) {
|
102 |
return;
|
103 |
}
|
104 |
|
105 |
+
$html = '';
|
106 |
$html .= '<div class="rt-document-box rt-alert rt-pro-alert">
|
107 |
+
<div class="rt-box-icon"><i class="dashicons dashicons-lock"></i></div>
|
108 |
+
<div class="rt-box-content">
|
109 |
+
<h3 class="rt-box-title">' . esc_html__( 'Pro field alert!', 'the-post-grid' ) . '</h3>
|
110 |
+
<p><span></span>' . esc_html__( 'Sorry! this is a Pro field. To use this field, you need to use Pro plugin.', 'the-post-grid' ) . '</p>
|
111 |
+
<a href="' . esc_url( rtTpg()->proLink() ) . '" target="_blank" class="rt-admin-btn">' . esc_html__( 'Upgrade to Pro', 'the-post-grid' ) . '</a>
|
112 |
+
<a href="#" target="_blank" class="rt-alert-close rt-pro-alert-close">x</a>
|
113 |
+
</div>
|
114 |
+
</div>';
|
115 |
+
|
116 |
+
Fns::print_html( $html );
|
117 |
}
|
118 |
|
119 |
+
/**
|
120 |
+
* Dequeue styles
|
121 |
+
*
|
122 |
+
* @return void
|
123 |
+
*/
|
124 |
public function tpg_dequeue_unnecessary_styles() {
|
125 |
$settings = get_option( rtTPG()->options['settings'] );
|
126 |
|
130 |
}
|
131 |
}
|
132 |
|
133 |
+
/**
|
134 |
+
* Admin scripts
|
135 |
+
*
|
136 |
+
* @return void
|
137 |
+
*/
|
138 |
public function settings_admin_enqueue_scripts() {
|
139 |
global $pagenow, $typenow;
|
140 |
|
141 |
+
if ( ! in_array( $pagenow, [ 'edit.php' ], true ) ) {
|
|
|
142 |
return;
|
143 |
}
|
144 |
+
if ( rtTPG()->post_type !== $typenow ) {
|
145 |
return;
|
146 |
}
|
147 |
|
148 |
wp_enqueue_script( 'jquery' );
|
149 |
wp_enqueue_script( 'rt-tpg-admin' );
|
150 |
|
151 |
+
// styles.
|
152 |
wp_enqueue_style( 'rt-tpg-admin' );
|
153 |
|
154 |
$nonce = wp_create_nonce( rtTPG()->nonceText() );
|
155 |
+
|
156 |
+
wp_localize_script(
|
157 |
+
'rt-tpg-admin',
|
158 |
'rttpg',
|
159 |
[
|
160 |
+
'nonceID' => esc_attr( rtTPG()->nonceId() ),
|
161 |
+
'nonce' => esc_attr( $nonce ),
|
162 |
+
'ajaxurl' => esc_url( admin_url( 'admin-ajax.php' ) ),
|
163 |
+
]
|
164 |
+
);
|
165 |
}
|
166 |
|
167 |
+
/**
|
168 |
+
* Marketing
|
169 |
+
*
|
170 |
+
* @param array $links Links.
|
171 |
+
* @return array
|
172 |
+
*/
|
173 |
+
public function marketing( $links ) {
|
174 |
+
$links[] = '<a target="_blank" href="' . esc_url( rtTpg()->demoLink() ) . '">Demo</a>';
|
175 |
+
$links[] = '<a target="_blank" href="' . esc_url( rtTpg()->docLink() ) . '">Documentation</a>';
|
176 |
+
|
177 |
if ( ! rtTPG()->hasPro() ) {
|
178 |
+
$links[] = '<a target="_blank" style="color: #39b54a;font-weight: 700;" href="' . esc_url( rtTpg()->proLink() ) . '">Get Pro</a>';
|
|
|
179 |
}
|
180 |
|
181 |
return $links;
|
182 |
}
|
183 |
|
184 |
+
/**
|
185 |
+
* Submenu
|
186 |
+
*
|
187 |
+
* @return void
|
188 |
+
*/
|
189 |
public function register() {
|
190 |
add_submenu_page(
|
191 |
'edit.php?post_type=' . rtTPG()->post_type,
|
192 |
+
esc_html__( 'Settings', 'the-post-grid' ),
|
193 |
+
esc_html__( 'Settings', 'the-post-grid' ),
|
194 |
'administrator',
|
195 |
'rttpg_settings',
|
196 |
+
[ $this, 'settings' ]
|
197 |
+
);
|
198 |
|
199 |
+
add_submenu_page(
|
200 |
+
'edit.php?post_type=' . rtTPG()->post_type,
|
201 |
+
esc_html__( 'Get Help', 'the-post-grid' ),
|
202 |
+
esc_html__( 'Get Help', 'the-post-grid' ),
|
203 |
'administrator',
|
204 |
'rttpg_get_help',
|
205 |
+
[ $this, 'get_help' ]
|
206 |
+
);
|
|
|
|
|
207 |
}
|
208 |
|
209 |
+
/**
|
210 |
+
* Get help view
|
211 |
+
*
|
212 |
+
* @return void
|
213 |
+
*/
|
214 |
+
public function get_help() {
|
215 |
+
Fns::view( 'page.help' );
|
216 |
}
|
217 |
|
218 |
+
/**
|
219 |
+
* Settings view
|
220 |
+
*
|
221 |
+
* @return void
|
222 |
+
*/
|
223 |
public function settings() {
|
224 |
Fns::view( 'settings.settings' );
|
225 |
}
|
226 |
|
227 |
+
}
|
app/Controllers/Admin/UpgradeController.php
CHANGED
@@ -1,21 +1,48 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Controllers\Admin;
|
4 |
|
5 |
-
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
public static $compare_version;
|
8 |
|
|
|
|
|
|
|
9 |
public function __construct() {
|
10 |
self::$compare_version = '5.1.0';
|
|
|
11 |
if ( ! self::check_plugin_version() ) {
|
12 |
add_filter( 'plugin_row_meta', [ $this, 'show_update_notification' ], 10, 2 );
|
13 |
$this->version_notice();
|
14 |
}
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
|
|
17 |
public static function check_plugin_version() {
|
18 |
$tpg_version = self::get_pro_plugin_info( 'Version' );
|
|
|
19 |
if ( version_compare( $tpg_version, self::$compare_version, '<' ) ) {
|
20 |
return false;
|
21 |
}
|
@@ -23,32 +50,41 @@ class UpgradeController {
|
|
23 |
return true;
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
26 |
public function version_notice() {
|
27 |
if ( class_exists( 'RtTpgPro' ) || class_exists( 'rtTPGP' ) ) {
|
28 |
-
add_action(
|
|
|
29 |
function () {
|
30 |
$class = 'notice notice-error';
|
31 |
$text = esc_html__( 'The Post Grid Pro', 'the-post-grid' );
|
32 |
$link_pro = 'https://www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/';
|
33 |
|
34 |
-
printf(
|
35 |
-
$
|
36 |
-
$
|
37 |
-
$
|
38 |
-
|
|
|
|
|
|
|
39 |
}
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
* Get TPG Pro Plugin Info
|
44 |
*
|
45 |
-
* @param $parameter
|
46 |
*
|
47 |
* @return string
|
48 |
*/
|
49 |
-
public static function get_pro_plugin_info( $parameter )
|
50 |
if ( ! function_exists( 'get_plugin_data' ) ) {
|
51 |
-
require_once
|
52 |
}
|
53 |
|
54 |
$tpg_free_path = WP_PLUGIN_DIR . '/the-post-grid-pro/the-post-grid-pro.php';
|
@@ -64,6 +100,13 @@ class UpgradeController {
|
|
64 |
return '';
|
65 |
}
|
66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
public function show_update_notification( $links, $file ) {
|
68 |
if ( $file == 'the-post-grid-pro/the-post-grid-pro.php' ) {
|
69 |
$row_meta['tpg_update'] = '<span style="color: red">The Plugin is not compatible with the post grid free. Please update the plugin to ' . self::$compare_version . ' or more otherwise it will not activate.</span>';
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Upgrade Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers\Admin;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
+
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Upgrade Controller class.
|
17 |
+
*/
|
18 |
+
class UpgradeController {
|
19 |
+
/**
|
20 |
+
* Version compare
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
public static $compare_version;
|
25 |
|
26 |
+
/**
|
27 |
+
* Class constructor
|
28 |
+
*/
|
29 |
public function __construct() {
|
30 |
self::$compare_version = '5.1.0';
|
31 |
+
|
32 |
if ( ! self::check_plugin_version() ) {
|
33 |
add_filter( 'plugin_row_meta', [ $this, 'show_update_notification' ], 10, 2 );
|
34 |
$this->version_notice();
|
35 |
}
|
36 |
}
|
37 |
|
38 |
+
/**
|
39 |
+
* Plugin version check
|
40 |
+
*
|
41 |
+
* @return bool
|
42 |
+
*/
|
43 |
public static function check_plugin_version() {
|
44 |
$tpg_version = self::get_pro_plugin_info( 'Version' );
|
45 |
+
|
46 |
if ( version_compare( $tpg_version, self::$compare_version, '<' ) ) {
|
47 |
return false;
|
48 |
}
|
50 |
return true;
|
51 |
}
|
52 |
|
53 |
+
/**
|
54 |
+
* Notice
|
55 |
+
*
|
56 |
+
* @return void
|
57 |
+
*/
|
58 |
public function version_notice() {
|
59 |
if ( class_exists( 'RtTpgPro' ) || class_exists( 'rtTPGP' ) ) {
|
60 |
+
add_action(
|
61 |
+
'admin_notices',
|
62 |
function () {
|
63 |
$class = 'notice notice-error';
|
64 |
$text = esc_html__( 'The Post Grid Pro', 'the-post-grid' );
|
65 |
$link_pro = 'https://www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/';
|
66 |
|
67 |
+
printf(
|
68 |
+
'<div class="%1$s"><p><a target="_blank" href="%2$s"><strong>The Post Grid Pro</strong></a> is not working properly, You need to update <strong>%3$s</strong> version to 5.1.0 or more to get the pro features.</p></div>',
|
69 |
+
esc_attr( $class ),
|
70 |
+
esc_url( $link_pro ),
|
71 |
+
esc_html( $text )
|
72 |
+
);
|
73 |
+
}
|
74 |
+
);
|
75 |
}
|
76 |
}
|
77 |
|
78 |
/**
|
79 |
* Get TPG Pro Plugin Info
|
80 |
*
|
81 |
+
* @param string $parameter Parameter.
|
82 |
*
|
83 |
* @return string
|
84 |
*/
|
85 |
+
public static function get_pro_plugin_info( $parameter ) {
|
86 |
if ( ! function_exists( 'get_plugin_data' ) ) {
|
87 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
88 |
}
|
89 |
|
90 |
$tpg_free_path = WP_PLUGIN_DIR . '/the-post-grid-pro/the-post-grid-pro.php';
|
100 |
return '';
|
101 |
}
|
102 |
|
103 |
+
/**
|
104 |
+
* Notification
|
105 |
+
*
|
106 |
+
* @param array $links Link.
|
107 |
+
* @param string $file File.
|
108 |
+
* @return array
|
109 |
+
*/
|
110 |
public function show_update_notification( $links, $file ) {
|
111 |
if ( $file == 'the-post-grid-pro/the-post-grid-pro.php' ) {
|
112 |
$row_meta['tpg_update'] = '<span style="color: red">The Plugin is not compatible with the post grid free. Please update the plugin to ' . self::$compare_version . ' or more otherwise it will not activate.</span>';
|
app/Controllers/AjaxController.php
CHANGED
@@ -1,228 +1,320 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Controllers;
|
4 |
|
5 |
use RT\ThePostGrid\Helpers\Fns;
|
6 |
use RT\ThePostGrid\Helpers\Options;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
class AjaxController {
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
add_action( '
|
14 |
-
add_action( '
|
15 |
-
add_action( '
|
16 |
-
add_action( '
|
|
|
|
|
|
|
17 |
}
|
18 |
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
$error = true;
|
22 |
$data = $msg = null;
|
|
|
23 |
if ( Fns::verifyNonce() ) {
|
24 |
-
$fields =
|
25 |
-
$post_type =
|
|
|
26 |
if ( $cf = Fns::is_acf() && $post_type ) {
|
27 |
-
$fields['cf_group'] =
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
$error = false;
|
38 |
$data = Fns::rtFieldGenerator( $fields );
|
39 |
}
|
40 |
} else {
|
41 |
-
$msg =
|
42 |
}
|
43 |
-
|
|
|
44 |
'error' => $error,
|
45 |
'msg' => $msg,
|
46 |
-
'data' => $data
|
47 |
-
|
|
|
48 |
wp_send_json( $response );
|
49 |
die();
|
50 |
}
|
51 |
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
54 |
$error = true;
|
55 |
$data = $msg = null;
|
|
|
56 |
if ( Fns::verifyNonce() ) {
|
57 |
-
|
|
|
|
|
|
|
58 |
$include = [];
|
59 |
-
|
|
|
60 |
$include = explode( ',', $term );
|
61 |
}
|
|
|
62 |
$error = false;
|
63 |
-
$msg =
|
64 |
-
$data
|
65 |
$items = Fns::rt_get_selected_term_by_taxonomy( $filter, $include, '', 0 );
|
|
|
66 |
if ( ! empty( $items ) ) {
|
67 |
foreach ( $items as $id => $item ) {
|
68 |
-
$data .=
|
69 |
}
|
70 |
}
|
71 |
}
|
72 |
} else {
|
73 |
-
$msg =
|
74 |
}
|
75 |
-
$response =
|
76 |
'error' => $error,
|
77 |
'msg' => $msg,
|
78 |
-
'data' => $data
|
79 |
-
|
|
|
80 |
wp_send_json( $response );
|
81 |
die();
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
|
|
|
|
|
|
|
|
|
86 |
$error = true;
|
|
|
87 |
if ( Fns::verifyNonce() ) {
|
88 |
unset( $_REQUEST['action'] );
|
89 |
unset( $_REQUEST[ rtTPG()->nonceId() ] );
|
90 |
unset( $_REQUEST['_wp_http_referer'] );
|
91 |
|
92 |
-
update_option( rtTPG()->options['settings'], $_REQUEST );
|
93 |
-
|
|
|
94 |
'error' => false,
|
95 |
-
'msg' =>
|
96 |
-
|
97 |
} else {
|
98 |
-
$response =
|
99 |
'error' => $error,
|
100 |
-
'msg' =>
|
101 |
-
|
102 |
}
|
|
|
103 |
wp_send_json( $response );
|
104 |
die();
|
105 |
}
|
106 |
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
109 |
$error = true;
|
110 |
$msg = $data = null;
|
|
|
111 |
if ( Fns::verifyNonce() ) {
|
112 |
$error = false;
|
113 |
-
$taxonomies = Fns::rt_get_all_taxonomy_by_post_type(
|
|
|
114 |
if ( is_array( $taxonomies ) && ! empty( $taxonomies ) ) {
|
115 |
$data .= Fns::rtFieldGenerator(
|
116 |
-
|
117 |
-
'tpg_taxonomy' =>
|
118 |
'type' => 'checkbox',
|
119 |
-
'label' => 'Taxonomy',
|
120 |
'id' => 'post-taxonomy',
|
121 |
-
|
122 |
-
|
123 |
-
'options' => $taxonomies
|
124 |
-
|
125 |
-
|
126 |
);
|
127 |
} else {
|
128 |
-
$data =
|
129 |
}
|
130 |
-
|
131 |
} else {
|
132 |
-
$msg =
|
133 |
}
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
die();
|
136 |
}
|
137 |
|
138 |
-
|
139 |
-
|
|
|
|
|
|
|
|
|
140 |
$error = true;
|
141 |
$msg = $data = null;
|
|
|
142 |
if ( Fns::verifyNonce() ) {
|
143 |
$error = false;
|
144 |
-
$
|
|
|
|
|
145 |
if ( is_array( $taxonomies ) && ! empty( $taxonomies ) ) {
|
146 |
foreach ( $taxonomies as $tKey => $tax ) {
|
147 |
-
$data .=
|
148 |
}
|
149 |
}
|
150 |
} else {
|
151 |
-
$msg =
|
152 |
}
|
153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
die();
|
155 |
}
|
156 |
|
157 |
-
|
158 |
-
|
|
|
|
|
|
|
|
|
159 |
$error = true;
|
160 |
$msg = $data = null;
|
|
|
161 |
if ( Fns::verifyNonce() ) {
|
162 |
$error = false;
|
163 |
-
$taxonomy = isset( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : null;
|
164 |
-
|
165 |
-
$data
|
166 |
-
|
167 |
-
|
|
|
168 |
'type' => 'select',
|
169 |
'label' => ucfirst( str_replace( '_', ' ', $taxonomy ) ),
|
170 |
'class' => 'rt-select2 full',
|
171 |
-
'id' => 'term-' .
|
172 |
'holderClass' => "term-filter-item {$taxonomy}",
|
173 |
'value' => null,
|
174 |
-
|
175 |
-
'options' => Fns::rt_get_all_term_by_taxonomy( $taxonomy )
|
176 |
-
|
177 |
-
|
178 |
);
|
179 |
-
$data
|
180 |
-
|
181 |
-
'term_operator_' . $taxonomy =>
|
182 |
'type' => 'select',
|
183 |
-
'label' => 'Operator',
|
184 |
'class' => 'rt-select2 full',
|
185 |
'holderClass' => "term-filter-item-operator {$taxonomy}",
|
186 |
-
'options' => Options::rtTermOperators()
|
187 |
-
|
188 |
-
|
189 |
);
|
190 |
-
$data
|
191 |
} else {
|
192 |
-
$msg =
|
193 |
}
|
194 |
-
wp_send_json(
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
die();
|
196 |
}
|
197 |
|
198 |
-
|
|
|
|
|
|
|
|
|
|
|
199 |
$html = null;
|
200 |
-
$scQ = new \WP_Query(
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
|
|
|
|
|
|
|
|
206 |
)
|
207 |
-
)
|
208 |
if ( $scQ->have_posts() ) {
|
209 |
-
|
210 |
$html .= "<div class='mce-container mce-form'>";
|
211 |
$html .= "<div class='mce-container-body'>";
|
212 |
-
$html .= '<label class="mce-widget mce-label" style="padding: 20px;font-weight: bold;" for="scid">' .
|
213 |
$html .= "<select name='id' id='scid' style='width: 150px;margin: 15px;'>";
|
214 |
-
$html .= "<option value=''>" .
|
|
|
215 |
while ( $scQ->have_posts() ) {
|
216 |
$scQ->the_post();
|
217 |
-
$html .= "<option value='" . get_the_ID() . "'>" . get_the_title() .
|
218 |
}
|
219 |
-
|
220 |
-
$html .=
|
221 |
-
$html .=
|
|
|
222 |
} else {
|
223 |
-
$html .=
|
224 |
}
|
225 |
-
|
|
|
226 |
die();
|
227 |
}
|
228 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Ajax Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers;
|
9 |
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
use RT\ThePostGrid\Helpers\Options;
|
12 |
|
13 |
+
// Do not allow directly accessing this file.
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit( 'This script cannot be accessed directly.' );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Ajax Controller class.
|
20 |
+
*/
|
21 |
class AjaxController {
|
22 |
+
/**
|
23 |
+
* Class constructor
|
24 |
+
*/
|
25 |
+
public function __construct() {
|
26 |
+
add_action( 'wp_ajax_rtTPGSettings', [ $this, 'rtTPGSaveSettings' ] );
|
27 |
+
add_action( 'wp_ajax_rtTPGShortCodeList', [ $this, 'shortCodeList' ] );
|
28 |
+
add_action( 'wp_ajax_rtTPGTaxonomyListByPostType', [ $this, 'rtTPGTaxonomyListByPostType' ] );
|
29 |
+
add_action( 'wp_ajax_rtTPGIsotopeFilter', [ $this, 'rtTPGIsotopeFilter' ] );
|
30 |
+
add_action( 'wp_ajax_rtTPGTermListByTaxonomy', [ $this, 'rtTPGTermListByTaxonomy' ] );
|
31 |
+
add_action( 'wp_ajax_defaultFilterItem', [ $this, 'defaultFilterItem' ] );
|
32 |
+
add_action( 'wp_ajax_getCfGroupListAsField', [ $this, 'getCfGroupListAsField' ] );
|
33 |
}
|
34 |
|
35 |
+
/**
|
36 |
+
* Render
|
37 |
+
*
|
38 |
+
* @return void
|
39 |
+
*/
|
40 |
+
public function getCfGroupListAsField() {
|
41 |
$error = true;
|
42 |
$data = $msg = null;
|
43 |
+
|
44 |
if ( Fns::verifyNonce() ) {
|
45 |
+
$fields = [];
|
46 |
+
$post_type = isset( $_REQUEST['post_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post_type'] ) ) : null;
|
47 |
+
|
48 |
if ( $cf = Fns::is_acf() && $post_type ) {
|
49 |
+
$fields['cf_group'] = [
|
50 |
+
'type' => 'checkbox',
|
51 |
+
'name' => 'cf_group',
|
52 |
+
'holderClass' => 'tpg-hidden cf-fields cf-group',
|
53 |
+
'label' => esc_html__( 'Custom Field group', 'the-post-grid' ),
|
54 |
+
'multiple' => true,
|
55 |
+
'alignment' => 'vertical',
|
56 |
+
'id' => 'cf_group',
|
57 |
+
'options' => Fns::get_groups_by_post_type( $post_type, $cf ),
|
58 |
+
];
|
59 |
$error = false;
|
60 |
$data = Fns::rtFieldGenerator( $fields );
|
61 |
}
|
62 |
} else {
|
63 |
+
$msg = esc_html__( 'Server Error !!', 'the-post-grid' );
|
64 |
}
|
65 |
+
|
66 |
+
$response = [
|
67 |
'error' => $error,
|
68 |
'msg' => $msg,
|
69 |
+
'data' => $data,
|
70 |
+
];
|
71 |
+
|
72 |
wp_send_json( $response );
|
73 |
die();
|
74 |
}
|
75 |
|
76 |
+
/**
|
77 |
+
* Default filter.
|
78 |
+
*
|
79 |
+
* @return void
|
80 |
+
*/
|
81 |
+
public function defaultFilterItem() {
|
82 |
$error = true;
|
83 |
$data = $msg = null;
|
84 |
+
|
85 |
if ( Fns::verifyNonce() ) {
|
86 |
+
$filter = isset( $_REQUEST['filter'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['filter'] ) ) : null;
|
87 |
+
$term = isset( $_REQUEST['include'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['include'] ) ) : null;
|
88 |
+
|
89 |
+
if ( ! empty( $filter ) ) {
|
90 |
$include = [];
|
91 |
+
|
92 |
+
if ( ! empty( $term ) ) {
|
93 |
$include = explode( ',', $term );
|
94 |
}
|
95 |
+
|
96 |
$error = false;
|
97 |
+
$msg = esc_html__( 'Success', 'the-post-grid' );
|
98 |
+
$data .= "<option value=''>" . esc_html__( 'Show All', 'the-post-grid' ) . '</option>';
|
99 |
$items = Fns::rt_get_selected_term_by_taxonomy( $filter, $include, '', 0 );
|
100 |
+
|
101 |
if ( ! empty( $items ) ) {
|
102 |
foreach ( $items as $id => $item ) {
|
103 |
+
$data .= '<option value="' . absint( $id ) . '">' . esc_html( $item ) . '</option>';
|
104 |
}
|
105 |
}
|
106 |
}
|
107 |
} else {
|
108 |
+
$msg = esc_html__( 'Session Error !!', 'the-post-grid' );
|
109 |
}
|
110 |
+
$response = [
|
111 |
'error' => $error,
|
112 |
'msg' => $msg,
|
113 |
+
'data' => $data,
|
114 |
+
];
|
115 |
+
|
116 |
wp_send_json( $response );
|
117 |
die();
|
118 |
}
|
119 |
|
120 |
+
/**
|
121 |
+
* Save settings.
|
122 |
+
*
|
123 |
+
* @return void
|
124 |
+
*/
|
125 |
+
public function rtTPGSaveSettings() {
|
126 |
$error = true;
|
127 |
+
|
128 |
if ( Fns::verifyNonce() ) {
|
129 |
unset( $_REQUEST['action'] );
|
130 |
unset( $_REQUEST[ rtTPG()->nonceId() ] );
|
131 |
unset( $_REQUEST['_wp_http_referer'] );
|
132 |
|
133 |
+
update_option( rtTPG()->options['settings'], wp_unslash( $_REQUEST ) );
|
134 |
+
|
135 |
+
$response = [
|
136 |
'error' => false,
|
137 |
+
'msg' => esc_html__( 'Settings successfully updated', 'the-post-grid' ),
|
138 |
+
];
|
139 |
} else {
|
140 |
+
$response = [
|
141 |
'error' => $error,
|
142 |
+
'msg' => esc_html__( 'Session Error !!', 'the-post-grid' ),
|
143 |
+
];
|
144 |
}
|
145 |
+
|
146 |
wp_send_json( $response );
|
147 |
die();
|
148 |
}
|
149 |
|
150 |
+
/**
|
151 |
+
* Taxonomy list.
|
152 |
+
*
|
153 |
+
* @return void
|
154 |
+
*/
|
155 |
+
public function rtTPGTaxonomyListByPostType() {
|
156 |
$error = true;
|
157 |
$msg = $data = null;
|
158 |
+
|
159 |
if ( Fns::verifyNonce() ) {
|
160 |
$error = false;
|
161 |
+
$taxonomies = Fns::rt_get_all_taxonomy_by_post_type( $_REQUEST['post_type'] );
|
162 |
+
|
163 |
if ( is_array( $taxonomies ) && ! empty( $taxonomies ) ) {
|
164 |
$data .= Fns::rtFieldGenerator(
|
165 |
+
[
|
166 |
+
'tpg_taxonomy' => [
|
167 |
'type' => 'checkbox',
|
168 |
+
'label' => esc_html__( 'Taxonomy', 'the-post-grid' ),
|
169 |
'id' => 'post-taxonomy',
|
170 |
+
'multiple' => true,
|
171 |
+
'value' => isset( $_REQUEST['taxonomy'] ) ? array_map( 'sanitize_text_field', wp_unslash( $_REQUEST['taxonomy'] ) ) : [],
|
172 |
+
'options' => $taxonomies,
|
173 |
+
],
|
174 |
+
]
|
175 |
);
|
176 |
} else {
|
177 |
+
$data = '<div class="field-holder">' . esc_html__( 'No Taxonomy found', 'the-post-grid' ) . '</div>';
|
178 |
}
|
|
|
179 |
} else {
|
180 |
+
$msg = esc_html__( 'Security error', 'the-post-grid' );
|
181 |
}
|
182 |
+
|
183 |
+
wp_send_json(
|
184 |
+
[
|
185 |
+
'error' => $error,
|
186 |
+
'msg' => $msg,
|
187 |
+
'data' => $data,
|
188 |
+
]
|
189 |
+
);
|
190 |
die();
|
191 |
}
|
192 |
|
193 |
+
/**
|
194 |
+
* Isotope Filter
|
195 |
+
*
|
196 |
+
* @return void
|
197 |
+
*/
|
198 |
+
public function rtTPGIsotopeFilter() {
|
199 |
$error = true;
|
200 |
$msg = $data = null;
|
201 |
+
|
202 |
if ( Fns::verifyNonce() ) {
|
203 |
$error = false;
|
204 |
+
$post_type = isset( $_REQUEST['post_type'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post_type'] ) ) : null;
|
205 |
+
$taxonomies = Fns::rt_get_taxonomy_for_filter( $post_type );
|
206 |
+
|
207 |
if ( is_array( $taxonomies ) && ! empty( $taxonomies ) ) {
|
208 |
foreach ( $taxonomies as $tKey => $tax ) {
|
209 |
+
$data .= '<option value="' . absint( $tKey ) . '">' . esc_html( $tax ) . '</option>';
|
210 |
}
|
211 |
}
|
212 |
} else {
|
213 |
+
$msg = esc_html__( 'Security error', 'the-post-grid' );
|
214 |
}
|
215 |
+
|
216 |
+
wp_send_json(
|
217 |
+
[
|
218 |
+
'error' => $error,
|
219 |
+
'msg' => $msg,
|
220 |
+
'data' => $data,
|
221 |
+
]
|
222 |
+
);
|
223 |
die();
|
224 |
}
|
225 |
|
226 |
+
/**
|
227 |
+
* Term list
|
228 |
+
*
|
229 |
+
* @return void
|
230 |
+
*/
|
231 |
+
public function rtTPGTermListByTaxonomy() {
|
232 |
$error = true;
|
233 |
$msg = $data = null;
|
234 |
+
|
235 |
if ( Fns::verifyNonce() ) {
|
236 |
$error = false;
|
237 |
+
$taxonomy = isset( $_REQUEST['taxonomy'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['taxonomy'] ) ) : null;
|
238 |
+
|
239 |
+
$data .= "<div class='term-filter-item-container {$taxonomy}'>";
|
240 |
+
$data .= Fns::rtFieldGenerator(
|
241 |
+
[
|
242 |
+
'term_' . $taxonomy => [
|
243 |
'type' => 'select',
|
244 |
'label' => ucfirst( str_replace( '_', ' ', $taxonomy ) ),
|
245 |
'class' => 'rt-select2 full',
|
246 |
+
'id' => 'term-' . wp_rand(),
|
247 |
'holderClass' => "term-filter-item {$taxonomy}",
|
248 |
'value' => null,
|
249 |
+
'multiple' => true,
|
250 |
+
'options' => Fns::rt_get_all_term_by_taxonomy( $taxonomy ),
|
251 |
+
],
|
252 |
+
]
|
253 |
);
|
254 |
+
$data .= Fns::rtFieldGenerator(
|
255 |
+
[
|
256 |
+
'term_operator_' . $taxonomy => [
|
257 |
'type' => 'select',
|
258 |
+
'label' => esc_html__( 'Operator', 'the-post-grid' ),
|
259 |
'class' => 'rt-select2 full',
|
260 |
'holderClass' => "term-filter-item-operator {$taxonomy}",
|
261 |
+
'options' => Options::rtTermOperators(),
|
262 |
+
],
|
263 |
+
]
|
264 |
);
|
265 |
+
$data .= '</div>';
|
266 |
} else {
|
267 |
+
$msg = esc_html__( 'Security error', 'the-post-grid' );
|
268 |
}
|
269 |
+
wp_send_json(
|
270 |
+
[
|
271 |
+
'error' => $error,
|
272 |
+
'msg' => $msg,
|
273 |
+
'data' => $data,
|
274 |
+
]
|
275 |
+
);
|
276 |
die();
|
277 |
}
|
278 |
|
279 |
+
/**
|
280 |
+
* Shortcode list
|
281 |
+
*
|
282 |
+
* @return void
|
283 |
+
*/
|
284 |
+
public function shortCodeList() {
|
285 |
$html = null;
|
286 |
+
$scQ = new \WP_Query(
|
287 |
+
apply_filters(
|
288 |
+
'tpg_sc_list_query_args',
|
289 |
+
[
|
290 |
+
'post_type' => rtTPG()->post_type,
|
291 |
+
'order_by' => 'title',
|
292 |
+
'order' => 'DESC',
|
293 |
+
'post_status' => 'publish',
|
294 |
+
'posts_per_page' => - 1,
|
295 |
+
]
|
296 |
)
|
297 |
+
);
|
298 |
if ( $scQ->have_posts() ) {
|
|
|
299 |
$html .= "<div class='mce-container mce-form'>";
|
300 |
$html .= "<div class='mce-container-body'>";
|
301 |
+
$html .= '<label class="mce-widget mce-label" style="padding: 20px;font-weight: bold;" for="scid">' . esc_html__( 'Select Short code', 'the-post-grid' ) . '</label>';
|
302 |
$html .= "<select name='id' id='scid' style='width: 150px;margin: 15px;'>";
|
303 |
+
$html .= "<option value=''>" . esc_html__( 'Default', 'the-post-grid' ) . '</option>';
|
304 |
+
|
305 |
while ( $scQ->have_posts() ) {
|
306 |
$scQ->the_post();
|
307 |
+
$html .= "<option value='" . get_the_ID() . "'>" . get_the_title() . '</option>';
|
308 |
}
|
309 |
+
|
310 |
+
$html .= '</select>';
|
311 |
+
$html .= '</div>';
|
312 |
+
$html .= '</div>';
|
313 |
} else {
|
314 |
+
$html .= '<div>' . esc_html__( 'No shortCode found.', 'the-post-grid' ) . '</div>';
|
315 |
}
|
316 |
+
|
317 |
+
Fns::print_html( $html, true );
|
318 |
die();
|
319 |
}
|
320 |
+
}
|
app/Controllers/ElementorController.php
CHANGED
@@ -1,80 +1,110 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Controllers;
|
4 |
|
5 |
-
|
6 |
-
|
|
|
7 |
}
|
8 |
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
class ElementorController {
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
public $el_cat_id;
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
private $version;
|
17 |
|
18 |
-
|
|
|
|
|
|
|
19 |
$this->version = defined( 'WP_DEBUG' ) && WP_DEBUG ? time() : RT_THE_POST_GRID_VERSION;
|
20 |
$this->el_cat_id = RT_THE_POST_GRID_PLUGIN_SLUG . '-elements';
|
21 |
|
22 |
if ( did_action( 'elementor/loaded' ) ) {
|
23 |
add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] );
|
24 |
add_action( 'elementor/elements/categories_registered', [ $this, 'widget_category' ] );
|
25 |
-
//add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'editor_style' ] );
|
26 |
add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'el_editor_script' ] );
|
27 |
add_action( 'wp_footer', [ $this, 'tpg_el_scripts' ] );
|
28 |
add_action( 'wp_enqueue_scripts', [ $this, 'tpg_el_style' ] );
|
29 |
-
//add_action( "elementor/frontend/after_enqueue_scripts", [ $this, 'tpg_frontend_scripts' ] );
|
30 |
add_filter( 'elementor/editor/localize_settings', [ $this, 'promotePremiumWidgets' ] );
|
31 |
}
|
32 |
}
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
public function tpg_el_style() {
|
40 |
-
//Custom CSS From Settings
|
41 |
$css = isset( $settings['custom_css'] ) ? stripslashes( $settings['custom_css'] ) : null;
|
42 |
if ( $css ) {
|
43 |
wp_add_inline_style( 'rt-tpg-elementor', $css );
|
44 |
}
|
45 |
}
|
46 |
|
|
|
|
|
|
|
|
|
|
|
47 |
public function tpg_el_scripts() {
|
48 |
-
|
49 |
$ajaxurl = '';
|
|
|
50 |
if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
|
51 |
$ajaxurl .= admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
|
52 |
} else {
|
53 |
$ajaxurl .= admin_url( 'admin-ajax.php' );
|
54 |
}
|
|
|
55 |
$variables = [
|
56 |
-
'nonceID' => rtTPG()->nonceId(),
|
57 |
-
'nonce' => wp_create_nonce( rtTPG()->nonceText() ),
|
58 |
-
'ajaxurl' => $ajaxurl,
|
59 |
];
|
|
|
60 |
wp_localize_script( 'rt-tpg', 'rttpg', $variables );
|
61 |
}
|
62 |
|
|
|
|
|
|
|
|
|
|
|
63 |
public function el_editor_script() {
|
64 |
wp_enqueue_script( 'tgp-el-editor-scripts', rtTPG()->get_assets_uri( 'js/tpg-el-editor.js' ), [ 'jquery' ], $this->version, true );
|
65 |
wp_enqueue_style( 'tgp-el-editor-style', rtTPG()->get_assets_uri( 'css/admin/tpg-el-editor.css' ), [], $this->version );
|
66 |
}
|
67 |
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
73 |
public function init_widgets( $widgets_manager ) {
|
74 |
-
require_once
|
75 |
-
require_once
|
76 |
|
77 |
-
// dir_name => class_name
|
78 |
$widgets = [
|
79 |
'grid-layout' => '\TPGGridLayout',
|
80 |
'list-layout' => '\TPGListLayout',
|
@@ -86,10 +116,12 @@ if ( ! class_exists( 'ElementorController' ) ):
|
|
86 |
$widgets = apply_filters( 'tpg_el_widget_register', $widgets );
|
87 |
|
88 |
foreach ( $widgets as $file_name => $class ) {
|
89 |
-
if ( ! rtTPG()->hasPro() && 'slider-layout'
|
90 |
continue;
|
91 |
}
|
|
|
92 |
$template_name = 'the-post-grid/elementor/' . $file_name . '.php';
|
|
|
93 |
if ( file_exists( STYLESHEETPATH . $template_name ) ) {
|
94 |
$file = STYLESHEETPATH . $template_name;
|
95 |
} elseif ( file_exists( TEMPLATEPATH . $template_name ) ) {
|
@@ -97,20 +129,27 @@ if ( ! class_exists( 'ElementorController' ) ):
|
|
97 |
} else {
|
98 |
$file = RT_THE_POST_GRID_PLUGIN_PATH . '/app/Widgets/elementor/widgets/' . $file_name . '.php';
|
99 |
}
|
|
|
100 |
require_once $file;
|
101 |
|
102 |
-
$widgets_manager->register( new $class );
|
103 |
}
|
104 |
}
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
public function widget_category( $elements_manager ) {
|
107 |
$categories['tpg-elementor-builder-widgets'] = [
|
108 |
-
'title' =>
|
109 |
'icon' => 'fa fa-plug',
|
110 |
];
|
111 |
|
112 |
$categories[ RT_THE_POST_GRID_PLUGIN_SLUG . '-elements' ] = [
|
113 |
-
'title' =>
|
114 |
'icon' => 'fa fa-plug',
|
115 |
];
|
116 |
|
@@ -123,7 +162,12 @@ if ( ! class_exists( 'ElementorController' ) ):
|
|
123 |
$set_categories->call( $elements_manager, $categories );
|
124 |
}
|
125 |
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
127 |
public function promotePremiumWidgets( $config ) {
|
128 |
if ( rtTPG()->hasPro() ) {
|
129 |
return $config;
|
@@ -133,13 +177,11 @@ if ( ! class_exists( 'ElementorController' ) ):
|
|
133 |
$config['promotionWidgets'] = [];
|
134 |
}
|
135 |
|
136 |
-
$category = RT_THE_POST_GRID_PLUGIN_SLUG . '-elements';
|
137 |
-
|
138 |
$pro_widgets = [
|
139 |
[
|
140 |
'name' => 'tpg-slider-layout',
|
141 |
-
'title' =>
|
142 |
-
'description' =>
|
143 |
'icon' => 'eicon-post-slider tpg-grid-icon tss-promotional-element',
|
144 |
'categories' => '[ "the-post-grid-elements" ]',
|
145 |
],
|
@@ -149,8 +191,5 @@ if ( ! class_exists( 'ElementorController' ) ):
|
|
149 |
|
150 |
return $config;
|
151 |
}
|
152 |
-
|
153 |
-
|
154 |
}
|
155 |
-
|
156 |
-
endif;
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Elementor Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
if ( ! class_exists( 'ElementorController' ) ) :
|
16 |
+
/**
|
17 |
+
* Elementor Controller class.
|
18 |
+
*/
|
19 |
class ElementorController {
|
20 |
+
/**
|
21 |
+
* Category ID
|
22 |
+
*
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
public $el_cat_id;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* Version
|
29 |
+
*
|
30 |
+
* @var string
|
31 |
+
*/
|
32 |
private $version;
|
33 |
|
34 |
+
/**
|
35 |
+
* Class constructor
|
36 |
+
*/
|
37 |
+
public function __construct() {
|
38 |
$this->version = defined( 'WP_DEBUG' ) && WP_DEBUG ? time() : RT_THE_POST_GRID_VERSION;
|
39 |
$this->el_cat_id = RT_THE_POST_GRID_PLUGIN_SLUG . '-elements';
|
40 |
|
41 |
if ( did_action( 'elementor/loaded' ) ) {
|
42 |
add_action( 'elementor/widgets/register', [ $this, 'init_widgets' ] );
|
43 |
add_action( 'elementor/elements/categories_registered', [ $this, 'widget_category' ] );
|
|
|
44 |
add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'el_editor_script' ] );
|
45 |
add_action( 'wp_footer', [ $this, 'tpg_el_scripts' ] );
|
46 |
add_action( 'wp_enqueue_scripts', [ $this, 'tpg_el_style' ] );
|
|
|
47 |
add_filter( 'elementor/editor/localize_settings', [ $this, 'promotePremiumWidgets' ] );
|
48 |
}
|
49 |
}
|
50 |
|
51 |
+
/**
|
52 |
+
* Style
|
53 |
+
*
|
54 |
+
* @return void
|
55 |
+
*/
|
56 |
public function tpg_el_style() {
|
57 |
+
// Custom CSS From Settings.
|
58 |
$css = isset( $settings['custom_css'] ) ? stripslashes( $settings['custom_css'] ) : null;
|
59 |
if ( $css ) {
|
60 |
wp_add_inline_style( 'rt-tpg-elementor', $css );
|
61 |
}
|
62 |
}
|
63 |
|
64 |
+
/**
|
65 |
+
* Scripts
|
66 |
+
*
|
67 |
+
* @return void
|
68 |
+
*/
|
69 |
public function tpg_el_scripts() {
|
|
|
70 |
$ajaxurl = '';
|
71 |
+
|
72 |
if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
|
73 |
$ajaxurl .= admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
|
74 |
} else {
|
75 |
$ajaxurl .= admin_url( 'admin-ajax.php' );
|
76 |
}
|
77 |
+
|
78 |
$variables = [
|
79 |
+
'nonceID' => esc_attr( rtTPG()->nonceId() ),
|
80 |
+
'nonce' => esc_attr( wp_create_nonce( rtTPG()->nonceText() ) ),
|
81 |
+
'ajaxurl' => esc_url( $ajaxurl ),
|
82 |
];
|
83 |
+
|
84 |
wp_localize_script( 'rt-tpg', 'rttpg', $variables );
|
85 |
}
|
86 |
|
87 |
+
/**
|
88 |
+
* Editor Scripts
|
89 |
+
*
|
90 |
+
* @return void
|
91 |
+
*/
|
92 |
public function el_editor_script() {
|
93 |
wp_enqueue_script( 'tgp-el-editor-scripts', rtTPG()->get_assets_uri( 'js/tpg-el-editor.js' ), [ 'jquery' ], $this->version, true );
|
94 |
wp_enqueue_style( 'tgp-el-editor-style', rtTPG()->get_assets_uri( 'css/admin/tpg-el-editor.css' ), [], $this->version );
|
95 |
}
|
96 |
|
97 |
+
/**
|
98 |
+
* Elementor widgets
|
99 |
+
*
|
100 |
+
* @param object $widgets_manager Manager.
|
101 |
+
* @return void
|
102 |
+
*/
|
103 |
public function init_widgets( $widgets_manager ) {
|
104 |
+
require_once RT_THE_POST_GRID_PLUGIN_PATH . '/app/Widgets/elementor/base.php';
|
105 |
+
require_once RT_THE_POST_GRID_PLUGIN_PATH . '/app/Widgets/elementor/rtTPGElementorHelper.php';
|
106 |
|
107 |
+
// dir_name => class_name.
|
108 |
$widgets = [
|
109 |
'grid-layout' => '\TPGGridLayout',
|
110 |
'list-layout' => '\TPGListLayout',
|
116 |
$widgets = apply_filters( 'tpg_el_widget_register', $widgets );
|
117 |
|
118 |
foreach ( $widgets as $file_name => $class ) {
|
119 |
+
if ( ! rtTPG()->hasPro() && 'slider-layout' === $file_name ) {
|
120 |
continue;
|
121 |
}
|
122 |
+
|
123 |
$template_name = 'the-post-grid/elementor/' . $file_name . '.php';
|
124 |
+
|
125 |
if ( file_exists( STYLESHEETPATH . $template_name ) ) {
|
126 |
$file = STYLESHEETPATH . $template_name;
|
127 |
} elseif ( file_exists( TEMPLATEPATH . $template_name ) ) {
|
129 |
} else {
|
130 |
$file = RT_THE_POST_GRID_PLUGIN_PATH . '/app/Widgets/elementor/widgets/' . $file_name . '.php';
|
131 |
}
|
132 |
+
|
133 |
require_once $file;
|
134 |
|
135 |
+
$widgets_manager->register( new $class() );
|
136 |
}
|
137 |
}
|
138 |
|
139 |
+
/**
|
140 |
+
* Widget category
|
141 |
+
*
|
142 |
+
* @param object $elements_manager Manager.
|
143 |
+
* @return void
|
144 |
+
*/
|
145 |
public function widget_category( $elements_manager ) {
|
146 |
$categories['tpg-elementor-builder-widgets'] = [
|
147 |
+
'title' => esc_html__( 'TPG Template Builder Element', 'the-post-grid' ),
|
148 |
'icon' => 'fa fa-plug',
|
149 |
];
|
150 |
|
151 |
$categories[ RT_THE_POST_GRID_PLUGIN_SLUG . '-elements' ] = [
|
152 |
+
'title' => esc_html__( 'The Post Grid', 'the-post-grid' ),
|
153 |
'icon' => 'fa fa-plug',
|
154 |
];
|
155 |
|
162 |
$set_categories->call( $elements_manager, $categories );
|
163 |
}
|
164 |
|
165 |
+
/**
|
166 |
+
* Promotion
|
167 |
+
*
|
168 |
+
* @param array $config Config.
|
169 |
+
* @return array
|
170 |
+
*/
|
171 |
public function promotePremiumWidgets( $config ) {
|
172 |
if ( rtTPG()->hasPro() ) {
|
173 |
return $config;
|
177 |
$config['promotionWidgets'] = [];
|
178 |
}
|
179 |
|
|
|
|
|
180 |
$pro_widgets = [
|
181 |
[
|
182 |
'name' => 'tpg-slider-layout',
|
183 |
+
'title' => esc_html__( 'TPG - Slider Layout', 'the-post-grid' ),
|
184 |
+
'description' => esc_html__( 'TPG - Slider Layout', 'the-post-grid' ),
|
185 |
'icon' => 'eicon-post-slider tpg-grid-icon tss-promotional-element',
|
186 |
'categories' => '[ "the-post-grid-elements" ]',
|
187 |
],
|
191 |
|
192 |
return $config;
|
193 |
}
|
|
|
|
|
194 |
}
|
195 |
+
endif;
|
|
app/Controllers/GutenBergController.php
CHANGED
@@ -1,46 +1,85 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
namespace RT\ThePostGrid\Controllers;
|
5 |
|
6 |
-
|
7 |
use RT\ThePostGrid\Helpers\Fns;
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
class GutenBergController {
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
));
|
17 |
-
}
|
18 |
-
}
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
23 |
}
|
24 |
}
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
wp_enqueue_style('wp-blocks');
|
29 |
}
|
30 |
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
// Scripts.
|
33 |
wp_enqueue_script(
|
34 |
'rt-tpg-cgb-block-js',
|
35 |
-
rtTPG()->get_assets_uri('js/post-grid-blocks.js'),
|
36 |
-
|
37 |
-
(defined('WP_DEBUG') && WP_DEBUG) ? time() : RT_THE_POST_GRID_VERSION,
|
38 |
true
|
39 |
);
|
40 |
-
|
41 |
-
|
42 |
-
'
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Elementor Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers;
|
9 |
|
|
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
|
12 |
+
// Do not allow directly accessing this file.
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit( 'This script cannot be accessed directly.' );
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Elementor Controller class.
|
19 |
+
*/
|
20 |
class GutenBergController {
|
21 |
+
/**
|
22 |
+
* Class constructor
|
23 |
+
*/
|
24 |
+
public function __construct() {
|
25 |
+
add_action( 'enqueue_block_assets', [ $this, 'block_assets' ] );
|
26 |
+
add_action( 'enqueue_block_editor_assets', [ $this, 'block_editor_assets' ] );
|
|
|
|
|
|
|
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 |
+
* Render
|
38 |
+
*
|
39 |
+
* @param array $atts Attributes.
|
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 |
+
* Block assets
|
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( 'js/post-grid-blocks.js' ),
|
69 |
+
[ 'wp-blocks', 'wp-i18n', 'wp-element' ],
|
70 |
+
( defined( 'WP_DEBUG' ) && WP_DEBUG ) ? time() : RT_THE_POST_GRID_VERSION,
|
71 |
true
|
72 |
);
|
73 |
+
|
74 |
+
wp_localize_script(
|
75 |
+
'rt-tpg-cgb-block-js',
|
76 |
+
'rttpgGB',
|
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 |
+
}
|
app/Controllers/Hooks/ActionHooks.php
CHANGED
@@ -1,24 +1,50 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Controllers\Hooks;
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
class ActionHooks {
|
|
|
|
|
|
|
|
|
|
|
6 |
public static function init() {
|
7 |
add_action( 'pre_get_posts', [ __CLASS__, 'category_query' ], 10 );
|
8 |
}
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
public static function category_query( $query ) {
|
11 |
if ( ! is_admin() && is_category() && $query->is_main_query() ) {
|
12 |
$settings = get_option( rtTPG()->options['settings'] );
|
13 |
$sc_id = isset( $settings['template_category'] ) ? absint( $settings['template_category'] ) : 0;
|
|
|
14 |
if ( $sc_id ) {
|
15 |
$posts_per_page = $sc_id ? absint( get_post_meta( $sc_id, 'posts_per_page', true ) ) : 0;
|
16 |
$pagination = $sc_id ? get_post_meta( $sc_id, 'pagination', true ) : false;
|
17 |
$posts_loading_type = $sc_id ? get_post_meta( $sc_id, 'posts_loading_type', true ) : '';
|
18 |
-
|
|
|
19 |
$query->set( 'posts_per_page', $posts_per_page );
|
20 |
}
|
21 |
}
|
22 |
}
|
23 |
}
|
24 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Action Hooks class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers\Hooks;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Action Hooks class.
|
17 |
+
*/
|
18 |
class ActionHooks {
|
19 |
+
/**
|
20 |
+
* Class init.
|
21 |
+
*
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
public static function init() {
|
25 |
add_action( 'pre_get_posts', [ __CLASS__, 'category_query' ], 10 );
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* Category query
|
30 |
+
*
|
31 |
+
* @param object $query Query.
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
public static function category_query( $query ) {
|
35 |
if ( ! is_admin() && is_category() && $query->is_main_query() ) {
|
36 |
$settings = get_option( rtTPG()->options['settings'] );
|
37 |
$sc_id = isset( $settings['template_category'] ) ? absint( $settings['template_category'] ) : 0;
|
38 |
+
|
39 |
if ( $sc_id ) {
|
40 |
$posts_per_page = $sc_id ? absint( get_post_meta( $sc_id, 'posts_per_page', true ) ) : 0;
|
41 |
$pagination = $sc_id ? get_post_meta( $sc_id, 'pagination', true ) : false;
|
42 |
$posts_loading_type = $sc_id ? get_post_meta( $sc_id, 'posts_loading_type', true ) : '';
|
43 |
+
|
44 |
+
if ( $pagination && 'pagination' === $posts_loading_type && $posts_per_page ) {
|
45 |
$query->set( 'posts_per_page', $posts_per_page );
|
46 |
}
|
47 |
}
|
48 |
}
|
49 |
}
|
50 |
+
}
|
app/Controllers/Hooks/FilterHooks.php
CHANGED
@@ -1,36 +1,66 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Controllers\Hooks;
|
4 |
|
5 |
use Cassandra\Varint;
|
6 |
use RT\ThePostGrid\Helpers\Fns;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
class FilterHooks {
|
9 |
-
|
|
|
|
|
|
|
|
|
10 |
public static function init() {
|
11 |
add_filter( 'tpg_author_arg', [ __CLASS__, 'filter_author_args' ], 10 );
|
12 |
add_filter( 'plugin_row_meta', [ __CLASS__, 'plugin_row_meta' ], 10, 2 );
|
13 |
|
14 |
$settings = get_option( 'rt_the_post_grid_settings' );
|
|
|
15 |
if ( isset( $settings['show_acf_details'] ) && $settings['show_acf_details'] ) {
|
16 |
add_filter( 'the_content', [ __CLASS__, 'tpg_acf_content_filter' ] );
|
17 |
}
|
|
|
18 |
add_filter( 'wp_head', [ __CLASS__, 'set_post_view_count' ], 9999 );
|
19 |
add_filter( 'admin_body_class', [ __CLASS__, 'admin_body_class' ] );
|
20 |
}
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
if( isset($settings['tpg_block_type']) && in_array($settings['tpg_block_type'], ['elementor', 'shortcode']) ) {
|
27 |
-
$clsses .= 'tpg-block-type-elementor-or-shortcode';
|
28 |
}
|
29 |
|
30 |
return $clsses;
|
31 |
}
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
34 |
public static function set_post_view_count( $content ) {
|
35 |
if ( is_single() ) {
|
36 |
$pId = get_the_ID();
|
@@ -40,19 +70,34 @@ class FilterHooks {
|
|
40 |
return $content;
|
41 |
}
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
public static function filter_author_args( $args ) {
|
44 |
$defaults = [ 'role__in' => [ 'administrator', 'editor', 'author' ] ];
|
45 |
|
46 |
return wp_parse_args( $args, $defaults );
|
47 |
}
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
public static function plugin_row_meta( $links, $file ) {
|
50 |
if ( $file == RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME ) {
|
51 |
$report_url = 'https://www.radiustheme.com/contact/';
|
52 |
-
$row_meta['issues'] = sprintf(
|
|
|
53 |
esc_url( $report_url ),
|
54 |
esc_html__( 'Facing issue?', 'the-post-grid' ),
|
55 |
-
'<span style="color: red">' . esc_html__( 'Please open a support ticket.', 'the-post-grid' ) . '</span>'
|
|
|
56 |
|
57 |
return array_merge( $links, $row_meta );
|
58 |
}
|
@@ -60,7 +105,12 @@ class FilterHooks {
|
|
60 |
return (array) $links;
|
61 |
}
|
62 |
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
64 |
public static function tpg_acf_content_filter( $content ) {
|
65 |
// Check if we're inside the main loop in a post or page.
|
66 |
if ( is_single() && in_the_loop() && is_main_query() && rtTPG()->hasPro() ) {
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Filter Hooks class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers\Hooks;
|
9 |
|
10 |
use Cassandra\Varint;
|
11 |
use RT\ThePostGrid\Helpers\Fns;
|
12 |
|
13 |
+
// Do not allow directly accessing this file.
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit( 'This script cannot be accessed directly.' );
|
16 |
+
}
|
17 |
+
/**
|
18 |
+
* Filter Hooks class.
|
19 |
+
*
|
20 |
+
* @package RT_TPG
|
21 |
+
*/
|
22 |
class FilterHooks {
|
23 |
+
/**
|
24 |
+
* Class init
|
25 |
+
*
|
26 |
+
* @return void
|
27 |
+
*/
|
28 |
public static function init() {
|
29 |
add_filter( 'tpg_author_arg', [ __CLASS__, 'filter_author_args' ], 10 );
|
30 |
add_filter( 'plugin_row_meta', [ __CLASS__, 'plugin_row_meta' ], 10, 2 );
|
31 |
|
32 |
$settings = get_option( 'rt_the_post_grid_settings' );
|
33 |
+
|
34 |
if ( isset( $settings['show_acf_details'] ) && $settings['show_acf_details'] ) {
|
35 |
add_filter( 'the_content', [ __CLASS__, 'tpg_acf_content_filter' ] );
|
36 |
}
|
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' ], true ) ) {
|
52 |
+
$clsses .= ' tpg-block-type-elementor-or-shortcode';
|
|
|
|
|
|
|
53 |
}
|
54 |
|
55 |
return $clsses;
|
56 |
}
|
57 |
|
58 |
+
/**
|
59 |
+
* Set view count
|
60 |
+
*
|
61 |
+
* @param string $content Content.
|
62 |
+
* @return string
|
63 |
+
*/
|
64 |
public static function set_post_view_count( $content ) {
|
65 |
if ( is_single() ) {
|
66 |
$pId = get_the_ID();
|
70 |
return $content;
|
71 |
}
|
72 |
|
73 |
+
/**
|
74 |
+
* Filter author args.
|
75 |
+
*
|
76 |
+
* @param array $args Args.
|
77 |
+
* @return array
|
78 |
+
*/
|
79 |
public static function filter_author_args( $args ) {
|
80 |
$defaults = [ 'role__in' => [ 'administrator', 'editor', 'author' ] ];
|
81 |
|
82 |
return wp_parse_args( $args, $defaults );
|
83 |
}
|
84 |
|
85 |
+
/**
|
86 |
+
* Add plugin row meta
|
87 |
+
*
|
88 |
+
* @param array $links Links.
|
89 |
+
* @param string $file File.
|
90 |
+
* @return array
|
91 |
+
*/
|
92 |
public static function plugin_row_meta( $links, $file ) {
|
93 |
if ( $file == RT_THE_POST_GRID_PLUGIN_ACTIVE_FILE_NAME ) {
|
94 |
$report_url = 'https://www.radiustheme.com/contact/';
|
95 |
+
$row_meta['issues'] = sprintf(
|
96 |
+
'%2$s <a target="_blank" href="%1$s">%3$s</a>',
|
97 |
esc_url( $report_url ),
|
98 |
esc_html__( 'Facing issue?', 'the-post-grid' ),
|
99 |
+
'<span style="color: red">' . esc_html__( 'Please open a support ticket.', 'the-post-grid' ) . '</span>'
|
100 |
+
);
|
101 |
|
102 |
return array_merge( $links, $row_meta );
|
103 |
}
|
105 |
return (array) $links;
|
106 |
}
|
107 |
|
108 |
+
/**
|
109 |
+
* ACF content filter
|
110 |
+
*
|
111 |
+
* @param string $content Content.
|
112 |
+
* @return string
|
113 |
+
*/
|
114 |
public static function tpg_acf_content_filter( $content ) {
|
115 |
// Check if we're inside the main loop in a post or page.
|
116 |
if ( is_single() && in_the_loop() && is_main_query() && rtTPG()->hasPro() ) {
|
app/Controllers/ScriptController.php
CHANGED
@@ -1,38 +1,67 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Controllers;
|
4 |
|
5 |
-
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
private $version;
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
private $settings;
|
9 |
|
|
|
|
|
|
|
10 |
public function __construct() {
|
11 |
$this->version = defined( 'WP_DEBUG' ) && WP_DEBUG ? time() : RT_THE_POST_GRID_VERSION;
|
|
|
12 |
add_action( 'wp_head', [ &$this, 'header_scripts' ] );
|
13 |
add_action( 'wp_enqueue_scripts', [ &$this, 'enqueue' ] );
|
14 |
add_action( 'init', [ $this, 'init' ] );
|
15 |
-
|
16 |
}
|
17 |
|
|
|
|
|
|
|
|
|
|
|
18 |
public function init() {
|
19 |
-
|
20 |
$this->settings = get_option( rtTPG()->options['settings'] );
|
|
|
21 |
|
22 |
-
|
23 |
-
if ( 'rttpg_settings' == $current_page ) {
|
24 |
wp_enqueue_style( 'wp-color-picker' );
|
25 |
wp_enqueue_script( 'wp-color-picker' );
|
26 |
}
|
27 |
|
28 |
-
// register scripts
|
29 |
$scripts = [];
|
30 |
$styles = [];
|
31 |
|
32 |
-
|
33 |
$scripts[] = [
|
34 |
'handle' => 'rt-isotope-js',
|
35 |
-
'src' => rtTPG()->get_assets_uri(
|
36 |
'deps' => [ 'jquery' ],
|
37 |
'footer' => true,
|
38 |
];
|
@@ -44,35 +73,34 @@ class ScriptController {
|
|
44 |
'footer' => true,
|
45 |
];
|
46 |
|
47 |
-
// register acf styles
|
48 |
$styles['rt-fontawsome'] = rtTPG()->get_assets_uri( 'vendor/font-awesome/css/font-awesome.min.css' );
|
49 |
|
50 |
-
|
51 |
-
//Plugin specific css
|
52 |
$styles['rt-tpg'] = rtTPG()->tpg_can_be_rtl( 'css/thepostgrid' );
|
53 |
$styles['rt-tpg-elementor'] = rtTPG()->tpg_can_be_rtl( 'css/tpg-elementor' );
|
54 |
$styles['rt-tpg-shortcode'] = rtTPG()->tpg_can_be_rtl( 'css/tpg-shortcode' );
|
55 |
|
56 |
-
|
57 |
if ( is_admin() ) {
|
58 |
-
$scripts[]
|
59 |
'handle' => 'rt-select2',
|
60 |
'src' => rtTPG()->get_assets_uri( 'vendor/select2/select2.min.js' ),
|
61 |
'deps' => [ 'jquery' ],
|
62 |
'footer' => false,
|
63 |
];
|
64 |
-
$scripts[]
|
65 |
'handle' => 'rt-tpg-admin',
|
66 |
'src' => rtTPG()->get_assets_uri( 'js/admin.js' ),
|
67 |
'deps' => [ 'jquery', 'wp-color-picker' ],
|
68 |
'footer' => true,
|
69 |
];
|
70 |
-
$scripts[]
|
71 |
'handle' => 'rt-tpg-admin-preview',
|
72 |
'src' => rtTPG()->get_assets_uri( 'js/admin-preview.js' ),
|
73 |
'deps' => [ 'jquery' ],
|
74 |
'footer' => true,
|
75 |
];
|
|
|
76 |
$styles['rt-select2'] = rtTPG()->get_assets_uri( 'vendor/select2/select2.min.css' );
|
77 |
$styles['rt-tpg-admin'] = rtTPG()->get_assets_uri( 'css/admin/admin.css' );
|
78 |
$styles['rt-tpg-admin-preview'] = rtTPG()->get_assets_uri( 'css/admin/admin-preview.css' );
|
@@ -87,19 +115,28 @@ class ScriptController {
|
|
87 |
}
|
88 |
}
|
89 |
|
|
|
|
|
|
|
|
|
|
|
90 |
public function enqueue() {
|
91 |
-
wp_enqueue_script( 'jquery' );
|
92 |
$block_type = isset( $this->settings['tpg_block_type'] ) ? $this->settings['tpg_block_type'] : 'default';
|
93 |
|
|
|
|
|
94 |
if ( ! isset( $this->settings['tpg_load_script'] ) ) {
|
95 |
wp_enqueue_style( 'rt-fontawsome' );
|
96 |
-
|
|
|
97 |
wp_enqueue_style( 'rt-tpg' );
|
98 |
}
|
99 |
-
|
|
|
100 |
wp_enqueue_style( 'rt-tpg-elementor' );
|
101 |
}
|
102 |
-
|
|
|
103 |
wp_enqueue_style( 'rt-tpg-shortcode' );
|
104 |
}
|
105 |
}
|
@@ -107,173 +144,177 @@ class ScriptController {
|
|
107 |
$scriptBefore = isset( $this->settings['script_before_item_load'] ) ? stripslashes( $this->settings['script_before_item_load'] ) : null;
|
108 |
$scriptAfter = isset( $this->settings['script_after_item_load'] ) ? stripslashes( $this->settings['script_after_item_load'] ) : null;
|
109 |
$scriptLoaded = isset( $this->settings['script_loaded'] ) ? stripslashes( $this->settings['script_loaded'] ) : null;
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
115 |
wp_add_inline_script( 'rt-tpg', $script );
|
116 |
}
|
117 |
|
118 |
/**
|
119 |
* Header Scripts
|
|
|
|
|
120 |
*/
|
121 |
public function header_scripts() {
|
122 |
-
|
123 |
?>
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
|
140 |
<?php
|
141 |
-
if ( isset( $this->settings['tpg_load_script'] ) ) :
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
|
|
|
|
276 |
|
277 |
}
|
278 |
|
279 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Script Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
+
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Script Controller class.
|
17 |
+
*/
|
18 |
+
class ScriptController {
|
19 |
+
/**
|
20 |
+
* Version
|
21 |
+
*
|
22 |
+
* @var string
|
23 |
+
*/
|
24 |
private $version;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Settings
|
28 |
+
*
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
private $settings;
|
32 |
|
33 |
+
/**
|
34 |
+
* Class construct
|
35 |
+
*/
|
36 |
public function __construct() {
|
37 |
$this->version = defined( 'WP_DEBUG' ) && WP_DEBUG ? time() : RT_THE_POST_GRID_VERSION;
|
38 |
+
|
39 |
add_action( 'wp_head', [ &$this, 'header_scripts' ] );
|
40 |
add_action( 'wp_enqueue_scripts', [ &$this, 'enqueue' ] );
|
41 |
add_action( 'init', [ $this, 'init' ] );
|
|
|
42 |
}
|
43 |
|
44 |
+
/**
|
45 |
+
* Init
|
46 |
+
*
|
47 |
+
* @return void
|
48 |
+
*/
|
49 |
public function init() {
|
|
|
50 |
$this->settings = get_option( rtTPG()->options['settings'] );
|
51 |
+
$current_page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : '';
|
52 |
|
53 |
+
if ( 'rttpg_settings' === $current_page ) {
|
|
|
54 |
wp_enqueue_style( 'wp-color-picker' );
|
55 |
wp_enqueue_script( 'wp-color-picker' );
|
56 |
}
|
57 |
|
58 |
+
// register scripts.
|
59 |
$scripts = [];
|
60 |
$styles = [];
|
61 |
|
|
|
62 |
$scripts[] = [
|
63 |
'handle' => 'rt-isotope-js',
|
64 |
+
'src' => rtTPG()->get_assets_uri( 'vendor/isotope/isotope.pkgd.min.js' ),
|
65 |
'deps' => [ 'jquery' ],
|
66 |
'footer' => true,
|
67 |
];
|
73 |
'footer' => true,
|
74 |
];
|
75 |
|
76 |
+
// register acf styles.
|
77 |
$styles['rt-fontawsome'] = rtTPG()->get_assets_uri( 'vendor/font-awesome/css/font-awesome.min.css' );
|
78 |
|
79 |
+
// Plugin specific css.
|
|
|
80 |
$styles['rt-tpg'] = rtTPG()->tpg_can_be_rtl( 'css/thepostgrid' );
|
81 |
$styles['rt-tpg-elementor'] = rtTPG()->tpg_can_be_rtl( 'css/tpg-elementor' );
|
82 |
$styles['rt-tpg-shortcode'] = rtTPG()->tpg_can_be_rtl( 'css/tpg-shortcode' );
|
83 |
|
|
|
84 |
if ( is_admin() ) {
|
85 |
+
$scripts[] = [
|
86 |
'handle' => 'rt-select2',
|
87 |
'src' => rtTPG()->get_assets_uri( 'vendor/select2/select2.min.js' ),
|
88 |
'deps' => [ 'jquery' ],
|
89 |
'footer' => false,
|
90 |
];
|
91 |
+
$scripts[] = [
|
92 |
'handle' => 'rt-tpg-admin',
|
93 |
'src' => rtTPG()->get_assets_uri( 'js/admin.js' ),
|
94 |
'deps' => [ 'jquery', 'wp-color-picker' ],
|
95 |
'footer' => true,
|
96 |
];
|
97 |
+
$scripts[] = [
|
98 |
'handle' => 'rt-tpg-admin-preview',
|
99 |
'src' => rtTPG()->get_assets_uri( 'js/admin-preview.js' ),
|
100 |
'deps' => [ 'jquery' ],
|
101 |
'footer' => true,
|
102 |
];
|
103 |
+
|
104 |
$styles['rt-select2'] = rtTPG()->get_assets_uri( 'vendor/select2/select2.min.css' );
|
105 |
$styles['rt-tpg-admin'] = rtTPG()->get_assets_uri( 'css/admin/admin.css' );
|
106 |
$styles['rt-tpg-admin-preview'] = rtTPG()->get_assets_uri( 'css/admin/admin-preview.css' );
|
115 |
}
|
116 |
}
|
117 |
|
118 |
+
/**
|
119 |
+
* Enqueue scripts.
|
120 |
+
*
|
121 |
+
* @return void
|
122 |
+
*/
|
123 |
public function enqueue() {
|
|
|
124 |
$block_type = isset( $this->settings['tpg_block_type'] ) ? $this->settings['tpg_block_type'] : 'default';
|
125 |
|
126 |
+
wp_enqueue_script( 'jquery' );
|
127 |
+
|
128 |
if ( ! isset( $this->settings['tpg_load_script'] ) ) {
|
129 |
wp_enqueue_style( 'rt-fontawsome' );
|
130 |
+
|
131 |
+
if ( 'default' === $block_type ) {
|
132 |
wp_enqueue_style( 'rt-tpg' );
|
133 |
}
|
134 |
+
|
135 |
+
if ( 'elementor' === $block_type ) {
|
136 |
wp_enqueue_style( 'rt-tpg-elementor' );
|
137 |
}
|
138 |
+
|
139 |
+
if ( 'shortcode' === $block_type ) {
|
140 |
wp_enqueue_style( 'rt-tpg-shortcode' );
|
141 |
}
|
142 |
}
|
144 |
$scriptBefore = isset( $this->settings['script_before_item_load'] ) ? stripslashes( $this->settings['script_before_item_load'] ) : null;
|
145 |
$scriptAfter = isset( $this->settings['script_after_item_load'] ) ? stripslashes( $this->settings['script_after_item_load'] ) : null;
|
146 |
$scriptLoaded = isset( $this->settings['script_loaded'] ) ? stripslashes( $this->settings['script_loaded'] ) : null;
|
147 |
+
|
148 |
+
$script = "(function($){
|
149 |
+
$('.rt-tpg-container').on('tpg_item_before_load', function(){{$scriptBefore}});
|
150 |
+
$('.rt-tpg-container').on('tpg_item_after_load', function(){{$scriptAfter}});
|
151 |
+
$('.rt-tpg-container').on('tpg_loaded', function(){{$scriptLoaded}});
|
152 |
+
})(jQuery);";
|
153 |
wp_add_inline_script( 'rt-tpg', $script );
|
154 |
}
|
155 |
|
156 |
/**
|
157 |
* Header Scripts
|
158 |
+
*
|
159 |
+
* @return void
|
160 |
*/
|
161 |
public function header_scripts() {
|
|
|
162 |
?>
|
163 |
+
<style>
|
164 |
+
:root {
|
165 |
+
--tpg-primary-color: <?php echo isset( $this->settings['tpg_primary_color_main'] ) ? sanitize_hex_color( $this->settings['tpg_primary_color_main'] ) : '#0d6efd'; ?>;
|
166 |
+
--tpg-secondary-color: <?php echo isset( $this->settings['tpg_secondary_color_main'] ) ? sanitize_hex_color( $this->settings['tpg_secondary_color_main'] ) : '#0654c4'; ?>;
|
167 |
+
--tpg-primary-light: #c4d0ff
|
168 |
+
}
|
169 |
+
|
170 |
+
<?php if ( isset( $this->settings['tpg_loader_color'] ) ) : ?>
|
171 |
+
body .rt-tpg-container .rt-loading,
|
172 |
+
body #bottom-script-loader .rt-ball-clip-rotate {
|
173 |
+
color: <?php echo sanitize_hex_color( $this->settings['tpg_loader_color'] ); ?> !important;
|
174 |
+
}
|
175 |
+
|
176 |
+
<?php endif; ?>
|
177 |
+
</style>
|
178 |
|
179 |
<?php
|
180 |
+
if ( isset( $this->settings['tpg_load_script'] ) ) :
|
181 |
+
?>
|
182 |
+
<style>
|
183 |
+
.rt-container-fluid {
|
184 |
+
position: relative;
|
185 |
+
}
|
186 |
+
|
187 |
+
.rt-tpg-container .tpg-pre-loader {
|
188 |
+
position: relative;
|
189 |
+
overflow: hidden;
|
190 |
+
}
|
191 |
+
|
192 |
+
.rt-tpg-container .rt-loading-overlay {
|
193 |
+
opacity: 0;
|
194 |
+
visibility: hidden;
|
195 |
+
position: absolute;
|
196 |
+
top: 0;
|
197 |
+
left: 0;
|
198 |
+
width: 100%;
|
199 |
+
height: 100%;
|
200 |
+
z-index: 1;
|
201 |
+
background-color: #fff;
|
202 |
+
}
|
203 |
+
|
204 |
+
.rt-tpg-container .rt-loading {
|
205 |
+
color: var(--tpg-primary-color);
|
206 |
+
position: absolute;
|
207 |
+
top: 40%;
|
208 |
+
left: 50%;
|
209 |
+
margin-left: -16px;
|
210 |
+
z-index: 2;
|
211 |
+
opacity: 0;
|
212 |
+
visibility: hidden;
|
213 |
+
}
|
214 |
+
|
215 |
+
.rt-tpg-container .tpg-pre-loader .rt-loading-overlay {
|
216 |
+
opacity: 0.8;
|
217 |
+
visibility: visible;
|
218 |
+
}
|
219 |
+
|
220 |
+
.tpg-carousel-main .tpg-pre-loader .rt-loading-overlay {
|
221 |
+
opacity: 1;
|
222 |
+
}
|
223 |
+
|
224 |
+
.rt-tpg-container .tpg-pre-loader .rt-loading {
|
225 |
+
opacity: 1;
|
226 |
+
visibility: visible;
|
227 |
+
}
|
228 |
+
|
229 |
+
|
230 |
+
#bottom-script-loader {
|
231 |
+
position: absolute;
|
232 |
+
width: calc(100% + 60px);
|
233 |
+
height: calc(100% + 60px);
|
234 |
+
z-index: 999;
|
235 |
+
background: rgba(255, 255, 255, 0.95);
|
236 |
+
margin: -30px;
|
237 |
+
}
|
238 |
+
|
239 |
+
#bottom-script-loader .rt-ball-clip-rotate {
|
240 |
+
color: var(--tpg-primary-color);
|
241 |
+
position: absolute;
|
242 |
+
top: 80px;
|
243 |
+
left: 50%;
|
244 |
+
margin-left: -16px;
|
245 |
+
z-index: 2;
|
246 |
+
}
|
247 |
+
|
248 |
+
.tpg-el-main-wrapper.loading {
|
249 |
+
min-height: 300px;
|
250 |
+
transition: 0.4s;
|
251 |
+
}
|
252 |
+
|
253 |
+
.tpg-el-main-wrapper.loading::before {
|
254 |
+
width: 32px;
|
255 |
+
height: 32px;
|
256 |
+
display: inline-block;
|
257 |
+
float: none;
|
258 |
+
border: 2px solid currentColor;
|
259 |
+
background: transparent;
|
260 |
+
border-bottom-color: transparent;
|
261 |
+
border-radius: 100%;
|
262 |
+
-webkit-animation: ball-clip-rotate 0.75s linear infinite;
|
263 |
+
-moz-animation: ball-clip-rotate 0.75s linear infinite;
|
264 |
+
-o-animation: ball-clip-rotate 0.75s linear infinite;
|
265 |
+
animation: ball-clip-rotate 0.75s linear infinite;
|
266 |
+
left: 50%;
|
267 |
+
top: 50%;
|
268 |
+
position: absolute;
|
269 |
+
z-index: 9999999999;
|
270 |
+
color: red;
|
271 |
+
}
|
272 |
+
|
273 |
+
|
274 |
+
.rt-tpg-container .slider-main-wrapper,
|
275 |
+
.tpg-el-main-wrapper .slider-main-wrapper {
|
276 |
+
opacity: 0;
|
277 |
+
}
|
278 |
+
|
279 |
+
.md-modal {
|
280 |
+
visibility: hidden;
|
281 |
+
}
|
282 |
+
.md-modal.md-show {
|
283 |
+
visibility: visible;
|
284 |
+
}
|
285 |
+
|
286 |
+
.builder-content.content-invisible {
|
287 |
+
visibility: hidden;
|
288 |
+
}
|
289 |
+
|
290 |
+
.rt-tpg-container > *:not(.bottom-script-loader, .slider-main-wrapper) {
|
291 |
+
opacity: 0;
|
292 |
+
}
|
293 |
+
|
294 |
+
.rt-popup-content .rt-tpg-container > *:not(.bottom-script-loader, .slider-main-wrapper) {
|
295 |
+
opacity: 1;
|
296 |
+
}
|
297 |
+
|
298 |
+
</style>
|
299 |
+
|
300 |
+
<script>
|
301 |
+
jQuery( document ).ready( function () {
|
302 |
+
setTimeout( function () {
|
303 |
+
jQuery( '.rt-tpg-container > *:not(.bottom-script-loader, .slider-main-wrapper)' ).animate( { "opacity": 1 } );
|
304 |
+
}, 100 );
|
305 |
+
} );
|
306 |
+
|
307 |
+
jQuery( window ).on( 'elementor/frontend/init', function () {
|
308 |
+
if ( elementorFrontend.isEditMode() ) {
|
309 |
+
elementorFrontend.hooks.addAction( 'frontend/element_ready/widget', function () {
|
310 |
+
jQuery( '.rt-tpg-container > *:not(.bottom-script-loader, .slider-main-wrapper)' ).animate( { "opacity": 1 } );
|
311 |
+
} );
|
312 |
+
}
|
313 |
+
} );
|
314 |
+
</script>
|
315 |
+
<?php
|
316 |
+
endif;
|
317 |
|
318 |
}
|
319 |
|
320 |
+
}
|
app/Controllers/ShortcodeController.php
CHANGED
@@ -1,17 +1,30 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Controllers;
|
4 |
|
5 |
use RT\ThePostGrid\Helpers\Fns;
|
6 |
use RT\ThePostGrid\Helpers\Options;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
class ShortcodeController {
|
9 |
private $scA = [];
|
10 |
private $l4toggle = false;
|
11 |
|
12 |
public function __construct() {
|
13 |
-
add_shortcode( 'the-post-grid', [
|
14 |
-
add_action( 'pre_get_posts', [
|
15 |
}
|
16 |
|
17 |
public function make_sticky_work( $q ) {
|
@@ -22,27 +35,27 @@ class ShortcodeController {
|
|
22 |
|
23 |
public function register_sc_scripts() {
|
24 |
$settings = get_option( rtTPG()->options['settings'] );
|
|
|
|
|
25 |
|
26 |
-
$caro = $isSinglePopUp = false;
|
27 |
-
|
28 |
-
$ajaxurl = '';
|
29 |
if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
|
30 |
$ajaxurl .= admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
|
31 |
} else {
|
32 |
$ajaxurl .= admin_url( 'admin-ajax.php' );
|
33 |
}
|
|
|
34 |
$variables = [
|
35 |
-
'nonceID' => rtTPG()->nonceId(),
|
36 |
-
'nonce' => wp_create_nonce( rtTPG()->nonceText() ),
|
37 |
-
'ajaxurl' => $ajaxurl,
|
38 |
];
|
39 |
|
40 |
-
|
41 |
foreach ( $this->scA as $sc ) {
|
42 |
if ( isset( $sc ) && is_array( $sc ) ) {
|
43 |
if ( $sc['isSinglePopUp'] ) {
|
44 |
$isSinglePopUp = true;
|
45 |
}
|
|
|
46 |
if ( $sc['isWooCom'] ) {
|
47 |
$variables['woocommerce_enable_ajax_add_to_cart'] = get_option( 'woocommerce_enable_ajax_add_to_cart' );
|
48 |
$variables['woocommerce_cart_redirect_after_add'] = get_option( 'woocommerce_cart_redirect_after_add' );
|
@@ -50,7 +63,6 @@ class ShortcodeController {
|
|
50 |
}
|
51 |
}
|
52 |
if ( count( $this->scA ) ) {
|
53 |
-
|
54 |
wp_localize_script( 'rt-tpg', 'rttpg', $variables );
|
55 |
|
56 |
do_action( 'tpg_after_script', $isSinglePopUp );
|
@@ -59,36 +71,40 @@ class ShortcodeController {
|
|
59 |
if ( $isSinglePopUp && rtTPG()->hasPro() ) {
|
60 |
$html = null;
|
61 |
$html .= '<div class="md-modal rt-md-effect" id="rt-modal">
|
62 |
-
|
63 |
-
|
64 |
|
65 |
-
</div>
|
66 |
-
<div class="md-cls-btn">
|
67 |
-
<button class="md-close"><i class="fa fa-times" aria-hidden="true"></i></button>
|
68 |
-
</div>
|
69 |
</div>
|
70 |
-
|
|
|
|
|
|
|
|
|
71 |
$html .= "<div class='md-overlay'></div>";
|
72 |
-
|
|
|
73 |
}
|
74 |
}
|
75 |
|
76 |
public function the_post_grid_short_code( $atts, $content = null ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
|
78 |
-
$rand = mt_rand();
|
79 |
-
|
80 |
-
$layoutID = "rt-tpg-container-" . $rand;
|
81 |
-
|
82 |
-
$html = null;
|
83 |
-
$arg = [];
|
84 |
-
$atts = shortcode_atts( [
|
85 |
-
'id' => null,
|
86 |
-
], $atts, 'the-post-grid' );
|
87 |
-
$scID = $atts['id'];
|
88 |
if ( $scID && ! is_null( get_post( $scID ) ) ) {
|
89 |
$scMeta = get_post_meta( $scID );
|
90 |
$layout = ( isset( $scMeta['layout'][0] ) ? $scMeta['layout'][0] : 'layout1' );
|
91 |
$gridStyle = ( isset( $scMeta['grid_style'][0] ) ? $scMeta['grid_style'][0] : 'even' );
|
|
|
92 |
if ( ! in_array( $layout, array_keys( Options::rtTPGLayouts() ) ) ) {
|
93 |
$layout = 'layout1';
|
94 |
}
|
@@ -104,12 +120,15 @@ class ShortcodeController {
|
|
104 |
$colStore = $dCol = ( isset( $scMeta['column'][0] ) ? absint( $scMeta['column'][0] ) : 3 );
|
105 |
$tCol = ( isset( $scMeta['tpg_tab_column'][0] ) ? absint( $scMeta['tpg_tab_column'][0] ) : 2 );
|
106 |
$mCol = ( isset( $scMeta['tpg_mobile_column'][0] ) ? absint( $scMeta['tpg_mobile_column'][0] ) : 1 );
|
|
|
107 |
if ( ! in_array( $dCol, array_keys( Options::scColumns() ) ) ) {
|
108 |
$dCol = 3;
|
109 |
}
|
|
|
110 |
if ( ! in_array( $tCol, array_keys( Options::scColumns() ) ) ) {
|
111 |
$tCol = 2;
|
112 |
}
|
|
|
113 |
if ( ! in_array( $dCol, array_keys( Options::scColumns() ) ) ) {
|
114 |
$mCol = 1;
|
115 |
}
|
@@ -119,47 +138,49 @@ class ShortcodeController {
|
|
119 |
$tCol = ( $tCol < 3 ? 2 : $tCol );
|
120 |
$mCol = ( $mCol < 3 ? 1 : $mCol );
|
121 |
}
|
|
|
122 |
$arg = [];
|
123 |
$fImg = ( ! empty( $scMeta['feature_image'][0] ) ? true : false );
|
124 |
-
$fImgSize = ( isset( $scMeta['featured_image_size'][0] ) ? $scMeta['featured_image_size'][0] :
|
125 |
-
$mediaSource = ( isset( $scMeta['media_source'][0] ) ? $scMeta['media_source'][0] :
|
126 |
$arg['excerpt_type'] = ( isset( $scMeta['tgp_excerpt_type'][0] ) ? $scMeta['tgp_excerpt_type'][0] : 'character' );
|
127 |
$arg['title_limit_type'] = ( isset( $scMeta['tpg_title_limit_type'][0] ) ? $scMeta['tpg_title_limit_type'][0] : 'character' );
|
128 |
$arg['excerpt_limit'] = ( isset( $scMeta['excerpt_limit'][0] ) ? absint( $scMeta['excerpt_limit'][0] ) : 0 );
|
129 |
$arg['title_limit'] = ( isset( $scMeta['tpg_title_limit'][0] ) ? absint( $scMeta['tpg_title_limit'][0] ) : 0 );
|
130 |
$arg['excerpt_more_text'] = ( isset( $scMeta['tgp_excerpt_more_text'][0] ) ? $scMeta['tgp_excerpt_more_text'][0] : null );
|
131 |
-
$arg['read_more_text'] = ( ! empty( $scMeta['tgp_read_more_text'][0] ) ? $scMeta['tgp_read_more_text'][0] :
|
132 |
-
$arg['show_all_text'] = ( ! empty( $scMeta['tpg_show_all_text'][0] )
|
133 |
-
? $scMeta['tpg_show_all_text'][0]
|
134 |
-
: __( 'Show all',
|
135 |
-
'the-post-grid' ) );
|
136 |
$arg['tpg_title_position'] = isset( $scMeta['tpg_title_position'][0] ) && ! empty( $scMeta['tpg_title_position'][0] ) ? $scMeta['tpg_title_position'][0] : null;
|
137 |
$arg['btn_alignment_class'] = isset( $scMeta['tpg_read_more_button_alignment'][0] ) && ! empty( $scMeta['tpg_read_more_button_alignment'][0] )
|
138 |
? $scMeta['tpg_read_more_button_alignment'][0] : '';
|
139 |
-
// Category Settings
|
140 |
$arg['category_position'] = isset( $scMeta['tpg_category_position'][0] ) ? $scMeta['tpg_category_position'][0] : null;
|
141 |
$arg['category_style'] = ! empty( $scMeta['tpg_category_style'][0] ) ? $scMeta['tpg_category_style'][0] : '';
|
142 |
$arg['catIcon'] = isset( $scMeta['tpg_category_icon'][0] ) ? $scMeta['tpg_category_icon'][0] : true;
|
143 |
-
// Meta Settings
|
144 |
$arg['metaPosition'] = isset( $scMeta['tpg_meta_position'][0] ) ? $scMeta['tpg_meta_position'][0] : null;
|
145 |
$arg['metaIcon'] = isset( $scMeta['tpg_meta_icon'][0] ) ? $scMeta['tpg_meta_icon'][0] : true;
|
146 |
$arg['metaSeparator'] = ! empty( $scMeta['tpg_meta_separator'][0] ) ? $scMeta['tpg_meta_separator'][0] : '';
|
147 |
/* Argument create */
|
148 |
$args = [];
|
149 |
$postType = ( isset( $scMeta['tpg_post_type'][0] ) ? $scMeta['tpg_post_type'][0] : 'post' );
|
|
|
150 |
if ( $postType ) {
|
151 |
$args['post_type'] = $postType;
|
152 |
}
|
153 |
|
154 |
-
// Common
|
155 |
/* post__in */
|
156 |
$post__in = ( isset( $scMeta['post__in'][0] ) ? $scMeta['post__in'][0] : null );
|
|
|
157 |
if ( $post__in ) {
|
158 |
$post__in = explode( ',', $post__in );
|
159 |
$args['post__in'] = $post__in;
|
160 |
}
|
|
|
161 |
/* post__not_in */
|
162 |
$post__not_in = ( isset( $scMeta['post__not_in'][0] ) ? $scMeta['post__not_in'][0] : null );
|
|
|
163 |
if ( $post__not_in ) {
|
164 |
$post__not_in = explode( ',', $post__not_in );
|
165 |
$args['post__not_in'] = $post__not_in;
|
@@ -170,44 +191,49 @@ class ShortcodeController {
|
|
170 |
$queryOffset = empty( $scMeta['offset'][0] ) ? 0 : absint( $scMeta['offset'][0] );
|
171 |
$args['posts_per_page'] = $limit;
|
172 |
$pagination = ! empty( $scMeta['pagination'][0] );
|
173 |
-
$posts_loading_type = ( ! empty( $scMeta['posts_loading_type'][0] ) ? $scMeta['posts_loading_type'][0] :
|
174 |
if ( $pagination ) {
|
175 |
$posts_per_page = ( isset( $scMeta['posts_per_page'][0] ) ? intval( $scMeta['posts_per_page'][0] ) : $limit );
|
176 |
$args['posts_per_page'] = $posts_per_page;
|
177 |
$args['paged'] = get_query_var( 'page' ) ? get_query_var( 'page' ) : ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 );
|
178 |
}
|
179 |
|
180 |
-
//
|
181 |
$adv_filter = get_post_meta( $scID, 'post_filter' );
|
182 |
$taxFilter = get_post_meta( $scID, 'tgp_filter_taxonomy', true );
|
183 |
$taxHierarchical = get_post_meta( $scID, 'tgp_filter_taxonomy_hierarchical', true );
|
184 |
$taxFilterTerms = [];
|
185 |
-
$taxFilterOperator =
|
186 |
-
// Taxonomy
|
187 |
$taxQ = [];
|
|
|
188 |
if ( in_array( 'tpg_taxonomy', $adv_filter ) && isset( $scMeta['tpg_taxonomy'] ) ) {
|
189 |
if ( is_array( $scMeta['tpg_taxonomy'] ) && ! empty( $scMeta['tpg_taxonomy'] ) ) {
|
190 |
foreach ( $scMeta['tpg_taxonomy'] as $taxonomy ) {
|
191 |
$terms = ( isset( $scMeta[ 'term_' . $taxonomy ] ) ? $scMeta[ 'term_' . $taxonomy ] : [] );
|
|
|
192 |
if ( is_array( $terms ) && ! empty( $terms ) ) {
|
193 |
-
$operator = ( isset( $scMeta[ 'term_operator_' . $taxonomy ][0] ) ? $scMeta[ 'term_operator_' . $taxonomy ][0] :
|
194 |
$taxQ[] = [
|
195 |
'taxonomy' => $taxonomy,
|
196 |
'field' => 'term_id',
|
197 |
'terms' => $terms,
|
198 |
'operator' => $operator,
|
199 |
];
|
|
|
200 |
if ( $taxonomy == $taxFilter ) {
|
201 |
$taxFilterOperator = $operator;
|
202 |
}
|
203 |
}
|
|
|
204 |
if ( $taxonomy == $taxFilter ) {
|
205 |
$taxFilterTerms = $terms;
|
206 |
}
|
207 |
}
|
208 |
}
|
|
|
209 |
if ( count( $taxQ ) >= 2 ) {
|
210 |
-
$relation = ( isset( $scMeta['taxonomy_relation'][0] ) ? $scMeta['taxonomy_relation'][0] :
|
211 |
$taxQ['relation'] = $relation;
|
212 |
}
|
213 |
}
|
@@ -216,16 +242,19 @@ class ShortcodeController {
|
|
216 |
$args['tax_query'] = $taxQ;
|
217 |
}
|
218 |
|
219 |
-
// Order
|
220 |
if ( in_array( 'order', $adv_filter ) ) {
|
221 |
$order_by = ( isset( $scMeta['order_by'][0] ) ? $scMeta['order_by'][0] : null );
|
222 |
$order = ( isset( $scMeta['order'][0] ) ? $scMeta['order'][0] : null );
|
|
|
223 |
if ( $order ) {
|
224 |
$args['order'] = $order;
|
225 |
}
|
|
|
226 |
if ( $order_by ) {
|
227 |
$args['orderby'] = $order_by;
|
228 |
$meta_key = ! empty( $scMeta['tpg_meta_key'][0] ) ? trim( $scMeta['tpg_meta_key'][0] ) : null;
|
|
|
229 |
if ( in_array( $order_by, array_keys( Options::rtMetaKeyType() ) ) && $meta_key ) {
|
230 |
$args['orderby'] = $order_by;
|
231 |
$args['meta_key'] = $meta_key;
|
@@ -233,32 +262,36 @@ class ShortcodeController {
|
|
233 |
}
|
234 |
}
|
235 |
|
236 |
-
// Status
|
237 |
if ( in_array( 'tpg_post_status', $adv_filter ) ) {
|
238 |
$post_status = ( isset( $scMeta['tpg_post_status'] ) ? $scMeta['tpg_post_status'] : [] );
|
|
|
239 |
if ( ! empty( $post_status ) ) {
|
240 |
$args['post_status'] = $post_status;
|
241 |
}
|
242 |
} else {
|
243 |
$args['post_status'] = 'publish';
|
244 |
}
|
245 |
-
|
|
|
246 |
$author = ( isset( $scMeta['author'] ) ? $scMeta['author'] : [] );
|
247 |
$filterAuthors = [];
|
|
|
248 |
if ( in_array( 'author', $adv_filter ) && ! empty( $author ) ) {
|
249 |
$filterAuthors = $args['author__in'] = $author;
|
250 |
}
|
251 |
|
252 |
-
// Search
|
253 |
$s = ( isset( $scMeta['s'][0] ) ? $scMeta['s'][0] : [] );
|
254 |
if ( in_array( 's', $adv_filter ) && ! empty( $s ) ) {
|
255 |
$args['s'] = $s;
|
256 |
}
|
257 |
|
258 |
-
// Date query
|
259 |
if ( in_array( 'date_range', $adv_filter ) ) {
|
260 |
$startDate = ( ! empty( $scMeta['date_range_start'][0] ) ? $scMeta['date_range_start'][0] : null );
|
261 |
$endDate = ( ! empty( $scMeta['date_range_end'][0] ) ? $scMeta['date_range_end'][0] : null );
|
|
|
262 |
if ( $startDate && $endDate ) {
|
263 |
$args['date_query'] = [
|
264 |
[
|
@@ -276,12 +309,14 @@ class ShortcodeController {
|
|
276 |
$oLayoutCategory = ! empty( $settings['template_category'] ) ? $settings['template_category'] : null;
|
277 |
$oLayoutSearch = ! empty( $settings['template_search'] ) ? $settings['template_search'] : null;
|
278 |
$dataArchive = null;
|
|
|
279 |
if ( ( is_category() && $oLayoutCategory ) || ( is_search() && $oLayoutSearch ) || ( is_tag() && $oLayoutTag ) || ( is_author() && $oLayoutAuthor ) ) {
|
280 |
unset( $args['post_type'] );
|
281 |
unset( $args['tax_query'] );
|
282 |
unset( $args['author__in'] );
|
283 |
$obj = get_queried_object();
|
284 |
$aType = $aValue = null;
|
|
|
285 |
if ( $oLayoutTag && is_tag() ) {
|
286 |
if ( ! empty( $obj->slug ) ) {
|
287 |
$aValue = $args['tag'] = $obj->slug;
|
@@ -299,21 +334,25 @@ class ShortcodeController {
|
|
299 |
$aValue = $args['s'] = get_search_query();
|
300 |
$aType = 'search';
|
301 |
}
|
|
|
302 |
$dataArchive = " data-archive='{$aType}' data-archive-value='{$aValue}'";
|
303 |
$args['posts_per_archive_page'] = $args['posts_per_page'];
|
304 |
}
|
305 |
|
306 |
-
// Validation
|
307 |
$containerDataAttr = null;
|
308 |
$containerDataAttr .= " data-layout='{$layout}' data-grid-style='{$gridStyle}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
|
309 |
|
310 |
$dCol = $dCol == 5 ? '24' : round( 12 / $dCol );
|
311 |
$tCol = $dCol == 5 ? '24' : round( 12 / $tCol );
|
312 |
$mCol = $dCol == 5 ? '24' : round( 12 / $mCol );
|
|
|
313 |
if ( $isCarousel ) {
|
314 |
$dCol = $tCol = $mCol = 12;
|
315 |
}
|
|
|
316 |
$arg['grid'] = "rt-col-md-{$dCol} rt-col-sm-{$tCol} rt-col-xs-{$mCol}";
|
|
|
317 |
if ( $layout == 'layout2' || $layout == 'layout3' ) {
|
318 |
$iCol = ( isset( $scMeta['tgp_layout2_image_column'][0] ) ? absint( $scMeta['tgp_layout2_image_column'][0] ) : 4 );
|
319 |
$iCol = $iCol > 12 ? 4 : $iCol;
|
@@ -321,70 +360,89 @@ class ShortcodeController {
|
|
321 |
$arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
|
322 |
$arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
|
323 |
} elseif ( $layout == 'layout4' ) {
|
324 |
-
$arg['image_area'] =
|
325 |
-
$arg['content_area'] =
|
326 |
}
|
|
|
327 |
$arg_class = [];
|
328 |
$gridType = ! empty( $scMeta['grid_style'][0] ) ? $scMeta['grid_style'][0] : 'even';
|
|
|
329 |
if ( $isIsotope && ! rtTPG()->hasPro() ) {
|
330 |
-
$arg_class[] =
|
331 |
} elseif ( ! $isCarousel && ! $isOffset ) {
|
332 |
-
$arg_class[] = $gridType .
|
333 |
}
|
334 |
-
|
|
|
|
|
335 |
if ( $isOffset ) {
|
336 |
-
$arg_class[] =
|
337 |
}
|
338 |
-
|
|
|
339 |
$catHaveBg = ( isset( $scMeta['tpg_category_bg'][0] ) ? $scMeta['tpg_category_bg'][0] : '' );
|
|
|
340 |
if ( ! empty( $catHaveBg ) ) {
|
341 |
$arg_class[] = 'category-have-bg';
|
342 |
}
|
343 |
-
|
|
|
344 |
$imgAnimationType = isset( $scMeta['tpg_image_animation'][0] ) ? $scMeta['tpg_image_animation'][0] : '';
|
|
|
345 |
if ( ! empty( $imgAnimationType ) ) {
|
346 |
$arg_class[] = $imgAnimationType;
|
347 |
}
|
348 |
|
349 |
$masonryG = null;
|
350 |
|
351 |
-
if ( $gridType ==
|
352 |
-
$masonryG =
|
353 |
-
} elseif ( $gridType ==
|
354 |
-
$masonryG =
|
355 |
}
|
|
|
356 |
$preLoader = $preLoaderHtml = null;
|
|
|
357 |
if ( $isIsotope ) {
|
358 |
$arg_class[] = 'isotope-item';
|
359 |
$preLoader = 'tpg-pre-loader';
|
360 |
}
|
|
|
361 |
if ( $isCarousel ) {
|
362 |
$arg_class[] = 'swiper-slide';
|
363 |
$preLoader = 'tpg-pre-loader';
|
364 |
}
|
|
|
365 |
if ( $preLoader && rtTPG()->hasPro() ) {
|
366 |
$preLoaderHtml = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>';
|
367 |
}
|
368 |
|
369 |
$margin = ! empty( $scMeta['margin_option'][0] ) ? $scMeta['margin_option'][0] : 'default';
|
|
|
370 |
if ( $margin == 'no' ) {
|
371 |
$arg_class[] = 'no-margin';
|
372 |
}
|
|
|
373 |
if ( ! empty( $scMeta['tpg_image_type'][0] ) && $scMeta['tpg_image_type'][0] == 'circle' ) {
|
374 |
$arg_class[] = 'tpg-img-circle';
|
375 |
}
|
376 |
-
|
|
|
377 |
$arg['anchorClass'] = $arg['link_target'] = null;
|
378 |
$link = isset( $scMeta['link_to_detail_page'][0] ) ? $scMeta['link_to_detail_page'][0] : '1';
|
379 |
$link = ( $link == 'yes' ) ? '1' : $link;
|
|
|
380 |
if ( ! $link ) {
|
381 |
$arg['anchorClass'] = ' disabled';
|
382 |
}
|
|
|
383 |
$isSinglePopUp = false;
|
384 |
$linkType = ! empty( $scMeta['detail_page_link_type'][0] ) ? $scMeta['detail_page_link_type'][0] : 'popup';
|
|
|
385 |
if ( $link == '1' ) {
|
386 |
if ( $linkType == 'popup' && rtTPG()->hasPro() ) {
|
387 |
$popupType = ! empty( $scMeta['popup_type'][0] ) ? $scMeta['popup_type'][0] : 'single';
|
|
|
388 |
if ( $popupType == 'single' ) {
|
389 |
$arg['anchorClass'] .= ' tpg-single-popup';
|
390 |
$isSinglePopUp = true;
|
@@ -399,12 +457,13 @@ class ShortcodeController {
|
|
399 |
$parentClass = ( ! empty( $scMeta['parent_class'][0] ) ? trim( $scMeta['parent_class'][0] ) : null );
|
400 |
$defaultImgId = ( ! empty( $scMeta['default_preview_image'][0] ) ? absint( $scMeta['default_preview_image'][0] ) : null );
|
401 |
$customImgSize = ( ! empty( $scMeta['custom_image_size'] ) ? $scMeta['custom_image_size'] : [] );
|
402 |
-
// Grid Hover Layout
|
403 |
-
$fSmallImgSize = ( isset( $scMeta['featured_small_image_size'][0] ) ? $scMeta['featured_small_image_size'][0] :
|
404 |
$customSmallImgSize = ( ! empty( $scMeta['custom_small_image_size'] ) ? $scMeta['custom_small_image_size'] : [] );
|
405 |
|
406 |
$arg['scID'] = $scID;
|
407 |
$arg['items'] = isset( $scMeta['item_fields'] ) ? ( $scMeta['item_fields'] ? $scMeta['item_fields'] : [] ) : [];
|
|
|
408 |
if ( in_array( 'cf', $arg['items'] ) ) {
|
409 |
$arg['cf_group'] = [];
|
410 |
$arg['cf_group'] = get_post_meta( $scID, 'cf_group' );
|
@@ -415,10 +474,11 @@ class ShortcodeController {
|
|
415 |
];
|
416 |
}
|
417 |
|
418 |
-
// Set readmore false if excerpt type = full content
|
419 |
if ( isset( $arg['excerpt_type'] ) && $arg['excerpt_type'] === 'full' && ( $key = array_search( 'read_more', $arg['items'] ) ) !== false ) {
|
420 |
unset( $arg['items'][ $key ] );
|
421 |
}
|
|
|
422 |
if ( empty( $scMeta['ignore_sticky_posts'][0] ) ) {
|
423 |
$args['ignore_sticky_posts'] = true;
|
424 |
} else {
|
@@ -428,17 +488,20 @@ class ShortcodeController {
|
|
428 |
$filters = ! empty( $scMeta['tgp_filter'] ) ? $scMeta['tgp_filter'] : [];
|
429 |
$action_term = ! empty( $scMeta['tgp_default_filter'][0] ) ? absint( $scMeta['tgp_default_filter'][0] ) : 0;
|
430 |
$hide_all_button = ! empty( $scMeta['tpg_hide_all_button'][0] ) ? true : false;
|
|
|
431 |
if ( $taxHierarchical ) {
|
432 |
$terms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, 0 );
|
433 |
} else {
|
434 |
$terms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true );
|
435 |
}
|
|
|
436 |
if ( $hide_all_button && ! $action_term ) {
|
437 |
if ( ! empty( $terms ) ) {
|
438 |
$allKeys = array_keys( $terms );
|
439 |
$action_term = $allKeys[0];
|
440 |
}
|
441 |
}
|
|
|
442 |
if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter && $action_term ) {
|
443 |
$args['tax_query'] = [
|
444 |
[
|
@@ -455,6 +518,7 @@ class ShortcodeController {
|
|
455 |
$tempArgs['paged'] = 1;
|
456 |
$tempArgs['fields'] = 'ids';
|
457 |
$tempQ = new \WP_Query( $tempArgs );
|
|
|
458 |
if ( ! empty( $tempQ->posts ) ) {
|
459 |
$args['post__in'] = $tempQ->posts;
|
460 |
}
|
@@ -463,16 +527,16 @@ class ShortcodeController {
|
|
463 |
if ( $pagination && $queryOffset && isset( $args['paged'] ) ) {
|
464 |
$queryOffset = ( $posts_per_page * ( $args['paged'] - 1 ) ) + $queryOffset;
|
465 |
}
|
|
|
466 |
if ( $queryOffset ) {
|
467 |
$args['offset'] = $queryOffset;
|
468 |
}
|
469 |
|
470 |
-
$arg['title_tag'] = ( ! empty( $scMeta['title_tag'][0] ) && in_array( $scMeta['title_tag'][0], array_keys( Options::getTitleTags() ) ) )
|
471 |
-
? esc_attr( $scMeta['title_tag'][0] ) : 'h3';
|
472 |
|
473 |
$gridQuery = new \WP_Query( apply_filters( 'tpg_sc_query_args', $args, $scMeta ) );
|
474 |
|
475 |
-
// Start layout
|
476 |
$html .= Fns::layoutStyle( $layoutID, $scMeta, $layout, $scID );
|
477 |
$containerDataAttr .= " data-sc-id='{$scID}'";
|
478 |
|
@@ -483,12 +547,13 @@ class ShortcodeController {
|
|
483 |
$carousel_nav = ! empty( $scMeta['carousel_property'] ) ? $scMeta['carousel_property'] : [];
|
484 |
$is_nav = in_array( 'nav_button', $carousel_nav );
|
485 |
|
486 |
-
|
487 |
if ( $isCarousel ) {
|
488 |
$parentClass .= ' tpg-carousel-main';
|
|
|
489 |
if ( $is_nav ) {
|
490 |
$parentClass .= ' tpg-has-nav';
|
491 |
}
|
|
|
492 |
$cOptMeta = ! empty( $scMeta['carousel_property'] ) ? $scMeta['carousel_property'] : [];
|
493 |
|
494 |
if ( in_array( 'lazy_load', $cOptMeta ) ) {
|
@@ -502,7 +567,7 @@ class ShortcodeController {
|
|
502 |
|
503 |
$html .= "<div class='rt-container-fluid rt-tpg-container tpg-shortcode-main-wrapper {$parentClass}' id='{$layoutID}' {$dataArchive} {$containerDataAttr}>";
|
504 |
|
505 |
-
// widget heading
|
506 |
$heading_tag = isset( $scMeta['tpg_heading_tag'][0] ) ? $scMeta['tpg_heading_tag'][0] : 'h2';
|
507 |
$heading_style = isset( $scMeta['tpg_heading_style'][0] ) && ! empty( $scMeta['tpg_heading_style'][0] ) ? $scMeta['tpg_heading_style'][0] : 'style1';
|
508 |
$heading_alignment = isset( $scMeta['tpg_heading_alignment'][0] ) ? $scMeta['tpg_heading_alignment'][0] : '';
|
@@ -511,11 +576,13 @@ class ShortcodeController {
|
|
511 |
if ( ! empty( $arg['items'] ) && in_array( 'heading', $arg['items'] ) ) {
|
512 |
$html .= sprintf( '<div class="tpg-widget-heading-wrapper heading-%1$s %2$s">', $heading_style, $heading_alignment );
|
513 |
$html .= '<span class="tpg-widget-heading-line line-left"></span>';
|
|
|
514 |
if ( $heading_link ) {
|
515 |
$html .= sprintf( '<%1$s class="tpg-widget-heading"><a href="%2$s" title="%3$s">%3$s</a></%1$s>', $heading_tag, $heading_link, get_the_title() );
|
516 |
} else {
|
517 |
$html .= sprintf( '<%1$s class="tpg-widget-heading">%2$s</%1$s>', $heading_tag, get_the_title( $scID ) );
|
518 |
}
|
|
|
519 |
$html .= '<span class="tpg-widget-heading-line"></span>';
|
520 |
$html .= '</div>';
|
521 |
}
|
@@ -523,66 +590,81 @@ class ShortcodeController {
|
|
523 |
if ( ! $isCarousel && isset( $settings['tpg_enable_preloader'] ) ) {
|
524 |
$html .= '<div id="bottom-script-loader" class="bottom-script-loader"><div class="rt-ball-clip-rotate"><div></div></div></div>';
|
525 |
}
|
|
|
526 |
if ( ! empty( $filters ) && ( $isGrid || $isOffset || $isWooCom || $isEdd ) ) {
|
527 |
$html .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
|
528 |
$selectedSubTermsForButton = null;
|
529 |
-
$allText = apply_filters( 'tpg_filter_all_text',
|
|
|
530 |
if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter ) {
|
531 |
$filterType = ( ! empty( $scMeta['tgp_filter_type'][0] ) ? $scMeta['tgp_filter_type'][0] : null );
|
532 |
$post_count = ( ! empty( $scMeta['tpg_post_count'][0] ) ? $scMeta['tpg_post_count'][0] : null );
|
533 |
-
$postCountClass = ( $post_count ?
|
534 |
-
$allSelect =
|
535 |
$isTermSelected = false;
|
|
|
536 |
if ( $action_term && $taxFilter ) {
|
537 |
$isTermSelected = true;
|
538 |
$allSelect = null;
|
539 |
}
|
|
|
540 |
if ( ! $filterType || $filterType == 'dropdown' ) {
|
541 |
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
542 |
$termDefaultText = $allText;
|
543 |
$dataTerm = 'all';
|
544 |
-
$htmlButton =
|
545 |
$selectedSubTerms = null;
|
546 |
$pCount = 0;
|
|
|
547 |
if ( ! empty( $terms ) ) {
|
548 |
$i = 0;
|
|
|
549 |
foreach ( $terms as $id => $term ) {
|
550 |
$pCount = $pCount + $term['count'];
|
551 |
$sT = null;
|
|
|
552 |
if ( $taxHierarchical ) {
|
553 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
|
|
554 |
if ( ! empty( $subTerms ) ) {
|
555 |
$count = 0;
|
556 |
$item = $allCount = null;
|
|
|
557 |
foreach ( $subTerms as $stId => $t ) {
|
558 |
$count = $count + absint( $t['count'] );
|
559 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
560 |
$item .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$stId}'><span class='rt-text'>{$t['name']}{$sTPostCount}</span></span>";
|
561 |
}
|
|
|
562 |
if ( $post_count ) {
|
563 |
$allCount = " (<span class='rt-post-count'>{$count}</span>)";
|
564 |
}
|
|
|
565 |
$sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
|
566 |
$sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
$sT .= '<span class="term-dropdown rt-filter-dropdown">';
|
571 |
$sT .= $item;
|
572 |
$sT .= '</span>';
|
573 |
-
$sT .=
|
574 |
}
|
|
|
575 |
if ( $action_term === $id ) {
|
576 |
$selectedSubTerms = $sT;
|
577 |
}
|
578 |
}
|
|
|
579 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
|
|
580 |
if ( $action_term && $action_term == $id ) {
|
581 |
$termDefaultText = $term['name'] . $postCount;
|
582 |
$dataTerm = $id;
|
583 |
}
|
|
|
584 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
585 |
-
if ( $taxFilterOperator ==
|
586 |
if ( ! in_array( $id, $taxFilterTerms ) && $action_term != $id ) {
|
587 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
588 |
}
|
@@ -594,26 +676,28 @@ class ShortcodeController {
|
|
594 |
} else {
|
595 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
596 |
}
|
|
|
597 |
$i ++;
|
598 |
}
|
599 |
}
|
600 |
$pAllCount = null;
|
|
|
601 |
if ( $post_count ) {
|
602 |
$pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
|
603 |
if ( ! $action_term ) {
|
604 |
$termDefaultText = $termDefaultText . $pAllCount;
|
605 |
}
|
606 |
}
|
|
|
607 |
if ( ! $hide_all_button ) {
|
608 |
-
$htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText
|
609 |
-
. "{$pAllCount}</span></span>" . $htmlButton;
|
610 |
}
|
611 |
$htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
|
612 |
|
613 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
|
618 |
$html .= $showAllhtml . $htmlButton;
|
619 |
$html .= '</div>' . $selectedSubTerms;
|
@@ -621,31 +705,39 @@ class ShortcodeController {
|
|
621 |
$termDefaultText = $allText;
|
622 |
$bCount = 0;
|
623 |
$bItems = null;
|
|
|
624 |
if ( ! empty( $terms ) ) {
|
625 |
foreach ( $terms as $id => $term ) {
|
626 |
$bCount = $bCount + absint( $term['count'] );
|
627 |
$sT = null;
|
|
|
628 |
if ( $taxHierarchical ) {
|
629 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
630 |
if ( ! empty( $subTerms ) ) {
|
631 |
$sT .= "<div class='rt-filter-sub-tax sub-button-group'>";
|
|
|
632 |
foreach ( $subTerms as $stId => $t ) {
|
633 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
634 |
$sT .= "<span class='rt-filter-button-item' data-term='{$stId}'>{$t['name']}{$sTPostCount}</span>";
|
635 |
}
|
636 |
-
|
|
|
|
|
637 |
if ( $action_term === $id ) {
|
638 |
$selectedSubTermsForButton = $sT;
|
639 |
}
|
640 |
}
|
641 |
}
|
|
|
642 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
643 |
$termSelected = null;
|
|
|
644 |
if ( $isTermSelected && $id == $action_term ) {
|
645 |
-
$termSelected =
|
646 |
}
|
|
|
647 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
648 |
-
if ( $taxFilterOperator ==
|
649 |
if ( ! in_array( $id, $taxFilterTerms ) ) {
|
650 |
$bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
|
651 |
}
|
@@ -659,34 +751,40 @@ class ShortcodeController {
|
|
659 |
}
|
660 |
}
|
661 |
}
|
|
|
662 |
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
|
|
663 |
if ( ! $hide_all_button ) {
|
664 |
$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
665 |
$html .= "<span class='term-button-item rt-filter-button-item {$allSelect}' data-term='all'>" . $allText . "{$pCountH}</span>";
|
666 |
}
|
|
|
667 |
$html .= $bItems;
|
668 |
-
$html .=
|
669 |
}
|
670 |
}
|
671 |
|
672 |
-
// Author filter
|
673 |
if ( in_array( '_author_filter', $filters ) ) {
|
674 |
$filterType = ( ! empty( $scMeta['tgp_filter_type'][0] ) ? $scMeta['tgp_filter_type'][0] : null );
|
675 |
$post_count = ( ! empty( $scMeta['tpg_post_count'][0] ) ? $scMeta['tpg_post_count'][0] : null );
|
676 |
$users = get_users( apply_filters( 'tpg_author_arg', [] ) );
|
677 |
|
678 |
-
$allSelect =
|
679 |
$isTermSelected = false;
|
|
|
680 |
if ( $action_term && $taxFilter ) {
|
681 |
$isTermSelected = true;
|
682 |
$allSelect = null;
|
683 |
}
|
|
|
684 |
if ( ! $filterType || $filterType == 'dropdown' ) {
|
685 |
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}'>";
|
686 |
$termDefaultText = $allText;
|
687 |
$dataAuthor = 'all';
|
688 |
-
$htmlButton =
|
689 |
$htmlButton .= '<span class="author-dropdown rt-filter-dropdown">';
|
|
|
690 |
if ( ! empty( $users ) ) {
|
691 |
foreach ( $users as $user ) {
|
692 |
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
@@ -715,9 +813,9 @@ class ShortcodeController {
|
|
715 |
$htmlButton .= '</span>';
|
716 |
|
717 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
|
722 |
$html .= $showAllhtml . $htmlButton;
|
723 |
$html .= '</div>';
|
@@ -735,58 +833,64 @@ class ShortcodeController {
|
|
735 |
}
|
736 |
}
|
737 |
}
|
|
|
738 |
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
|
|
739 |
if ( ! $hide_all_button ) {
|
740 |
$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
741 |
$html .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . "{$pCountH}</span>";
|
742 |
}
|
|
|
743 |
$html .= $bItems;
|
744 |
-
$html .=
|
745 |
}
|
746 |
}
|
747 |
|
748 |
if ( in_array( '_search', $filters ) ) {
|
749 |
$html .= '<div class="rt-filter-item-wrap rt-search-filter-wrap">';
|
750 |
-
$html .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__(
|
751 |
$html .= "<span class='rt-action'>🔍</span>";
|
752 |
$html .= "<span class='rt-loading'></span>";
|
753 |
$html .= '</div>';
|
754 |
}
|
755 |
|
756 |
if ( in_array( '_order_by', $filters ) ) {
|
757 |
-
$wooFeature = ( $postType ==
|
758 |
$orders = Options::rtPostOrderBy( $wooFeature );
|
759 |
-
$action_orderby = ( ! empty( $args['orderby'] ) ? trim( $args['orderby'] ) :
|
|
|
760 |
if ( $action_orderby == 'ID' ) {
|
761 |
$action_orderby = 'title';
|
762 |
}
|
|
|
763 |
if ( $action_orderby == 'none' ) {
|
764 |
-
$action_orderby_label =
|
765 |
} elseif ( in_array( $action_orderby, array_keys( Options::rtMetaKeyType() ) ) ) {
|
766 |
-
$action_orderby_label =
|
767 |
} else {
|
768 |
$action_orderby_label = $orders[ $action_orderby ];
|
769 |
}
|
770 |
|
771 |
if ( $action_orderby !== 'none' ) {
|
772 |
-
$orders['none'] =
|
773 |
}
|
774 |
$html .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap">';
|
775 |
$html .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
$html .= '<span class="order-by-dropdown rt-filter-dropdown">';
|
780 |
|
781 |
foreach ( $orders as $orderKey => $order ) {
|
782 |
$html .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
|
783 |
}
|
|
|
784 |
$html .= '</span>';
|
785 |
$html .= '</div>';
|
786 |
}
|
787 |
|
788 |
if ( in_array( '_sort_order', $filters ) ) {
|
789 |
-
$action_order = ( ! empty( $args['order'] ) ? strtoupper( trim( $args['order'] ) ) :
|
790 |
$html .= '<div class="rt-filter-item-wrap rt-sort-order-action">';
|
791 |
$html .= "<span class='rt-sort-order-action-arrow' data-sort-order='{$action_order}'> <span></span></span>";
|
792 |
$html .= '</div>';
|
@@ -795,30 +899,33 @@ class ShortcodeController {
|
|
795 |
$html .= "</div>$selectedSubTermsForButton</div>";
|
796 |
}
|
797 |
|
798 |
-
$html .= "<div data-title='" .
|
799 |
-
'the-post-grid' ) . "' class='rt-row rt-content-loader {$layout}{$masonryG} {$preLoader}'>";
|
800 |
-
|
801 |
-
$not_found_text = isset( $scMeta['tgp_not_found_text'][0] ) && ! empty( $scMeta['tgp_not_found_text'][0] ) ? esc_html( $scMeta['tgp_not_found_text'][0] )
|
802 |
-
: __( 'No post found', 'the-post-grid' );
|
803 |
|
|
|
804 |
|
805 |
if ( $gridQuery->have_posts() ) {
|
806 |
$is_lazy_load = '';
|
|
|
807 |
if ( $isCarousel ) {
|
808 |
$cOpt = ! empty( $scMeta['carousel_property'] ) ? $scMeta['carousel_property'] : [];
|
809 |
-
$slider_js_options = apply_filters(
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
|
|
|
|
|
|
|
|
|
|
822 |
htmlspecialchars( wp_json_encode( $slider_js_options ) ),
|
823 |
$slider_js_options['rtl']
|
824 |
);
|
@@ -826,19 +933,25 @@ class ShortcodeController {
|
|
826 |
if ( in_array( 'lazy_load', $cOpt ) ) {
|
827 |
$is_lazy_load = 'swiper-lazy';
|
828 |
}
|
829 |
-
|
830 |
}
|
|
|
831 |
$isotope_filter = null;
|
|
|
832 |
if ( $isIsotope ) {
|
833 |
$isotope_filter = isset( $scMeta['isotope_filter'][0] ) ? $scMeta['isotope_filter'][0] : null;
|
834 |
$isotope_dropdown_filter = isset( $scMeta['isotope_filter_dropdown'][0] ) ? $scMeta['isotope_filter_dropdown'][0] : null;
|
835 |
$selectedTerms = [];
|
|
|
836 |
if ( isset( $scMeta['post_filter'] )
|
837 |
-
&& in_array(
|
838 |
-
|
|
|
|
|
839 |
&& isset( $scMeta['tpg_taxonomy'] )
|
840 |
-
&& in_array(
|
841 |
-
|
|
|
|
|
842 |
) {
|
843 |
$selectedTerms = ( isset( $scMeta[ 'term_' . $isotope_filter ] ) ? $scMeta[ 'term_' . $isotope_filter ] : [] );
|
844 |
}
|
@@ -849,9 +962,11 @@ class ShortcodeController {
|
|
849 |
'hide_empty' => false,
|
850 |
'include' => $selectedTerms,
|
851 |
];
|
|
|
852 |
if ( rtTPG()->hasPro() ) {
|
853 |
$termArgs['meta_key'] = '_rt_order';
|
854 |
}
|
|
|
855 |
$terms = get_terms( $termArgs );
|
856 |
|
857 |
$html .= '<div class="tpg-iso-filter">';
|
@@ -862,24 +977,29 @@ class ShortcodeController {
|
|
862 |
foreach ( $terms as $term ) {
|
863 |
$tItem = ! empty( $scMeta['isotope_default_filter'][0] ) ? $scMeta['isotope_default_filter'][0] : null;
|
864 |
$fSelected = null;
|
|
|
865 |
if ( $tItem == $term->term_id ) {
|
866 |
$fSelected = 'selected';
|
867 |
$fSelectTrigger = true;
|
868 |
}
|
869 |
-
|
|
|
|
|
870 |
esc_attr( $term->slug ),
|
871 |
-
$fSelected ?
|
872 |
$term->term_id,
|
873 |
$term->name
|
874 |
);
|
875 |
$drop .= "<option value='.iso_{$term->term_id}' {$fSelected}>{$term->name}</option>";
|
876 |
}
|
877 |
}
|
|
|
878 |
if ( empty( $scMeta['isotope_filter_show_all'][0] ) ) {
|
879 |
$fSelect = ( $fSelectTrigger ? null : 'class="selected"' );
|
880 |
-
$htmlButton = "<button class='rt-iso-btn-all selected' data-filter='*'>" . $arg['show_all_text'] .
|
881 |
$drop = "<option value='*' {$fSelect}>{$arg['show_all_text']}</option>" . $drop;
|
882 |
}
|
|
|
883 |
$filter_count = ! empty( $scMeta['isotope_filter_count'][0] ) ? true : false;
|
884 |
$filter_url = ! empty( $scMeta['isotope_filter_url'][0] ) ? true : false;
|
885 |
$htmlButton = "<div id='iso-button-{$rand}' class='rt-tpg-isotope-buttons button-group filter-button-group option-set' data-url='{$filter_url}' data-count='{$filter_count}'>{$htmlButton}</div>";
|
@@ -889,10 +1009,11 @@ class ShortcodeController {
|
|
889 |
} else {
|
890 |
$html .= $htmlButton;
|
891 |
}
|
|
|
892 |
if ( ! empty( $scMeta['isotope_search_filter'][0] ) ) {
|
893 |
-
$html .= "<div class='iso-search'><input type='text' class='iso-search-input' placeholder='" .
|
894 |
-
'the-post-grid' ) . "' /></div>";
|
895 |
}
|
|
|
896 |
$html .= '</div>';
|
897 |
$html .= "<div class='rt-tpg-isotope' id='iso-tpg-{$rand}'>";
|
898 |
}
|
@@ -902,15 +1023,19 @@ class ShortcodeController {
|
|
902 |
$gridPostCount = 0;
|
903 |
$arg['totalPost'] = $gridQuery->post_count;
|
904 |
|
905 |
-
while ( $gridQuery->have_posts() ) :
|
|
|
|
|
906 |
if ( $colStore == $l ) {
|
907 |
if ( $this->l4toggle ) {
|
908 |
$this->l4toggle = false;
|
909 |
} else {
|
910 |
$this->l4toggle = true;
|
911 |
}
|
|
|
912 |
$l = 0;
|
913 |
}
|
|
|
914 |
$arg['postCount'] = $gridPostCount ++;
|
915 |
$pID = get_the_ID();
|
916 |
$arg['pID'] = $pID;
|
@@ -918,8 +1043,10 @@ class ShortcodeController {
|
|
918 |
$arg['pLink'] = get_permalink();
|
919 |
$arg['toggle'] = $this->l4toggle;
|
920 |
$arg['layoutID'] = $layoutID;
|
921 |
-
$arg['author'] = apply_filters(
|
922 |
-
|
|
|
|
|
923 |
$comments_number = get_comments_number( $pID );
|
924 |
$comments_text = sprintf( '(%s)', number_format_i18n( $comments_number ) );
|
925 |
|
@@ -929,120 +1056,152 @@ class ShortcodeController {
|
|
929 |
$arg['tags'] = get_the_term_list( $pID, 'post_tag', null, '<span class="rt-separator">,</span>' );
|
930 |
$arg['post_count'] = get_post_meta( $pID, Fns::get_post_view_count_meta_key(), true );
|
931 |
$arg['responsiveCol'] = [ $dCol, $tCol, $mCol ];
|
|
|
932 |
if ( $isIsotope ) {
|
933 |
-
$termAs = wp_get_post_terms( $pID, $isotope_filter, [
|
934 |
$isoFilter = [];
|
|
|
935 |
if ( ! empty( $termAs ) ) {
|
936 |
foreach ( $termAs as $term ) {
|
937 |
-
$isoFilter[] =
|
938 |
-
$isoFilter[] =
|
939 |
}
|
940 |
}
|
941 |
-
|
|
|
942 |
}
|
|
|
943 |
if ( comments_open() ) {
|
944 |
$arg['comment'] = "<a href='" . get_comments_link( $pID ) . "'>{$comments_text} </a>";
|
945 |
} else {
|
946 |
$arg['comment'] = "{$comments_text}";
|
947 |
}
|
948 |
-
$imgSrc = null;
|
949 |
|
950 |
-
|
951 |
|
952 |
-
|
953 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
954 |
if ( $isOffset ) {
|
955 |
if ( $offLoop == 0 ) {
|
956 |
-
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
|
|
|
|
|
|
957 |
$defaultImgId,
|
958 |
-
$customImgSize
|
|
|
959 |
$arg['offset'] = 'big';
|
960 |
$offsetBigHtml = Fns::get_template_html( 'layouts/' . $layout, $arg );
|
961 |
} else {
|
962 |
$arg['offset'] = 'small';
|
963 |
$arg['offsetCol'] = [ $dCol, $tCol, $mCol ];
|
964 |
-
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
|
|
|
|
965 |
$mediaSource,
|
966 |
$defaultImgId,
|
967 |
-
$customImgSize
|
|
|
968 |
$offsetSmallHtml .= Fns::get_template_html( 'layouts/' . $layout, $arg );
|
969 |
}
|
970 |
} else {
|
971 |
-
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
|
|
|
|
|
|
972 |
$defaultImgId,
|
973 |
-
$customImgSize,
|
|
|
|
|
974 |
$html .= Fns::get_template_html( 'layouts/' . $layout, $arg );
|
975 |
}
|
|
|
976 |
$offLoop ++;
|
977 |
$l ++;
|
978 |
endwhile;
|
|
|
979 |
if ( $isOffset ) {
|
980 |
$oDCol = Fns::get_offset_col( $dCol );
|
981 |
$oTCol = Fns::get_offset_col( $tCol );
|
982 |
$oMCol = Fns::get_offset_col( $mCol );
|
983 |
-
|
|
|
984 |
$oDCol['big'] = $oTCol['big'] = $oDCol['small'] = $oTCol['small'] = 6;
|
985 |
$oMCol['big'] = $oMCol['small'] = 12;
|
986 |
-
} elseif ( $layout ==
|
987 |
$oDCol['big'] = 7;
|
988 |
$oDCol['small'] = 5;
|
989 |
}
|
|
|
990 |
$html .= "<div class='rt-col-md-{$oDCol['big']} rt-col-sm-{$oTCol['big']} rt-col-xs-{$oMCol['big']}'><div class='rt-row'>{$offsetBigHtml}</div></div>";
|
991 |
$html .= "<div class='rt-col-md-{$oDCol['small']} rt-col-sm-{$oTCol['small']} rt-col-xs-{$oMCol['small']}'><div class='rt-row offset-small-wrap'>{$offsetSmallHtml}</div></div>";
|
992 |
}
|
|
|
993 |
if ( $isIsotope || $isCarousel ) {
|
994 |
-
$html .= '</div>'; // End isotope / Carousel item holder
|
995 |
|
996 |
if ( $isIsotope ) {
|
997 |
$html .= '<div class="isotope-term-no-post"><p>' . $not_found_text . '</p></div>';
|
998 |
}
|
999 |
-
if ( $isCarousel ) {
|
1000 |
|
|
|
1001 |
$html .= '</div>';
|
1002 |
|
1003 |
if ( in_array( 'pagination', $cOpt ) ) {
|
1004 |
$html .= '<div class="swiper-pagination"></div>';
|
1005 |
}
|
|
|
1006 |
if ( in_array( 'nav_button', $cOpt ) ) {
|
1007 |
$html .= '<div class="swiper-navigation"><div class="slider-btn swiper-button-prev"></div><div class="slider-btn swiper-button-next"></div></div>';
|
1008 |
}
|
1009 |
}
|
1010 |
}
|
1011 |
} else {
|
1012 |
-
|
1013 |
-
|
1014 |
apply_filters( 'tpg_not_found_text', $not_found_text, $args, $scMeta )
|
1015 |
);
|
1016 |
}
|
|
|
1017 |
$html .= $preLoaderHtml;
|
1018 |
-
$html .=
|
1019 |
$htmlUtility = null;
|
|
|
1020 |
if ( $pagination && ! $isCarousel ) {
|
1021 |
if ( $isOffset || $isGridHover ) {
|
1022 |
-
$posts_loading_type =
|
1023 |
$htmlUtility .= "<div class='rt-cb-page-prev-next'>
|
1024 |
<span class='rt-cb-prev-btn'><i class='fa fa-angle-left' aria-hidden='true'></i></span>
|
1025 |
<span class='rt-cb-next-btn'><i class='fa fa-angle-right' aria-hidden='true'></i></span>
|
1026 |
</div>";
|
1027 |
} else {
|
1028 |
-
$hide = ( $gridQuery->max_num_pages < 2 ?
|
1029 |
-
if ( $posts_loading_type ==
|
1030 |
if ( ( $isGrid || $isWooCom || $isEdd ) && empty( $filters ) ) {
|
1031 |
-
$htmlUtility .= Fns::rt_pagination(
|
1032 |
-
$
|
|
|
|
|
1033 |
}
|
1034 |
-
} elseif ( $posts_loading_type ==
|
1035 |
$htmlUtility .= "<div class='rt-page-numbers'></div>";
|
1036 |
-
} elseif ( $posts_loading_type ==
|
1037 |
-
$load_more_btn_text = ( ! empty( $scMeta['load_more_text'][0] ) ? $scMeta['load_more_text'][0] :
|
1038 |
-
$load_more_text = $load_more_btn_text ? esc_html( $load_more_btn_text ) :
|
1039 |
|
1040 |
$htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style{$hide}'>
|
1041 |
<span class='rt-loadmore-text'>" . $load_more_text . "</span>
|
1042 |
<div class='rt-loadmore-loading rt-ball-scale-multiple rt-2x'><div></div><div></div><div></div></div>
|
1043 |
</div>";
|
1044 |
-
} elseif ( $posts_loading_type ==
|
1045 |
-
$htmlUtility .= "<div class='rt-infinite-action'>
|
1046 |
<div class='rt-infinite-loading la-fire la-2x'>
|
1047 |
<div></div>
|
1048 |
<div></div>
|
@@ -1055,14 +1214,13 @@ class ShortcodeController {
|
|
1055 |
|
1056 |
if ( $htmlUtility ) {
|
1057 |
$l4toggle = null;
|
1058 |
-
if ( $layout ==
|
1059 |
$l4toggle = "data-l4toggle='{$this->l4toggle}'";
|
1060 |
}
|
1061 |
-
$html .= "<div class='rt-pagination-wrap' data-total-pages='{$gridQuery->max_num_pages}' data-posts-per-page='{$args['posts_per_page']}' data-type='{$posts_loading_type}' {$l4toggle} >"
|
1062 |
-
. $htmlUtility . "</div>";
|
1063 |
}
|
1064 |
|
1065 |
-
$html .=
|
1066 |
|
1067 |
wp_reset_postdata();
|
1068 |
|
@@ -1077,22 +1235,23 @@ class ShortcodeController {
|
|
1077 |
|
1078 |
add_action( 'wp_footer', [ $this, 'register_sc_scripts' ] );
|
1079 |
|
1080 |
-
//Script Load Conditionally
|
1081 |
$script = [];
|
1082 |
$style = [];
|
1083 |
|
1084 |
array_push( $script, 'jquery' );
|
1085 |
array_push( $style, 'rt-fontawsome' );
|
|
|
1086 |
if ( 'masonry' == $gridType || $isIsotope ) {
|
1087 |
array_push( $script, 'rt-isotope-js' );
|
1088 |
}
|
|
|
1089 |
array_push( $script, 'imagesloaded' );
|
1090 |
array_push( $script, 'rt-tpg' );
|
1091 |
|
1092 |
-
//Pro Scripts and Styles
|
1093 |
if ( rtTPG()->hasPro() ) {
|
1094 |
|
1095 |
-
|
1096 |
if ( isset( $posts_loading_type ) && 'pagination_ajax' == $posts_loading_type ) {
|
1097 |
array_push( $script, 'rt-pagination' );
|
1098 |
}
|
@@ -1102,7 +1261,6 @@ class ShortcodeController {
|
|
1102 |
array_push( $script, 'rt-magnific-popup' );
|
1103 |
}
|
1104 |
|
1105 |
-
// var_dump( $linkType );
|
1106 |
if ( 'popup' == $linkType ) {
|
1107 |
array_push( $script, 'rt-scrollbar' );
|
1108 |
}
|
@@ -1110,7 +1268,6 @@ class ShortcodeController {
|
|
1110 |
if ( class_exists( 'WooCommerce' ) ) {
|
1111 |
array_push( $script, 'rt-jzoom' );
|
1112 |
}
|
1113 |
-
|
1114 |
}
|
1115 |
|
1116 |
array_push( $style, 'rt-tpg-shortcode' );
|
@@ -1131,31 +1288,32 @@ class ShortcodeController {
|
|
1131 |
wp_enqueue_script( $script );
|
1132 |
|
1133 |
} else {
|
1134 |
-
$html .=
|
1135 |
}
|
1136 |
|
1137 |
-
//restriction issue
|
1138 |
$restriction = ( ! empty( $scMeta['restriction_user_role'] ) ? $scMeta['restriction_user_role'] : [] );
|
1139 |
if ( ! empty( $restriction ) ) {
|
1140 |
if ( is_user_logged_in() ) {
|
1141 |
$currentUserRoles = Fns::getCurrentUserRoles();
|
|
|
1142 |
if ( in_array( 'administrator', $currentUserRoles ) ) {
|
1143 |
$html = $html;
|
1144 |
} else {
|
1145 |
if ( count( array_intersect( $restriction, $currentUserRoles ) ) ) {
|
1146 |
$html = $html;
|
1147 |
} else {
|
1148 |
-
$html =
|
1149 |
-
|
|
|
|
|
1150 |
}
|
1151 |
}
|
1152 |
} else {
|
1153 |
-
$html =
|
1154 |
-
"the-post-grid" ) . "</p>";
|
1155 |
}
|
1156 |
}
|
1157 |
|
1158 |
return $html;
|
1159 |
}
|
1160 |
-
|
1161 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Shortcode Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers;
|
9 |
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
use RT\ThePostGrid\Helpers\Options;
|
12 |
|
13 |
+
// Do not allow directly accessing this file.
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit( 'This script cannot be accessed directly.' );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Shortcode Controller class.
|
20 |
+
*/
|
21 |
class ShortcodeController {
|
22 |
private $scA = [];
|
23 |
private $l4toggle = false;
|
24 |
|
25 |
public function __construct() {
|
26 |
+
add_shortcode( 'the-post-grid', [ $this, 'the_post_grid_short_code' ] );
|
27 |
+
add_action( 'pre_get_posts', [ $this, 'make_sticky_work' ] );
|
28 |
}
|
29 |
|
30 |
public function make_sticky_work( $q ) {
|
35 |
|
36 |
public function register_sc_scripts() {
|
37 |
$settings = get_option( rtTPG()->options['settings'] );
|
38 |
+
$caro = $isSinglePopUp = false;
|
39 |
+
$ajaxurl = '';
|
40 |
|
|
|
|
|
|
|
41 |
if ( in_array( 'sitepress-multilingual-cms/sitepress.php', get_option( 'active_plugins' ) ) ) {
|
42 |
$ajaxurl .= admin_url( 'admin-ajax.php?lang=' . ICL_LANGUAGE_CODE );
|
43 |
} else {
|
44 |
$ajaxurl .= admin_url( 'admin-ajax.php' );
|
45 |
}
|
46 |
+
|
47 |
$variables = [
|
48 |
+
'nonceID' => esc_attr( rtTPG()->nonceId() ),
|
49 |
+
'nonce' => esc_attr( wp_create_nonce( rtTPG()->nonceText() ) ),
|
50 |
+
'ajaxurl' => esc_url( $ajaxurl ),
|
51 |
];
|
52 |
|
|
|
53 |
foreach ( $this->scA as $sc ) {
|
54 |
if ( isset( $sc ) && is_array( $sc ) ) {
|
55 |
if ( $sc['isSinglePopUp'] ) {
|
56 |
$isSinglePopUp = true;
|
57 |
}
|
58 |
+
|
59 |
if ( $sc['isWooCom'] ) {
|
60 |
$variables['woocommerce_enable_ajax_add_to_cart'] = get_option( 'woocommerce_enable_ajax_add_to_cart' );
|
61 |
$variables['woocommerce_cart_redirect_after_add'] = get_option( 'woocommerce_cart_redirect_after_add' );
|
63 |
}
|
64 |
}
|
65 |
if ( count( $this->scA ) ) {
|
|
|
66 |
wp_localize_script( 'rt-tpg', 'rttpg', $variables );
|
67 |
|
68 |
do_action( 'tpg_after_script', $isSinglePopUp );
|
71 |
if ( $isSinglePopUp && rtTPG()->hasPro() ) {
|
72 |
$html = null;
|
73 |
$html .= '<div class="md-modal rt-md-effect" id="rt-modal">
|
74 |
+
<div class="md-content">
|
75 |
+
<div class="rt-md-content-holder">
|
76 |
|
|
|
|
|
|
|
|
|
77 |
</div>
|
78 |
+
<div class="md-cls-btn">
|
79 |
+
<button class="md-close"><i class="fa fa-times" aria-hidden="true"></i></button>
|
80 |
+
</div>
|
81 |
+
</div>
|
82 |
+
</div>';
|
83 |
$html .= "<div class='md-overlay'></div>";
|
84 |
+
|
85 |
+
Fns::print_html( $html );
|
86 |
}
|
87 |
}
|
88 |
|
89 |
public function the_post_grid_short_code( $atts, $content = null ) {
|
90 |
+
$rand = wp_rand();
|
91 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
92 |
+
$html = null;
|
93 |
+
$arg = [];
|
94 |
+
$atts = shortcode_atts(
|
95 |
+
[
|
96 |
+
'id' => null,
|
97 |
+
],
|
98 |
+
$atts,
|
99 |
+
'the-post-grid'
|
100 |
+
);
|
101 |
+
$scID = $atts['id'];
|
102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
if ( $scID && ! is_null( get_post( $scID ) ) ) {
|
104 |
$scMeta = get_post_meta( $scID );
|
105 |
$layout = ( isset( $scMeta['layout'][0] ) ? $scMeta['layout'][0] : 'layout1' );
|
106 |
$gridStyle = ( isset( $scMeta['grid_style'][0] ) ? $scMeta['grid_style'][0] : 'even' );
|
107 |
+
|
108 |
if ( ! in_array( $layout, array_keys( Options::rtTPGLayouts() ) ) ) {
|
109 |
$layout = 'layout1';
|
110 |
}
|
120 |
$colStore = $dCol = ( isset( $scMeta['column'][0] ) ? absint( $scMeta['column'][0] ) : 3 );
|
121 |
$tCol = ( isset( $scMeta['tpg_tab_column'][0] ) ? absint( $scMeta['tpg_tab_column'][0] ) : 2 );
|
122 |
$mCol = ( isset( $scMeta['tpg_mobile_column'][0] ) ? absint( $scMeta['tpg_mobile_column'][0] ) : 1 );
|
123 |
+
|
124 |
if ( ! in_array( $dCol, array_keys( Options::scColumns() ) ) ) {
|
125 |
$dCol = 3;
|
126 |
}
|
127 |
+
|
128 |
if ( ! in_array( $tCol, array_keys( Options::scColumns() ) ) ) {
|
129 |
$tCol = 2;
|
130 |
}
|
131 |
+
|
132 |
if ( ! in_array( $dCol, array_keys( Options::scColumns() ) ) ) {
|
133 |
$mCol = 1;
|
134 |
}
|
138 |
$tCol = ( $tCol < 3 ? 2 : $tCol );
|
139 |
$mCol = ( $mCol < 3 ? 1 : $mCol );
|
140 |
}
|
141 |
+
|
142 |
$arg = [];
|
143 |
$fImg = ( ! empty( $scMeta['feature_image'][0] ) ? true : false );
|
144 |
+
$fImgSize = ( isset( $scMeta['featured_image_size'][0] ) ? $scMeta['featured_image_size'][0] : 'medium' );
|
145 |
+
$mediaSource = ( isset( $scMeta['media_source'][0] ) ? $scMeta['media_source'][0] : 'feature_image' );
|
146 |
$arg['excerpt_type'] = ( isset( $scMeta['tgp_excerpt_type'][0] ) ? $scMeta['tgp_excerpt_type'][0] : 'character' );
|
147 |
$arg['title_limit_type'] = ( isset( $scMeta['tpg_title_limit_type'][0] ) ? $scMeta['tpg_title_limit_type'][0] : 'character' );
|
148 |
$arg['excerpt_limit'] = ( isset( $scMeta['excerpt_limit'][0] ) ? absint( $scMeta['excerpt_limit'][0] ) : 0 );
|
149 |
$arg['title_limit'] = ( isset( $scMeta['tpg_title_limit'][0] ) ? absint( $scMeta['tpg_title_limit'][0] ) : 0 );
|
150 |
$arg['excerpt_more_text'] = ( isset( $scMeta['tgp_excerpt_more_text'][0] ) ? $scMeta['tgp_excerpt_more_text'][0] : null );
|
151 |
+
$arg['read_more_text'] = ( ! empty( $scMeta['tgp_read_more_text'][0] ) ? $scMeta['tgp_read_more_text'][0] : esc_html__( 'Read More', 'the-post-grid' ) );
|
152 |
+
$arg['show_all_text'] = ( ! empty( $scMeta['tpg_show_all_text'][0] ) ? $scMeta['tpg_show_all_text'][0] : esc_html__( 'Show all', 'the-post-grid' ) );
|
|
|
|
|
|
|
153 |
$arg['tpg_title_position'] = isset( $scMeta['tpg_title_position'][0] ) && ! empty( $scMeta['tpg_title_position'][0] ) ? $scMeta['tpg_title_position'][0] : null;
|
154 |
$arg['btn_alignment_class'] = isset( $scMeta['tpg_read_more_button_alignment'][0] ) && ! empty( $scMeta['tpg_read_more_button_alignment'][0] )
|
155 |
? $scMeta['tpg_read_more_button_alignment'][0] : '';
|
156 |
+
// Category Settings.
|
157 |
$arg['category_position'] = isset( $scMeta['tpg_category_position'][0] ) ? $scMeta['tpg_category_position'][0] : null;
|
158 |
$arg['category_style'] = ! empty( $scMeta['tpg_category_style'][0] ) ? $scMeta['tpg_category_style'][0] : '';
|
159 |
$arg['catIcon'] = isset( $scMeta['tpg_category_icon'][0] ) ? $scMeta['tpg_category_icon'][0] : true;
|
160 |
+
// Meta Settings.
|
161 |
$arg['metaPosition'] = isset( $scMeta['tpg_meta_position'][0] ) ? $scMeta['tpg_meta_position'][0] : null;
|
162 |
$arg['metaIcon'] = isset( $scMeta['tpg_meta_icon'][0] ) ? $scMeta['tpg_meta_icon'][0] : true;
|
163 |
$arg['metaSeparator'] = ! empty( $scMeta['tpg_meta_separator'][0] ) ? $scMeta['tpg_meta_separator'][0] : '';
|
164 |
/* Argument create */
|
165 |
$args = [];
|
166 |
$postType = ( isset( $scMeta['tpg_post_type'][0] ) ? $scMeta['tpg_post_type'][0] : 'post' );
|
167 |
+
|
168 |
if ( $postType ) {
|
169 |
$args['post_type'] = $postType;
|
170 |
}
|
171 |
|
172 |
+
// Common filters.
|
173 |
/* post__in */
|
174 |
$post__in = ( isset( $scMeta['post__in'][0] ) ? $scMeta['post__in'][0] : null );
|
175 |
+
|
176 |
if ( $post__in ) {
|
177 |
$post__in = explode( ',', $post__in );
|
178 |
$args['post__in'] = $post__in;
|
179 |
}
|
180 |
+
|
181 |
/* post__not_in */
|
182 |
$post__not_in = ( isset( $scMeta['post__not_in'][0] ) ? $scMeta['post__not_in'][0] : null );
|
183 |
+
|
184 |
if ( $post__not_in ) {
|
185 |
$post__not_in = explode( ',', $post__not_in );
|
186 |
$args['post__not_in'] = $post__not_in;
|
191 |
$queryOffset = empty( $scMeta['offset'][0] ) ? 0 : absint( $scMeta['offset'][0] );
|
192 |
$args['posts_per_page'] = $limit;
|
193 |
$pagination = ! empty( $scMeta['pagination'][0] );
|
194 |
+
$posts_loading_type = ( ! empty( $scMeta['posts_loading_type'][0] ) ? $scMeta['posts_loading_type'][0] : 'pagination' );
|
195 |
if ( $pagination ) {
|
196 |
$posts_per_page = ( isset( $scMeta['posts_per_page'][0] ) ? intval( $scMeta['posts_per_page'][0] ) : $limit );
|
197 |
$args['posts_per_page'] = $posts_per_page;
|
198 |
$args['paged'] = get_query_var( 'page' ) ? get_query_var( 'page' ) : ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 );
|
199 |
}
|
200 |
|
201 |
+
// Advanced Filters.
|
202 |
$adv_filter = get_post_meta( $scID, 'post_filter' );
|
203 |
$taxFilter = get_post_meta( $scID, 'tgp_filter_taxonomy', true );
|
204 |
$taxHierarchical = get_post_meta( $scID, 'tgp_filter_taxonomy_hierarchical', true );
|
205 |
$taxFilterTerms = [];
|
206 |
+
$taxFilterOperator = 'IN';
|
207 |
+
// Taxonomy.
|
208 |
$taxQ = [];
|
209 |
+
|
210 |
if ( in_array( 'tpg_taxonomy', $adv_filter ) && isset( $scMeta['tpg_taxonomy'] ) ) {
|
211 |
if ( is_array( $scMeta['tpg_taxonomy'] ) && ! empty( $scMeta['tpg_taxonomy'] ) ) {
|
212 |
foreach ( $scMeta['tpg_taxonomy'] as $taxonomy ) {
|
213 |
$terms = ( isset( $scMeta[ 'term_' . $taxonomy ] ) ? $scMeta[ 'term_' . $taxonomy ] : [] );
|
214 |
+
|
215 |
if ( is_array( $terms ) && ! empty( $terms ) ) {
|
216 |
+
$operator = ( isset( $scMeta[ 'term_operator_' . $taxonomy ][0] ) ? $scMeta[ 'term_operator_' . $taxonomy ][0] : 'IN' );
|
217 |
$taxQ[] = [
|
218 |
'taxonomy' => $taxonomy,
|
219 |
'field' => 'term_id',
|
220 |
'terms' => $terms,
|
221 |
'operator' => $operator,
|
222 |
];
|
223 |
+
|
224 |
if ( $taxonomy == $taxFilter ) {
|
225 |
$taxFilterOperator = $operator;
|
226 |
}
|
227 |
}
|
228 |
+
|
229 |
if ( $taxonomy == $taxFilter ) {
|
230 |
$taxFilterTerms = $terms;
|
231 |
}
|
232 |
}
|
233 |
}
|
234 |
+
|
235 |
if ( count( $taxQ ) >= 2 ) {
|
236 |
+
$relation = ( isset( $scMeta['taxonomy_relation'][0] ) ? $scMeta['taxonomy_relation'][0] : 'AND' );
|
237 |
$taxQ['relation'] = $relation;
|
238 |
}
|
239 |
}
|
242 |
$args['tax_query'] = $taxQ;
|
243 |
}
|
244 |
|
245 |
+
// Order.
|
246 |
if ( in_array( 'order', $adv_filter ) ) {
|
247 |
$order_by = ( isset( $scMeta['order_by'][0] ) ? $scMeta['order_by'][0] : null );
|
248 |
$order = ( isset( $scMeta['order'][0] ) ? $scMeta['order'][0] : null );
|
249 |
+
|
250 |
if ( $order ) {
|
251 |
$args['order'] = $order;
|
252 |
}
|
253 |
+
|
254 |
if ( $order_by ) {
|
255 |
$args['orderby'] = $order_by;
|
256 |
$meta_key = ! empty( $scMeta['tpg_meta_key'][0] ) ? trim( $scMeta['tpg_meta_key'][0] ) : null;
|
257 |
+
|
258 |
if ( in_array( $order_by, array_keys( Options::rtMetaKeyType() ) ) && $meta_key ) {
|
259 |
$args['orderby'] = $order_by;
|
260 |
$args['meta_key'] = $meta_key;
|
262 |
}
|
263 |
}
|
264 |
|
265 |
+
// Status.
|
266 |
if ( in_array( 'tpg_post_status', $adv_filter ) ) {
|
267 |
$post_status = ( isset( $scMeta['tpg_post_status'] ) ? $scMeta['tpg_post_status'] : [] );
|
268 |
+
|
269 |
if ( ! empty( $post_status ) ) {
|
270 |
$args['post_status'] = $post_status;
|
271 |
}
|
272 |
} else {
|
273 |
$args['post_status'] = 'publish';
|
274 |
}
|
275 |
+
|
276 |
+
// Author.
|
277 |
$author = ( isset( $scMeta['author'] ) ? $scMeta['author'] : [] );
|
278 |
$filterAuthors = [];
|
279 |
+
|
280 |
if ( in_array( 'author', $adv_filter ) && ! empty( $author ) ) {
|
281 |
$filterAuthors = $args['author__in'] = $author;
|
282 |
}
|
283 |
|
284 |
+
// Search.
|
285 |
$s = ( isset( $scMeta['s'][0] ) ? $scMeta['s'][0] : [] );
|
286 |
if ( in_array( 's', $adv_filter ) && ! empty( $s ) ) {
|
287 |
$args['s'] = $s;
|
288 |
}
|
289 |
|
290 |
+
// Date query.
|
291 |
if ( in_array( 'date_range', $adv_filter ) ) {
|
292 |
$startDate = ( ! empty( $scMeta['date_range_start'][0] ) ? $scMeta['date_range_start'][0] : null );
|
293 |
$endDate = ( ! empty( $scMeta['date_range_end'][0] ) ? $scMeta['date_range_end'][0] : null );
|
294 |
+
|
295 |
if ( $startDate && $endDate ) {
|
296 |
$args['date_query'] = [
|
297 |
[
|
309 |
$oLayoutCategory = ! empty( $settings['template_category'] ) ? $settings['template_category'] : null;
|
310 |
$oLayoutSearch = ! empty( $settings['template_search'] ) ? $settings['template_search'] : null;
|
311 |
$dataArchive = null;
|
312 |
+
|
313 |
if ( ( is_category() && $oLayoutCategory ) || ( is_search() && $oLayoutSearch ) || ( is_tag() && $oLayoutTag ) || ( is_author() && $oLayoutAuthor ) ) {
|
314 |
unset( $args['post_type'] );
|
315 |
unset( $args['tax_query'] );
|
316 |
unset( $args['author__in'] );
|
317 |
$obj = get_queried_object();
|
318 |
$aType = $aValue = null;
|
319 |
+
|
320 |
if ( $oLayoutTag && is_tag() ) {
|
321 |
if ( ! empty( $obj->slug ) ) {
|
322 |
$aValue = $args['tag'] = $obj->slug;
|
334 |
$aValue = $args['s'] = get_search_query();
|
335 |
$aType = 'search';
|
336 |
}
|
337 |
+
|
338 |
$dataArchive = " data-archive='{$aType}' data-archive-value='{$aValue}'";
|
339 |
$args['posts_per_archive_page'] = $args['posts_per_page'];
|
340 |
}
|
341 |
|
342 |
+
// Validation.
|
343 |
$containerDataAttr = null;
|
344 |
$containerDataAttr .= " data-layout='{$layout}' data-grid-style='{$gridStyle}' data-desktop-col='{$dCol}' data-tab-col='{$tCol}' data-mobile-col='{$mCol}'";
|
345 |
|
346 |
$dCol = $dCol == 5 ? '24' : round( 12 / $dCol );
|
347 |
$tCol = $dCol == 5 ? '24' : round( 12 / $tCol );
|
348 |
$mCol = $dCol == 5 ? '24' : round( 12 / $mCol );
|
349 |
+
|
350 |
if ( $isCarousel ) {
|
351 |
$dCol = $tCol = $mCol = 12;
|
352 |
}
|
353 |
+
|
354 |
$arg['grid'] = "rt-col-md-{$dCol} rt-col-sm-{$tCol} rt-col-xs-{$mCol}";
|
355 |
+
|
356 |
if ( $layout == 'layout2' || $layout == 'layout3' ) {
|
357 |
$iCol = ( isset( $scMeta['tgp_layout2_image_column'][0] ) ? absint( $scMeta['tgp_layout2_image_column'][0] ) : 4 );
|
358 |
$iCol = $iCol > 12 ? 4 : $iCol;
|
360 |
$arg['image_area'] = "rt-col-sm-{$iCol} rt-col-xs-12 ";
|
361 |
$arg['content_area'] = "rt-col-sm-{$cCol} rt-col-xs-12 ";
|
362 |
} elseif ( $layout == 'layout4' ) {
|
363 |
+
$arg['image_area'] = 'rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ';
|
364 |
+
$arg['content_area'] = 'rt-col-md-6 rt-col-sm-12 rt-col-xs-12 ';
|
365 |
}
|
366 |
+
|
367 |
$arg_class = [];
|
368 |
$gridType = ! empty( $scMeta['grid_style'][0] ) ? $scMeta['grid_style'][0] : 'even';
|
369 |
+
|
370 |
if ( $isIsotope && ! rtTPG()->hasPro() ) {
|
371 |
+
$arg_class[] = 'masonry-grid-item';
|
372 |
} elseif ( ! $isCarousel && ! $isOffset ) {
|
373 |
+
$arg_class[] = $gridType . '-grid-item';
|
374 |
}
|
375 |
+
|
376 |
+
$arg_class[] = 'rt-grid-item';
|
377 |
+
|
378 |
if ( $isOffset ) {
|
379 |
+
$arg_class[] = 'rt-offset-item';
|
380 |
}
|
381 |
+
|
382 |
+
// Category class.
|
383 |
$catHaveBg = ( isset( $scMeta['tpg_category_bg'][0] ) ? $scMeta['tpg_category_bg'][0] : '' );
|
384 |
+
|
385 |
if ( ! empty( $catHaveBg ) ) {
|
386 |
$arg_class[] = 'category-have-bg';
|
387 |
}
|
388 |
+
|
389 |
+
// Image animation type.
|
390 |
$imgAnimationType = isset( $scMeta['tpg_image_animation'][0] ) ? $scMeta['tpg_image_animation'][0] : '';
|
391 |
+
|
392 |
if ( ! empty( $imgAnimationType ) ) {
|
393 |
$arg_class[] = $imgAnimationType;
|
394 |
}
|
395 |
|
396 |
$masonryG = null;
|
397 |
|
398 |
+
if ( $gridType == 'even' && ! $isIsotope && ! $isCarousel ) {
|
399 |
+
$masonryG = ' tpg-even';
|
400 |
+
} elseif ( $gridType == 'masonry' && ! $isIsotope && ! $isCarousel ) {
|
401 |
+
$masonryG = ' tpg-masonry';
|
402 |
}
|
403 |
+
|
404 |
$preLoader = $preLoaderHtml = null;
|
405 |
+
|
406 |
if ( $isIsotope ) {
|
407 |
$arg_class[] = 'isotope-item';
|
408 |
$preLoader = 'tpg-pre-loader';
|
409 |
}
|
410 |
+
|
411 |
if ( $isCarousel ) {
|
412 |
$arg_class[] = 'swiper-slide';
|
413 |
$preLoader = 'tpg-pre-loader';
|
414 |
}
|
415 |
+
|
416 |
if ( $preLoader && rtTPG()->hasPro() ) {
|
417 |
$preLoaderHtml = '<div class="rt-loading-overlay"></div><div class="rt-loading rt-ball-clip-rotate"><div></div></div>';
|
418 |
}
|
419 |
|
420 |
$margin = ! empty( $scMeta['margin_option'][0] ) ? $scMeta['margin_option'][0] : 'default';
|
421 |
+
|
422 |
if ( $margin == 'no' ) {
|
423 |
$arg_class[] = 'no-margin';
|
424 |
}
|
425 |
+
|
426 |
if ( ! empty( $scMeta['tpg_image_type'][0] ) && $scMeta['tpg_image_type'][0] == 'circle' ) {
|
427 |
$arg_class[] = 'tpg-img-circle';
|
428 |
}
|
429 |
+
|
430 |
+
$arg['class'] = implode( ' ', $arg_class );
|
431 |
$arg['anchorClass'] = $arg['link_target'] = null;
|
432 |
$link = isset( $scMeta['link_to_detail_page'][0] ) ? $scMeta['link_to_detail_page'][0] : '1';
|
433 |
$link = ( $link == 'yes' ) ? '1' : $link;
|
434 |
+
|
435 |
if ( ! $link ) {
|
436 |
$arg['anchorClass'] = ' disabled';
|
437 |
}
|
438 |
+
|
439 |
$isSinglePopUp = false;
|
440 |
$linkType = ! empty( $scMeta['detail_page_link_type'][0] ) ? $scMeta['detail_page_link_type'][0] : 'popup';
|
441 |
+
|
442 |
if ( $link == '1' ) {
|
443 |
if ( $linkType == 'popup' && rtTPG()->hasPro() ) {
|
444 |
$popupType = ! empty( $scMeta['popup_type'][0] ) ? $scMeta['popup_type'][0] : 'single';
|
445 |
+
|
446 |
if ( $popupType == 'single' ) {
|
447 |
$arg['anchorClass'] .= ' tpg-single-popup';
|
448 |
$isSinglePopUp = true;
|
457 |
$parentClass = ( ! empty( $scMeta['parent_class'][0] ) ? trim( $scMeta['parent_class'][0] ) : null );
|
458 |
$defaultImgId = ( ! empty( $scMeta['default_preview_image'][0] ) ? absint( $scMeta['default_preview_image'][0] ) : null );
|
459 |
$customImgSize = ( ! empty( $scMeta['custom_image_size'] ) ? $scMeta['custom_image_size'] : [] );
|
460 |
+
// Grid Hover Layout.
|
461 |
+
$fSmallImgSize = ( isset( $scMeta['featured_small_image_size'][0] ) ? $scMeta['featured_small_image_size'][0] : 'medium' );
|
462 |
$customSmallImgSize = ( ! empty( $scMeta['custom_small_image_size'] ) ? $scMeta['custom_small_image_size'] : [] );
|
463 |
|
464 |
$arg['scID'] = $scID;
|
465 |
$arg['items'] = isset( $scMeta['item_fields'] ) ? ( $scMeta['item_fields'] ? $scMeta['item_fields'] : [] ) : [];
|
466 |
+
|
467 |
if ( in_array( 'cf', $arg['items'] ) ) {
|
468 |
$arg['cf_group'] = [];
|
469 |
$arg['cf_group'] = get_post_meta( $scID, 'cf_group' );
|
474 |
];
|
475 |
}
|
476 |
|
477 |
+
// Set readmore false if excerpt type = full content.
|
478 |
if ( isset( $arg['excerpt_type'] ) && $arg['excerpt_type'] === 'full' && ( $key = array_search( 'read_more', $arg['items'] ) ) !== false ) {
|
479 |
unset( $arg['items'][ $key ] );
|
480 |
}
|
481 |
+
|
482 |
if ( empty( $scMeta['ignore_sticky_posts'][0] ) ) {
|
483 |
$args['ignore_sticky_posts'] = true;
|
484 |
} else {
|
488 |
$filters = ! empty( $scMeta['tgp_filter'] ) ? $scMeta['tgp_filter'] : [];
|
489 |
$action_term = ! empty( $scMeta['tgp_default_filter'][0] ) ? absint( $scMeta['tgp_default_filter'][0] ) : 0;
|
490 |
$hide_all_button = ! empty( $scMeta['tpg_hide_all_button'][0] ) ? true : false;
|
491 |
+
|
492 |
if ( $taxHierarchical ) {
|
493 |
$terms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, 0 );
|
494 |
} else {
|
495 |
$terms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true );
|
496 |
}
|
497 |
+
|
498 |
if ( $hide_all_button && ! $action_term ) {
|
499 |
if ( ! empty( $terms ) ) {
|
500 |
$allKeys = array_keys( $terms );
|
501 |
$action_term = $allKeys[0];
|
502 |
}
|
503 |
}
|
504 |
+
|
505 |
if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter && $action_term ) {
|
506 |
$args['tax_query'] = [
|
507 |
[
|
518 |
$tempArgs['paged'] = 1;
|
519 |
$tempArgs['fields'] = 'ids';
|
520 |
$tempQ = new \WP_Query( $tempArgs );
|
521 |
+
|
522 |
if ( ! empty( $tempQ->posts ) ) {
|
523 |
$args['post__in'] = $tempQ->posts;
|
524 |
}
|
527 |
if ( $pagination && $queryOffset && isset( $args['paged'] ) ) {
|
528 |
$queryOffset = ( $posts_per_page * ( $args['paged'] - 1 ) ) + $queryOffset;
|
529 |
}
|
530 |
+
|
531 |
if ( $queryOffset ) {
|
532 |
$args['offset'] = $queryOffset;
|
533 |
}
|
534 |
|
535 |
+
$arg['title_tag'] = ( ! empty( $scMeta['title_tag'][0] ) && in_array( $scMeta['title_tag'][0], array_keys( Options::getTitleTags() ) ) ) ? esc_attr( $scMeta['title_tag'][0] ) : 'h3';
|
|
|
536 |
|
537 |
$gridQuery = new \WP_Query( apply_filters( 'tpg_sc_query_args', $args, $scMeta ) );
|
538 |
|
539 |
+
// Start layout.
|
540 |
$html .= Fns::layoutStyle( $layoutID, $scMeta, $layout, $scID );
|
541 |
$containerDataAttr .= " data-sc-id='{$scID}'";
|
542 |
|
547 |
$carousel_nav = ! empty( $scMeta['carousel_property'] ) ? $scMeta['carousel_property'] : [];
|
548 |
$is_nav = in_array( 'nav_button', $carousel_nav );
|
549 |
|
|
|
550 |
if ( $isCarousel ) {
|
551 |
$parentClass .= ' tpg-carousel-main';
|
552 |
+
|
553 |
if ( $is_nav ) {
|
554 |
$parentClass .= ' tpg-has-nav';
|
555 |
}
|
556 |
+
|
557 |
$cOptMeta = ! empty( $scMeta['carousel_property'] ) ? $scMeta['carousel_property'] : [];
|
558 |
|
559 |
if ( in_array( 'lazy_load', $cOptMeta ) ) {
|
567 |
|
568 |
$html .= "<div class='rt-container-fluid rt-tpg-container tpg-shortcode-main-wrapper {$parentClass}' id='{$layoutID}' {$dataArchive} {$containerDataAttr}>";
|
569 |
|
570 |
+
// widget heading.
|
571 |
$heading_tag = isset( $scMeta['tpg_heading_tag'][0] ) ? $scMeta['tpg_heading_tag'][0] : 'h2';
|
572 |
$heading_style = isset( $scMeta['tpg_heading_style'][0] ) && ! empty( $scMeta['tpg_heading_style'][0] ) ? $scMeta['tpg_heading_style'][0] : 'style1';
|
573 |
$heading_alignment = isset( $scMeta['tpg_heading_alignment'][0] ) ? $scMeta['tpg_heading_alignment'][0] : '';
|
576 |
if ( ! empty( $arg['items'] ) && in_array( 'heading', $arg['items'] ) ) {
|
577 |
$html .= sprintf( '<div class="tpg-widget-heading-wrapper heading-%1$s %2$s">', $heading_style, $heading_alignment );
|
578 |
$html .= '<span class="tpg-widget-heading-line line-left"></span>';
|
579 |
+
|
580 |
if ( $heading_link ) {
|
581 |
$html .= sprintf( '<%1$s class="tpg-widget-heading"><a href="%2$s" title="%3$s">%3$s</a></%1$s>', $heading_tag, $heading_link, get_the_title() );
|
582 |
} else {
|
583 |
$html .= sprintf( '<%1$s class="tpg-widget-heading">%2$s</%1$s>', $heading_tag, get_the_title( $scID ) );
|
584 |
}
|
585 |
+
|
586 |
$html .= '<span class="tpg-widget-heading-line"></span>';
|
587 |
$html .= '</div>';
|
588 |
}
|
590 |
if ( ! $isCarousel && isset( $settings['tpg_enable_preloader'] ) ) {
|
591 |
$html .= '<div id="bottom-script-loader" class="bottom-script-loader"><div class="rt-ball-clip-rotate"><div></div></div></div>';
|
592 |
}
|
593 |
+
|
594 |
if ( ! empty( $filters ) && ( $isGrid || $isOffset || $isWooCom || $isEdd ) ) {
|
595 |
$html .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
|
596 |
$selectedSubTermsForButton = null;
|
597 |
+
$allText = apply_filters( 'tpg_filter_all_text', esc_html__( 'All', 'the-post-grid' ), $scMeta );
|
598 |
+
|
599 |
if ( in_array( '_taxonomy_filter', $filters ) && $taxFilter ) {
|
600 |
$filterType = ( ! empty( $scMeta['tgp_filter_type'][0] ) ? $scMeta['tgp_filter_type'][0] : null );
|
601 |
$post_count = ( ! empty( $scMeta['tpg_post_count'][0] ) ? $scMeta['tpg_post_count'][0] : null );
|
602 |
+
$postCountClass = ( $post_count ? ' has-post-count' : null );
|
603 |
+
$allSelect = ' selected';
|
604 |
$isTermSelected = false;
|
605 |
+
|
606 |
if ( $action_term && $taxFilter ) {
|
607 |
$isTermSelected = true;
|
608 |
$allSelect = null;
|
609 |
}
|
610 |
+
|
611 |
if ( ! $filterType || $filterType == 'dropdown' ) {
|
612 |
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
613 |
$termDefaultText = $allText;
|
614 |
$dataTerm = 'all';
|
615 |
+
$htmlButton = '';
|
616 |
$selectedSubTerms = null;
|
617 |
$pCount = 0;
|
618 |
+
|
619 |
if ( ! empty( $terms ) ) {
|
620 |
$i = 0;
|
621 |
+
|
622 |
foreach ( $terms as $id => $term ) {
|
623 |
$pCount = $pCount + $term['count'];
|
624 |
$sT = null;
|
625 |
+
|
626 |
if ( $taxHierarchical ) {
|
627 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
628 |
+
|
629 |
if ( ! empty( $subTerms ) ) {
|
630 |
$count = 0;
|
631 |
$item = $allCount = null;
|
632 |
+
|
633 |
foreach ( $subTerms as $stId => $t ) {
|
634 |
$count = $count + absint( $t['count'] );
|
635 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
636 |
$item .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$stId}'><span class='rt-text'>{$t['name']}{$sTPostCount}</span></span>";
|
637 |
}
|
638 |
+
|
639 |
if ( $post_count ) {
|
640 |
$allCount = " (<span class='rt-post-count'>{$count}</span>)";
|
641 |
}
|
642 |
+
|
643 |
$sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
|
644 |
$sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
|
645 |
+
<span class='rt-text'>" . $allText . "{$allCount}</span>
|
646 |
+
<i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
|
647 |
+
</span>";
|
648 |
$sT .= '<span class="term-dropdown rt-filter-dropdown">';
|
649 |
$sT .= $item;
|
650 |
$sT .= '</span>';
|
651 |
+
$sT .= '</div>';
|
652 |
}
|
653 |
+
|
654 |
if ( $action_term === $id ) {
|
655 |
$selectedSubTerms = $sT;
|
656 |
}
|
657 |
}
|
658 |
+
|
659 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
660 |
+
|
661 |
if ( $action_term && $action_term == $id ) {
|
662 |
$termDefaultText = $term['name'] . $postCount;
|
663 |
$dataTerm = $id;
|
664 |
}
|
665 |
+
|
666 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
667 |
+
if ( $taxFilterOperator == 'NOT IN' ) {
|
668 |
if ( ! in_array( $id, $taxFilterTerms ) && $action_term != $id ) {
|
669 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
670 |
}
|
676 |
} else {
|
677 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
678 |
}
|
679 |
+
|
680 |
$i ++;
|
681 |
}
|
682 |
}
|
683 |
$pAllCount = null;
|
684 |
+
|
685 |
if ( $post_count ) {
|
686 |
$pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
|
687 |
if ( ! $action_term ) {
|
688 |
$termDefaultText = $termDefaultText . $pAllCount;
|
689 |
}
|
690 |
}
|
691 |
+
|
692 |
if ( ! $hide_all_button ) {
|
693 |
+
$htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText . "{$pAllCount}</span></span>" . $htmlButton;
|
|
|
694 |
}
|
695 |
$htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
|
696 |
|
697 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
|
698 |
+
<span class="rt-text">' . $termDefaultText . '</span>
|
699 |
+
<i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
|
700 |
+
</span>';
|
701 |
|
702 |
$html .= $showAllhtml . $htmlButton;
|
703 |
$html .= '</div>' . $selectedSubTerms;
|
705 |
$termDefaultText = $allText;
|
706 |
$bCount = 0;
|
707 |
$bItems = null;
|
708 |
+
|
709 |
if ( ! empty( $terms ) ) {
|
710 |
foreach ( $terms as $id => $term ) {
|
711 |
$bCount = $bCount + absint( $term['count'] );
|
712 |
$sT = null;
|
713 |
+
|
714 |
if ( $taxHierarchical ) {
|
715 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
716 |
if ( ! empty( $subTerms ) ) {
|
717 |
$sT .= "<div class='rt-filter-sub-tax sub-button-group'>";
|
718 |
+
|
719 |
foreach ( $subTerms as $stId => $t ) {
|
720 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
721 |
$sT .= "<span class='rt-filter-button-item' data-term='{$stId}'>{$t['name']}{$sTPostCount}</span>";
|
722 |
}
|
723 |
+
|
724 |
+
$sT .= '</div>';
|
725 |
+
|
726 |
if ( $action_term === $id ) {
|
727 |
$selectedSubTermsForButton = $sT;
|
728 |
}
|
729 |
}
|
730 |
}
|
731 |
+
|
732 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
733 |
$termSelected = null;
|
734 |
+
|
735 |
if ( $isTermSelected && $id == $action_term ) {
|
736 |
+
$termSelected = ' selected';
|
737 |
}
|
738 |
+
|
739 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
740 |
+
if ( $taxFilterOperator == 'NOT IN' ) {
|
741 |
if ( ! in_array( $id, $taxFilterTerms ) ) {
|
742 |
$bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
|
743 |
}
|
751 |
}
|
752 |
}
|
753 |
}
|
754 |
+
|
755 |
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
756 |
+
|
757 |
if ( ! $hide_all_button ) {
|
758 |
$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
759 |
$html .= "<span class='term-button-item rt-filter-button-item {$allSelect}' data-term='all'>" . $allText . "{$pCountH}</span>";
|
760 |
}
|
761 |
+
|
762 |
$html .= $bItems;
|
763 |
+
$html .= '</div>';
|
764 |
}
|
765 |
}
|
766 |
|
767 |
+
// Author filter.
|
768 |
if ( in_array( '_author_filter', $filters ) ) {
|
769 |
$filterType = ( ! empty( $scMeta['tgp_filter_type'][0] ) ? $scMeta['tgp_filter_type'][0] : null );
|
770 |
$post_count = ( ! empty( $scMeta['tpg_post_count'][0] ) ? $scMeta['tpg_post_count'][0] : null );
|
771 |
$users = get_users( apply_filters( 'tpg_author_arg', [] ) );
|
772 |
|
773 |
+
$allSelect = ' selected';
|
774 |
$isTermSelected = false;
|
775 |
+
|
776 |
if ( $action_term && $taxFilter ) {
|
777 |
$isTermSelected = true;
|
778 |
$allSelect = null;
|
779 |
}
|
780 |
+
|
781 |
if ( ! $filterType || $filterType == 'dropdown' ) {
|
782 |
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}'>";
|
783 |
$termDefaultText = $allText;
|
784 |
$dataAuthor = 'all';
|
785 |
+
$htmlButton = '';
|
786 |
$htmlButton .= '<span class="author-dropdown rt-filter-dropdown">';
|
787 |
+
|
788 |
if ( ! empty( $users ) ) {
|
789 |
foreach ( $users as $user ) {
|
790 |
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
813 |
$htmlButton .= '</span>';
|
814 |
|
815 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
|
816 |
+
<span class="rt-text">' . $termDefaultText . '</span>
|
817 |
+
<i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
|
818 |
+
</span>';
|
819 |
|
820 |
$html .= $showAllhtml . $htmlButton;
|
821 |
$html .= '</div>';
|
833 |
}
|
834 |
}
|
835 |
}
|
836 |
+
|
837 |
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-taxonomy='{$taxFilter}'>";
|
838 |
+
|
839 |
if ( ! $hide_all_button ) {
|
840 |
$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
841 |
$html .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . "{$pCountH}</span>";
|
842 |
}
|
843 |
+
|
844 |
$html .= $bItems;
|
845 |
+
$html .= '</div>';
|
846 |
}
|
847 |
}
|
848 |
|
849 |
if ( in_array( '_search', $filters ) ) {
|
850 |
$html .= '<div class="rt-filter-item-wrap rt-search-filter-wrap">';
|
851 |
+
$html .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__( 'Search...', 'the-post-grid' ) );
|
852 |
$html .= "<span class='rt-action'>🔍</span>";
|
853 |
$html .= "<span class='rt-loading'></span>";
|
854 |
$html .= '</div>';
|
855 |
}
|
856 |
|
857 |
if ( in_array( '_order_by', $filters ) ) {
|
858 |
+
$wooFeature = ( $postType == 'product' ? true : false );
|
859 |
$orders = Options::rtPostOrderBy( $wooFeature );
|
860 |
+
$action_orderby = ( ! empty( $args['orderby'] ) ? trim( $args['orderby'] ) : 'none' );
|
861 |
+
|
862 |
if ( $action_orderby == 'ID' ) {
|
863 |
$action_orderby = 'title';
|
864 |
}
|
865 |
+
|
866 |
if ( $action_orderby == 'none' ) {
|
867 |
+
$action_orderby_label = esc_html__( 'Sort By None', 'the-post-grid' );
|
868 |
} elseif ( in_array( $action_orderby, array_keys( Options::rtMetaKeyType() ) ) ) {
|
869 |
+
$action_orderby_label = esc_html__( 'Meta value', 'the-post-grid' );
|
870 |
} else {
|
871 |
$action_orderby_label = $orders[ $action_orderby ];
|
872 |
}
|
873 |
|
874 |
if ( $action_orderby !== 'none' ) {
|
875 |
+
$orders['none'] = esc_html__( 'Sort By None', 'the-post-grid' );
|
876 |
}
|
877 |
$html .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap">';
|
878 |
$html .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
|
879 |
+
<span class='rt-text-order-by'>{$action_orderby_label}</span>
|
880 |
+
<i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
|
881 |
+
</span>";
|
882 |
$html .= '<span class="order-by-dropdown rt-filter-dropdown">';
|
883 |
|
884 |
foreach ( $orders as $orderKey => $order ) {
|
885 |
$html .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
|
886 |
}
|
887 |
+
|
888 |
$html .= '</span>';
|
889 |
$html .= '</div>';
|
890 |
}
|
891 |
|
892 |
if ( in_array( '_sort_order', $filters ) ) {
|
893 |
+
$action_order = ( ! empty( $args['order'] ) ? strtoupper( trim( $args['order'] ) ) : 'DESC' );
|
894 |
$html .= '<div class="rt-filter-item-wrap rt-sort-order-action">';
|
895 |
$html .= "<span class='rt-sort-order-action-arrow' data-sort-order='{$action_order}'> <span></span></span>";
|
896 |
$html .= '</div>';
|
899 |
$html .= "</div>$selectedSubTermsForButton</div>";
|
900 |
}
|
901 |
|
902 |
+
$html .= "<div data-title='" . esc_html__( 'Loading ...', 'the-post-grid' ) . "' class='rt-row rt-content-loader {$layout}{$masonryG} {$preLoader}'>";
|
|
|
|
|
|
|
|
|
903 |
|
904 |
+
$not_found_text = isset( $scMeta['tgp_not_found_text'][0] ) && ! empty( $scMeta['tgp_not_found_text'][0] ) ? esc_html( $scMeta['tgp_not_found_text'][0] ) : esc_html__( 'No post found', 'the-post-grid' );
|
905 |
|
906 |
if ( $gridQuery->have_posts() ) {
|
907 |
$is_lazy_load = '';
|
908 |
+
|
909 |
if ( $isCarousel ) {
|
910 |
$cOpt = ! empty( $scMeta['carousel_property'] ) ? $scMeta['carousel_property'] : [];
|
911 |
+
$slider_js_options = apply_filters(
|
912 |
+
'rttpg_slider_js_options',
|
913 |
+
[
|
914 |
+
'speed' => ! empty( $scMeta['tpg_carousel_speed'][0] ) ? absint( $scMeta['tpg_carousel_speed'][0] ) : 250,
|
915 |
+
'autoPlayTimeOut' => ! empty( $scMeta['tpg_carousel_autoplay_timeout'][0] ) ? absint( $scMeta['tpg_carousel_autoplay_timeout'][0] ) : 5000,
|
916 |
+
'autoPlay' => in_array( 'auto_play', $cOpt ),
|
917 |
+
'stopOnHover' => in_array( 'stop_hover', $cOpt ),
|
918 |
+
'nav' => in_array( 'nav_button', $cOpt ),
|
919 |
+
'dots' => in_array( 'pagination', $cOpt ),
|
920 |
+
'loop' => in_array( 'loop', $cOpt ),
|
921 |
+
'lazy' => in_array( 'lazy_load', $cOpt ),
|
922 |
+
'autoHeight' => in_array( 'auto_height', $cOpt ),
|
923 |
+
'rtl' => in_array( 'rtl', $cOpt ) ? 'rtl' : 'ltr',
|
924 |
+
],
|
925 |
+
$scMeta
|
926 |
+
);
|
927 |
+
$html .= sprintf(
|
928 |
+
'<div class="rt-swiper-holder swiper" data-rtowl-options="%s" dir="%s"><div class="swiper-wrapper">',
|
929 |
htmlspecialchars( wp_json_encode( $slider_js_options ) ),
|
930 |
$slider_js_options['rtl']
|
931 |
);
|
933 |
if ( in_array( 'lazy_load', $cOpt ) ) {
|
934 |
$is_lazy_load = 'swiper-lazy';
|
935 |
}
|
|
|
936 |
}
|
937 |
+
|
938 |
$isotope_filter = null;
|
939 |
+
|
940 |
if ( $isIsotope ) {
|
941 |
$isotope_filter = isset( $scMeta['isotope_filter'][0] ) ? $scMeta['isotope_filter'][0] : null;
|
942 |
$isotope_dropdown_filter = isset( $scMeta['isotope_filter_dropdown'][0] ) ? $scMeta['isotope_filter_dropdown'][0] : null;
|
943 |
$selectedTerms = [];
|
944 |
+
|
945 |
if ( isset( $scMeta['post_filter'] )
|
946 |
+
&& in_array(
|
947 |
+
'tpg_taxonomy',
|
948 |
+
$scMeta['post_filter']
|
949 |
+
)
|
950 |
&& isset( $scMeta['tpg_taxonomy'] )
|
951 |
+
&& in_array(
|
952 |
+
$isotope_filter,
|
953 |
+
$scMeta['tpg_taxonomy']
|
954 |
+
)
|
955 |
) {
|
956 |
$selectedTerms = ( isset( $scMeta[ 'term_' . $isotope_filter ] ) ? $scMeta[ 'term_' . $isotope_filter ] : [] );
|
957 |
}
|
962 |
'hide_empty' => false,
|
963 |
'include' => $selectedTerms,
|
964 |
];
|
965 |
+
|
966 |
if ( rtTPG()->hasPro() ) {
|
967 |
$termArgs['meta_key'] = '_rt_order';
|
968 |
}
|
969 |
+
|
970 |
$terms = get_terms( $termArgs );
|
971 |
|
972 |
$html .= '<div class="tpg-iso-filter">';
|
977 |
foreach ( $terms as $term ) {
|
978 |
$tItem = ! empty( $scMeta['isotope_default_filter'][0] ) ? $scMeta['isotope_default_filter'][0] : null;
|
979 |
$fSelected = null;
|
980 |
+
|
981 |
if ( $tItem == $term->term_id ) {
|
982 |
$fSelected = 'selected';
|
983 |
$fSelectTrigger = true;
|
984 |
}
|
985 |
+
|
986 |
+
$htmlButton .= sprintf(
|
987 |
+
'<button class="rt-iso-btn-%s%s" data-filter=".iso_%d">%s</button>',
|
988 |
esc_attr( $term->slug ),
|
989 |
+
$fSelected ? ' ' . $fSelected : '',
|
990 |
$term->term_id,
|
991 |
$term->name
|
992 |
);
|
993 |
$drop .= "<option value='.iso_{$term->term_id}' {$fSelected}>{$term->name}</option>";
|
994 |
}
|
995 |
}
|
996 |
+
|
997 |
if ( empty( $scMeta['isotope_filter_show_all'][0] ) ) {
|
998 |
$fSelect = ( $fSelectTrigger ? null : 'class="selected"' );
|
999 |
+
$htmlButton = "<button class='rt-iso-btn-all selected' data-filter='*'>" . $arg['show_all_text'] . '</button>' . $htmlButton;
|
1000 |
$drop = "<option value='*' {$fSelect}>{$arg['show_all_text']}</option>" . $drop;
|
1001 |
}
|
1002 |
+
|
1003 |
$filter_count = ! empty( $scMeta['isotope_filter_count'][0] ) ? true : false;
|
1004 |
$filter_url = ! empty( $scMeta['isotope_filter_url'][0] ) ? true : false;
|
1005 |
$htmlButton = "<div id='iso-button-{$rand}' class='rt-tpg-isotope-buttons button-group filter-button-group option-set' data-url='{$filter_url}' data-count='{$filter_count}'>{$htmlButton}</div>";
|
1009 |
} else {
|
1010 |
$html .= $htmlButton;
|
1011 |
}
|
1012 |
+
|
1013 |
if ( ! empty( $scMeta['isotope_search_filter'][0] ) ) {
|
1014 |
+
$html .= "<div class='iso-search'><input type='text' class='iso-search-input' placeholder='" . esc_html__( 'Search', 'the-post-grid' ) . "' /></div>";
|
|
|
1015 |
}
|
1016 |
+
|
1017 |
$html .= '</div>';
|
1018 |
$html .= "<div class='rt-tpg-isotope' id='iso-tpg-{$rand}'>";
|
1019 |
}
|
1023 |
$gridPostCount = 0;
|
1024 |
$arg['totalPost'] = $gridQuery->post_count;
|
1025 |
|
1026 |
+
while ( $gridQuery->have_posts() ) :
|
1027 |
+
$gridQuery->the_post();
|
1028 |
+
|
1029 |
if ( $colStore == $l ) {
|
1030 |
if ( $this->l4toggle ) {
|
1031 |
$this->l4toggle = false;
|
1032 |
} else {
|
1033 |
$this->l4toggle = true;
|
1034 |
}
|
1035 |
+
|
1036 |
$l = 0;
|
1037 |
}
|
1038 |
+
|
1039 |
$arg['postCount'] = $gridPostCount ++;
|
1040 |
$pID = get_the_ID();
|
1041 |
$arg['pID'] = $pID;
|
1043 |
$arg['pLink'] = get_permalink();
|
1044 |
$arg['toggle'] = $this->l4toggle;
|
1045 |
$arg['layoutID'] = $layoutID;
|
1046 |
+
$arg['author'] = apply_filters(
|
1047 |
+
'rttpg_author_link',
|
1048 |
+
sprintf( '<a href="%s">%s</a>', get_author_posts_url( get_the_author_meta( 'ID' ) ), get_the_author() )
|
1049 |
+
);
|
1050 |
$comments_number = get_comments_number( $pID );
|
1051 |
$comments_text = sprintf( '(%s)', number_format_i18n( $comments_number ) );
|
1052 |
|
1056 |
$arg['tags'] = get_the_term_list( $pID, 'post_tag', null, '<span class="rt-separator">,</span>' );
|
1057 |
$arg['post_count'] = get_post_meta( $pID, Fns::get_post_view_count_meta_key(), true );
|
1058 |
$arg['responsiveCol'] = [ $dCol, $tCol, $mCol ];
|
1059 |
+
|
1060 |
if ( $isIsotope ) {
|
1061 |
+
$termAs = wp_get_post_terms( $pID, $isotope_filter, [ 'fields' => 'all' ] );
|
1062 |
$isoFilter = [];
|
1063 |
+
|
1064 |
if ( ! empty( $termAs ) ) {
|
1065 |
foreach ( $termAs as $term ) {
|
1066 |
+
$isoFilter[] = 'iso_' . $term->term_id;
|
1067 |
+
$isoFilter[] = 'rt-item-' . esc_attr( $term->slug );
|
1068 |
}
|
1069 |
}
|
1070 |
+
|
1071 |
+
$arg['isoFilter'] = ! empty( $isoFilter ) ? implode( ' ', $isoFilter ) : '';
|
1072 |
}
|
1073 |
+
|
1074 |
if ( comments_open() ) {
|
1075 |
$arg['comment'] = "<a href='" . get_comments_link( $pID ) . "'>{$comments_text} </a>";
|
1076 |
} else {
|
1077 |
$arg['comment'] = "{$comments_text}";
|
1078 |
}
|
|
|
1079 |
|
1080 |
+
$imgSrc = null;
|
1081 |
|
1082 |
+
// TODO: Image Thumbnail.
|
1083 |
+
$arg['smallImgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
1084 |
+
$pID,
|
1085 |
+
$fSmallImgSize,
|
1086 |
+
$mediaSource,
|
1087 |
+
$defaultImgId,
|
1088 |
+
$customSmallImgSize,
|
1089 |
+
$is_lazy_load
|
1090 |
+
) : null;
|
1091 |
if ( $isOffset ) {
|
1092 |
if ( $offLoop == 0 ) {
|
1093 |
+
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
1094 |
+
$pID,
|
1095 |
+
$fImgSize,
|
1096 |
+
$mediaSource,
|
1097 |
$defaultImgId,
|
1098 |
+
$customImgSize
|
1099 |
+
) : null;
|
1100 |
$arg['offset'] = 'big';
|
1101 |
$offsetBigHtml = Fns::get_template_html( 'layouts/' . $layout, $arg );
|
1102 |
} else {
|
1103 |
$arg['offset'] = 'small';
|
1104 |
$arg['offsetCol'] = [ $dCol, $tCol, $mCol ];
|
1105 |
+
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
1106 |
+
$pID,
|
1107 |
+
'thumbnail',
|
1108 |
$mediaSource,
|
1109 |
$defaultImgId,
|
1110 |
+
$customImgSize
|
1111 |
+
) : null;
|
1112 |
$offsetSmallHtml .= Fns::get_template_html( 'layouts/' . $layout, $arg );
|
1113 |
}
|
1114 |
} else {
|
1115 |
+
$arg['imgSrc'] = ! $fImg ? Fns::getFeatureImageSrc(
|
1116 |
+
$pID,
|
1117 |
+
$fImgSize,
|
1118 |
+
$mediaSource,
|
1119 |
$defaultImgId,
|
1120 |
+
$customImgSize,
|
1121 |
+
$is_lazy_load
|
1122 |
+
) : null;
|
1123 |
$html .= Fns::get_template_html( 'layouts/' . $layout, $arg );
|
1124 |
}
|
1125 |
+
|
1126 |
$offLoop ++;
|
1127 |
$l ++;
|
1128 |
endwhile;
|
1129 |
+
|
1130 |
if ( $isOffset ) {
|
1131 |
$oDCol = Fns::get_offset_col( $dCol );
|
1132 |
$oTCol = Fns::get_offset_col( $tCol );
|
1133 |
$oMCol = Fns::get_offset_col( $mCol );
|
1134 |
+
|
1135 |
+
if ( $layout == 'offset03' || $layout == 'offset04' ) {
|
1136 |
$oDCol['big'] = $oTCol['big'] = $oDCol['small'] = $oTCol['small'] = 6;
|
1137 |
$oMCol['big'] = $oMCol['small'] = 12;
|
1138 |
+
} elseif ( $layout == 'offset06' ) {
|
1139 |
$oDCol['big'] = 7;
|
1140 |
$oDCol['small'] = 5;
|
1141 |
}
|
1142 |
+
|
1143 |
$html .= "<div class='rt-col-md-{$oDCol['big']} rt-col-sm-{$oTCol['big']} rt-col-xs-{$oMCol['big']}'><div class='rt-row'>{$offsetBigHtml}</div></div>";
|
1144 |
$html .= "<div class='rt-col-md-{$oDCol['small']} rt-col-sm-{$oTCol['small']} rt-col-xs-{$oMCol['small']}'><div class='rt-row offset-small-wrap'>{$offsetSmallHtml}</div></div>";
|
1145 |
}
|
1146 |
+
|
1147 |
if ( $isIsotope || $isCarousel ) {
|
1148 |
+
$html .= '</div>'; // End isotope / Carousel item holder.
|
1149 |
|
1150 |
if ( $isIsotope ) {
|
1151 |
$html .= '<div class="isotope-term-no-post"><p>' . $not_found_text . '</p></div>';
|
1152 |
}
|
|
|
1153 |
|
1154 |
+
if ( $isCarousel ) {
|
1155 |
$html .= '</div>';
|
1156 |
|
1157 |
if ( in_array( 'pagination', $cOpt ) ) {
|
1158 |
$html .= '<div class="swiper-pagination"></div>';
|
1159 |
}
|
1160 |
+
|
1161 |
if ( in_array( 'nav_button', $cOpt ) ) {
|
1162 |
$html .= '<div class="swiper-navigation"><div class="slider-btn swiper-button-prev"></div><div class="slider-btn swiper-button-next"></div></div>';
|
1163 |
}
|
1164 |
}
|
1165 |
}
|
1166 |
} else {
|
1167 |
+
$html .= sprintf(
|
1168 |
+
'<p>%s</p>',
|
1169 |
apply_filters( 'tpg_not_found_text', $not_found_text, $args, $scMeta )
|
1170 |
);
|
1171 |
}
|
1172 |
+
|
1173 |
$html .= $preLoaderHtml;
|
1174 |
+
$html .= '</div>'; // End row.
|
1175 |
$htmlUtility = null;
|
1176 |
+
|
1177 |
if ( $pagination && ! $isCarousel ) {
|
1178 |
if ( $isOffset || $isGridHover ) {
|
1179 |
+
$posts_loading_type = 'page_prev_next';
|
1180 |
$htmlUtility .= "<div class='rt-cb-page-prev-next'>
|
1181 |
<span class='rt-cb-prev-btn'><i class='fa fa-angle-left' aria-hidden='true'></i></span>
|
1182 |
<span class='rt-cb-next-btn'><i class='fa fa-angle-right' aria-hidden='true'></i></span>
|
1183 |
</div>";
|
1184 |
} else {
|
1185 |
+
$hide = ( $gridQuery->max_num_pages < 2 ? ' rt-hidden-elm' : null );
|
1186 |
+
if ( $posts_loading_type == 'pagination' ) {
|
1187 |
if ( ( $isGrid || $isWooCom || $isEdd ) && empty( $filters ) ) {
|
1188 |
+
$htmlUtility .= Fns::rt_pagination(
|
1189 |
+
$gridQuery,
|
1190 |
+
$args['posts_per_page']
|
1191 |
+
);
|
1192 |
}
|
1193 |
+
} elseif ( $posts_loading_type == 'pagination_ajax' && ! $isIsotope ) {
|
1194 |
$htmlUtility .= "<div class='rt-page-numbers'></div>";
|
1195 |
+
} elseif ( $posts_loading_type == 'load_more' && rtTPG()->hasPro() ) {
|
1196 |
+
$load_more_btn_text = ( ! empty( $scMeta['load_more_text'][0] ) ? $scMeta['load_more_text'][0] : '' );
|
1197 |
+
$load_more_text = $load_more_btn_text ? esc_html( $load_more_btn_text ) : esc_html__( 'Load More', 'the-post-grid' );
|
1198 |
|
1199 |
$htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style{$hide}'>
|
1200 |
<span class='rt-loadmore-text'>" . $load_more_text . "</span>
|
1201 |
<div class='rt-loadmore-loading rt-ball-scale-multiple rt-2x'><div></div><div></div><div></div></div>
|
1202 |
</div>";
|
1203 |
+
} elseif ( $posts_loading_type == 'load_on_scroll' && rtTPG()->hasPro() ) {
|
1204 |
+
$htmlUtility .= "<div class='rt-infinite-action'>
|
1205 |
<div class='rt-infinite-loading la-fire la-2x'>
|
1206 |
<div></div>
|
1207 |
<div></div>
|
1214 |
|
1215 |
if ( $htmlUtility ) {
|
1216 |
$l4toggle = null;
|
1217 |
+
if ( $layout == 'layout4' ) {
|
1218 |
$l4toggle = "data-l4toggle='{$this->l4toggle}'";
|
1219 |
}
|
1220 |
+
$html .= "<div class='rt-pagination-wrap' data-total-pages='{$gridQuery->max_num_pages}' data-posts-per-page='{$args['posts_per_page']}' data-type='{$posts_loading_type}' {$l4toggle} >" . $htmlUtility . '</div>';
|
|
|
1221 |
}
|
1222 |
|
1223 |
+
$html .= '</div>'; // container rt-tpg.
|
1224 |
|
1225 |
wp_reset_postdata();
|
1226 |
|
1235 |
|
1236 |
add_action( 'wp_footer', [ $this, 'register_sc_scripts' ] );
|
1237 |
|
1238 |
+
// Script Load Conditionally
|
1239 |
$script = [];
|
1240 |
$style = [];
|
1241 |
|
1242 |
array_push( $script, 'jquery' );
|
1243 |
array_push( $style, 'rt-fontawsome' );
|
1244 |
+
|
1245 |
if ( 'masonry' == $gridType || $isIsotope ) {
|
1246 |
array_push( $script, 'rt-isotope-js' );
|
1247 |
}
|
1248 |
+
|
1249 |
array_push( $script, 'imagesloaded' );
|
1250 |
array_push( $script, 'rt-tpg' );
|
1251 |
|
1252 |
+
// Pro Scripts and Styles.
|
1253 |
if ( rtTPG()->hasPro() ) {
|
1254 |
|
|
|
1255 |
if ( isset( $posts_loading_type ) && 'pagination_ajax' == $posts_loading_type ) {
|
1256 |
array_push( $script, 'rt-pagination' );
|
1257 |
}
|
1261 |
array_push( $script, 'rt-magnific-popup' );
|
1262 |
}
|
1263 |
|
|
|
1264 |
if ( 'popup' == $linkType ) {
|
1265 |
array_push( $script, 'rt-scrollbar' );
|
1266 |
}
|
1268 |
if ( class_exists( 'WooCommerce' ) ) {
|
1269 |
array_push( $script, 'rt-jzoom' );
|
1270 |
}
|
|
|
1271 |
}
|
1272 |
|
1273 |
array_push( $style, 'rt-tpg-shortcode' );
|
1288 |
wp_enqueue_script( $script );
|
1289 |
|
1290 |
} else {
|
1291 |
+
$html .= '<p>' . esc_html__( 'No shortCode found', 'the-post-grid' ) . '</p>';
|
1292 |
}
|
1293 |
|
1294 |
+
// restriction issue.
|
1295 |
$restriction = ( ! empty( $scMeta['restriction_user_role'] ) ? $scMeta['restriction_user_role'] : [] );
|
1296 |
if ( ! empty( $restriction ) ) {
|
1297 |
if ( is_user_logged_in() ) {
|
1298 |
$currentUserRoles = Fns::getCurrentUserRoles();
|
1299 |
+
|
1300 |
if ( in_array( 'administrator', $currentUserRoles ) ) {
|
1301 |
$html = $html;
|
1302 |
} else {
|
1303 |
if ( count( array_intersect( $restriction, $currentUserRoles ) ) ) {
|
1304 |
$html = $html;
|
1305 |
} else {
|
1306 |
+
$html = '<p>' . esc_html__(
|
1307 |
+
'You are not permitted to view this content.',
|
1308 |
+
'the-post-grid'
|
1309 |
+
) . '</p>';
|
1310 |
}
|
1311 |
}
|
1312 |
} else {
|
1313 |
+
$html = '<p>' . esc_html__( 'This is a restricted content, you need to logged in to view this content.', 'the-post-grid' ) . '</p>';
|
|
|
1314 |
}
|
1315 |
}
|
1316 |
|
1317 |
return $html;
|
1318 |
}
|
1319 |
+
}
|
|
app/Controllers/WidgetController.php
CHANGED
@@ -1,17 +1,36 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
namespace RT\ThePostGrid\Controllers;
|
5 |
|
6 |
-
|
7 |
use RT\ThePostGrid\Widgets\TPGWidget;
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
class WidgetController {
|
10 |
-
|
|
|
|
|
|
|
11 |
add_action( 'widgets_init', [ $this, 'initWidget' ] );
|
12 |
}
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
|
|
15 |
register_widget( TPGWidget::class );
|
16 |
}
|
17 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Widget Controller class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Controllers;
|
9 |
|
|
|
10 |
use RT\ThePostGrid\Widgets\TPGWidget;
|
11 |
|
12 |
+
// Do not allow directly accessing this file.
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit( 'This script cannot be accessed directly.' );
|
15 |
+
}
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Widget Controller class.
|
19 |
+
*/
|
20 |
class WidgetController {
|
21 |
+
/**
|
22 |
+
* Class construct
|
23 |
+
*/
|
24 |
+
public function __construct() {
|
25 |
add_action( 'widgets_init', [ $this, 'initWidget' ] );
|
26 |
}
|
27 |
|
28 |
+
/**
|
29 |
+
* Widgets
|
30 |
+
*
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
public function initWidget() {
|
34 |
register_widget( TPGWidget::class );
|
35 |
}
|
36 |
+
}
|
app/Helpers/Fns.php
CHANGED
@@ -1,4 +1,9 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Helpers;
|
4 |
|
@@ -6,6 +11,14 @@ use RT\ThePostGrid\Models\Field;
|
|
6 |
use RT\ThePostGrid\Models\ReSizer;
|
7 |
use RT\ThePostGridPro\Helpers\Functions;
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
class Fns {
|
10 |
|
11 |
/**
|
@@ -19,54 +32,72 @@ class Fns {
|
|
19 |
|
20 |
|
21 |
/**
|
22 |
-
*
|
23 |
-
* @param array $args
|
24 |
-
* @param bool $return
|
25 |
*
|
26 |
-
* @
|
|
|
|
|
|
|
27 |
*/
|
28 |
public static function view( $viewName, $args = [], $return = false ) {
|
29 |
-
$file = str_replace(
|
30 |
$file = ltrim( $file, '/' );
|
31 |
$viewFile = trailingslashit( RT_THE_POST_GRID_PLUGIN_PATH . '/resources' ) . $file . '.php';
|
|
|
32 |
if ( ! file_exists( $viewFile ) ) {
|
33 |
-
return new \WP_Error(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
}
|
|
|
35 |
if ( $args ) {
|
36 |
-
extract( $args );
|
37 |
}
|
|
|
38 |
if ( $return ) {
|
39 |
ob_start();
|
40 |
include $viewFile;
|
41 |
|
42 |
return ob_get_clean();
|
43 |
}
|
|
|
44 |
include $viewFile;
|
45 |
}
|
46 |
|
47 |
/**
|
48 |
-
*
|
|
|
|
|
|
|
49 |
*/
|
50 |
-
static function update_post_views_count( $post_id ) {
|
51 |
if ( ! $post_id && is_admin() ) {
|
52 |
return;
|
53 |
}
|
54 |
|
55 |
-
$user_ip = $_SERVER['REMOTE_ADDR']; // retrieve the current IP address of the visitor
|
56 |
$key = 'tpg_cache_' . $user_ip . '_' . $post_id;
|
57 |
$value = [ $user_ip, $post_id ];
|
58 |
$visited = get_transient( $key );
|
|
|
59 |
if ( false === ( $visited ) ) {
|
60 |
-
set_transient( $key, $value, HOUR_IN_SECONDS * 12 ); // store the unique key, Post ID & IP address for 12 hours if it does not exist
|
61 |
|
62 |
-
// now run post views function
|
63 |
$count_key = self::get_post_view_count_meta_key();
|
64 |
$count = get_post_meta( $post_id, $count_key, true );
|
|
|
65 |
if ( '' == $count ) {
|
66 |
update_post_meta( $post_id, $count_key, 1 );
|
67 |
} else {
|
68 |
$count = absint( $count );
|
69 |
$count ++;
|
|
|
70 |
update_post_meta( $post_id, $count_key, $count );
|
71 |
}
|
72 |
}
|
@@ -76,21 +107,20 @@ class Fns {
|
|
76 |
* Template Content
|
77 |
*
|
78 |
* @param string $template_name Template name.
|
79 |
-
* @param array
|
80 |
* @param string $template_path Template path. (default: '').
|
81 |
* @param string $default_path Default path. (default: '').
|
82 |
*/
|
83 |
-
static function get_template( $template_name, $args = null, $template_path = '', $default_path = '' ) {
|
84 |
if ( ! empty( $args ) && is_array( $args ) ) {
|
85 |
-
extract( $args ); //
|
86 |
}
|
87 |
|
88 |
$located = self::locate_template( $template_name, $template_path, $default_path );
|
89 |
|
90 |
-
|
91 |
if ( ! file_exists( $located ) ) {
|
92 |
/* translators: %s template */
|
93 |
-
self::doing_it_wrong( __FUNCTION__, sprintf(
|
94 |
|
95 |
return;
|
96 |
}
|
@@ -109,7 +139,7 @@ class Fns {
|
|
109 |
* Get template content and return
|
110 |
*
|
111 |
* @param string $template_name Template name.
|
112 |
-
* @param array
|
113 |
* @param string $template_path Template path. (default: '').
|
114 |
* @param string $default_path Default path. (default: '').
|
115 |
*
|
@@ -123,14 +153,16 @@ class Fns {
|
|
123 |
}
|
124 |
|
125 |
/**
|
126 |
-
*
|
127 |
-
* @param string $template_path
|
128 |
-
* @param string $default_path
|
129 |
*
|
|
|
|
|
|
|
130 |
* @return mixed|void
|
131 |
*/
|
132 |
public static function locate_template( $template_name, $template_path = '', $default_path = '' ) {
|
133 |
-
$template_name = $template_name .
|
|
|
134 |
if ( ! $template_path ) {
|
135 |
$template_path = rtTPG()->get_template_path();
|
136 |
}
|
@@ -138,6 +170,7 @@ class Fns {
|
|
138 |
if ( ! $default_path ) {
|
139 |
$default_path = rtTPG()->default_template_path() . '/templates/';
|
140 |
}
|
|
|
141 |
// Look within passed path within the theme - this is priority.
|
142 |
$template_files = [];
|
143 |
$template_files[] = trailingslashit( $template_path ) . $template_name;
|
@@ -152,15 +185,30 @@ class Fns {
|
|
152 |
return apply_filters( 'rttpg_locate_template', $template, $template_name );
|
153 |
}
|
154 |
|
155 |
-
|
156 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
$message .= ' Backtrace: ' . wp_debug_backtrace_summary();
|
158 |
_doing_it_wrong( $function, $message, $version );
|
|
|
159 |
}
|
160 |
|
|
|
|
|
|
|
|
|
|
|
161 |
public static function verifyNonce() {
|
162 |
-
$nonce = isset( $_REQUEST[ rtTPG()->nonceId() ] ) ? $_REQUEST[ rtTPG()->nonceId() ] : null;
|
163 |
$nonceText = rtTPG()->nonceText();
|
|
|
164 |
if ( ! wp_verify_nonce( $nonce, $nonceText ) ) {
|
165 |
return false;
|
166 |
}
|
@@ -168,14 +216,11 @@ class Fns {
|
|
168 |
return true;
|
169 |
}
|
170 |
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
}
|
177 |
-
}
|
178 |
-
|
179 |
public static function rtAllOptionFields() {
|
180 |
$fields = array_merge(
|
181 |
Options::rtTPGCommonFilterFields(),
|
@@ -183,7 +228,7 @@ class Fns {
|
|
183 |
Options::responsiveSettingsColumn(),
|
184 |
Options::layoutMiscSettings(),
|
185 |
Options::stickySettings(),
|
186 |
-
// settings
|
187 |
Options::rtTPGSCHeadingSettings(),
|
188 |
Options::rtTPGSCCategorySettings(),
|
189 |
Options::rtTPGSCTitleSettings(),
|
@@ -191,7 +236,7 @@ class Fns {
|
|
191 |
Options::rtTPGSCImageSettings(),
|
192 |
Options::rtTPGSCExcerptSettings(),
|
193 |
Options::rtTPGSCButtonSettings(),
|
194 |
-
// style
|
195 |
Options::rtTPGStyleFields(),
|
196 |
Options::rtTPGStyleHeading(),
|
197 |
Options::rtTPGStyleFullArea(),
|
@@ -208,25 +253,36 @@ class Fns {
|
|
208 |
|
209 |
public static function rt_get_all_term_by_taxonomy( $taxonomy = null, $count = false, $parent = false ) {
|
210 |
$terms = [];
|
|
|
211 |
if ( $taxonomy ) {
|
212 |
-
$temp_terms = get_terms(
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
if ( is_array( $temp_terms ) && ! empty( $temp_terms ) && empty( $temp_terms['errors'] ) ) {
|
214 |
foreach ( $temp_terms as $term ) {
|
215 |
$order = get_term_meta( $term->term_id, '_rt_order', true );
|
216 |
-
if ( $order ===
|
217 |
update_term_meta( $term->term_id, '_rt_order', 0 );
|
218 |
}
|
219 |
}
|
|
|
220 |
global $wp_version;
|
|
|
221 |
$args = [
|
222 |
'taxonomy' => $taxonomy,
|
223 |
'orderby' => 'meta_value_num',
|
224 |
'meta_key' => '_rt_order',
|
225 |
'hide_empty' => false,
|
226 |
];
|
|
|
227 |
if ( $parent >= 0 && $parent !== false ) {
|
228 |
$args['parent'] = absint( $parent );
|
229 |
}
|
|
|
230 |
$args['orderby'] = 'meta_value_num';
|
231 |
$args['meta_key'] = '_rt_order';
|
232 |
|
@@ -234,7 +290,10 @@ class Fns {
|
|
234 |
|
235 |
foreach ( $termObjs as $term ) {
|
236 |
if ( $count ) {
|
237 |
-
$terms[ $term->term_id ] = [
|
|
|
|
|
|
|
238 |
} else {
|
239 |
$terms[ $term->term_id ] = $term->name;
|
240 |
}
|
@@ -247,16 +306,25 @@ class Fns {
|
|
247 |
|
248 |
public static function rt_get_selected_term_by_taxonomy( $taxonomy = null, $include = [], $count = false, $parent = false ) {
|
249 |
$terms = [];
|
|
|
250 |
if ( $taxonomy ) {
|
251 |
-
$temp_terms = get_terms(
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
if ( is_array( $temp_terms ) && ! empty( $temp_terms ) && empty( $temp_terms['errors'] ) ) {
|
253 |
foreach ( $temp_terms as $term ) {
|
254 |
$order = get_term_meta( $term->term_id, '_rt_order', true );
|
255 |
-
if ( $order ===
|
256 |
update_term_meta( $term->term_id, '_rt_order', 0 );
|
257 |
}
|
258 |
}
|
|
|
259 |
global $wp_version;
|
|
|
260 |
$args = [
|
261 |
'taxonomy' => $taxonomy,
|
262 |
'orderby' => 'meta_value_num',
|
@@ -264,9 +332,11 @@ class Fns {
|
|
264 |
'include' => $include,
|
265 |
'hide_empty' => false,
|
266 |
];
|
|
|
267 |
if ( $parent >= 0 && $parent !== false ) {
|
268 |
$args['parent'] = absint( $parent );
|
269 |
}
|
|
|
270 |
$args['orderby'] = 'meta_value_num';
|
271 |
$args['meta_key'] = '_rt_order';
|
272 |
|
@@ -274,7 +344,10 @@ class Fns {
|
|
274 |
|
275 |
foreach ( $termObjs as $term ) {
|
276 |
if ( $count ) {
|
277 |
-
$terms[ $term->term_id ] = [
|
|
|
|
|
|
|
278 |
} else {
|
279 |
$terms[ $term->term_id ] = $term->name;
|
280 |
}
|
@@ -295,6 +368,7 @@ class Fns {
|
|
295 |
if ( ! $post_type ) {
|
296 |
$post_type = get_post_meta( get_the_ID(), 'tpg_post_type', true );
|
297 |
}
|
|
|
298 |
if ( ! $post_type ) {
|
299 |
$post_type = 'post';
|
300 |
}
|
@@ -304,14 +378,17 @@ class Fns {
|
|
304 |
|
305 |
public static function rt_get_all_taxonomy_by_post_type( $post_type = null ) {
|
306 |
$taxonomies = [];
|
|
|
307 |
if ( $post_type && post_type_exists( $post_type ) ) {
|
308 |
$taxObj = get_object_taxonomies( $post_type, 'objects' );
|
|
|
309 |
if ( is_array( $taxObj ) && ! empty( $taxObj ) ) {
|
310 |
foreach ( $taxObj as $tKey => $taxonomy ) {
|
311 |
$taxonomies[ $tKey ] = $taxonomy->label;
|
312 |
}
|
313 |
}
|
314 |
}
|
|
|
315 |
if ( $post_type == 'post' ) {
|
316 |
unset( $taxonomies['post_format'] );
|
317 |
}
|
@@ -322,6 +399,7 @@ class Fns {
|
|
322 |
public static function rt_get_users() {
|
323 |
$users = [];
|
324 |
$u = get_users( apply_filters( 'tpg_author_arg', [] ) );
|
|
|
325 |
if ( ! empty( $u ) ) {
|
326 |
foreach ( $u as $user ) {
|
327 |
$users[ $user->ID ] = $user->display_name;
|
@@ -333,6 +411,7 @@ class Fns {
|
|
333 |
|
334 |
public static function rtFieldGenerator( $fields = [] ) {
|
335 |
$html = null;
|
|
|
336 |
if ( is_array( $fields ) && ! empty( $fields ) ) {
|
337 |
$tpgField = new Field();
|
338 |
foreach ( $fields as $fieldKey => $field ) {
|
@@ -347,15 +426,17 @@ class Fns {
|
|
347 |
* Sanitize field value
|
348 |
*
|
349 |
* @param array $field
|
350 |
-
* @param null
|
351 |
*
|
352 |
* @return array|null
|
353 |
* @internal param $value
|
354 |
*/
|
355 |
public static function sanitize( $field = [], $value = null ) {
|
356 |
$newValue = null;
|
|
|
357 |
if ( is_array( $field ) ) {
|
358 |
$type = ( ! empty( $field['type'] ) ? $field['type'] : 'text' );
|
|
|
359 |
if ( empty( $field['multiple'] ) ) {
|
360 |
if ( $type == 'text' || $type == 'number' || $type == 'select' || $type == 'checkbox' || $type == 'radio' ) {
|
361 |
$newValue = sanitize_text_field( $value );
|
@@ -371,11 +452,13 @@ class Fns {
|
|
371 |
$newValue = self::sanitize_hex_color( $value );
|
372 |
} elseif ( $type == 'image_size' ) {
|
373 |
$newValue = [];
|
|
|
374 |
foreach ( $value as $k => $v ) {
|
375 |
$newValue[ $k ] = esc_attr( $v );
|
376 |
}
|
377 |
} elseif ( $type == 'style' ) {
|
378 |
$newValue = [];
|
|
|
379 |
foreach ( $value as $k => $v ) {
|
380 |
if ( $k == 'color' ) {
|
381 |
$newValue[ $k ] = self::sanitize_hex_color( $v );
|
@@ -388,6 +471,7 @@ class Fns {
|
|
388 |
}
|
389 |
} else {
|
390 |
$newValue = [];
|
|
|
391 |
if ( ! empty( $value ) ) {
|
392 |
if ( is_array( $value ) ) {
|
393 |
foreach ( $value as $key => $val ) {
|
@@ -428,8 +512,10 @@ class Fns {
|
|
428 |
|
429 |
public static function rtFieldGeneratorBackup( $fields = [], $multi = false ) {
|
430 |
$html = null;
|
|
|
431 |
if ( is_array( $fields ) && ! empty( $fields ) ) {
|
432 |
$rtField = new Field();
|
|
|
433 |
if ( $multi ) {
|
434 |
foreach ( $fields as $field ) {
|
435 |
$html .= $rtField->Field( $field );
|
@@ -444,77 +530,82 @@ class Fns {
|
|
444 |
|
445 |
public static function rtSmartStyle( $fields = [] ) {
|
446 |
$h = null;
|
|
|
447 |
if ( ! empty( $fields ) ) {
|
448 |
foreach ( $fields as $key => $label ) {
|
449 |
$atts = '';
|
450 |
$proText = '';
|
451 |
$class = '';
|
452 |
|
453 |
-
$h .=
|
454 |
|
455 |
-
$h .=
|
456 |
$h .= "<div class='field'>";
|
457 |
-
// color
|
458 |
-
$h
|
459 |
-
$h
|
460 |
-
$h
|
461 |
-
$cValue = get_post_meta( get_the_ID(), $key .
|
462 |
-
$h
|
463 |
-
$h
|
464 |
-
$h
|
465 |
-
|
466 |
-
// Font size
|
467 |
-
$h
|
468 |
-
$h
|
469 |
-
$h
|
470 |
-
$h
|
471 |
$fSizes = Options::scFontSize();
|
472 |
-
$sValue = get_post_meta( get_the_ID(), $key .
|
473 |
-
$h
|
|
|
474 |
foreach ( $fSizes as $size => $sizeLabel ) {
|
475 |
-
$sSlt = ( $size == $sValue ?
|
476 |
-
$h
|
477 |
}
|
478 |
-
$h .= "</select>";
|
479 |
-
$h .= "</div>";
|
480 |
-
$h .= "</div>";
|
481 |
|
482 |
-
|
|
|
|
|
483 |
|
484 |
-
|
485 |
-
$h
|
486 |
-
$h
|
487 |
-
$h
|
488 |
-
$h
|
|
|
489 |
$weights = Options::scTextWeight();
|
490 |
-
$wValue = get_post_meta( get_the_ID(), $key .
|
|
|
491 |
foreach ( $weights as $weight => $weightLabel ) {
|
492 |
-
$wSlt = ( $weight == $wValue ?
|
493 |
-
$h
|
494 |
}
|
495 |
-
$h .= "</select>";
|
496 |
-
$h .= "</div>";
|
497 |
-
$h .= "</div>";
|
498 |
|
499 |
-
|
|
|
|
|
500 |
|
501 |
-
|
502 |
-
$h
|
503 |
-
$h
|
504 |
-
$h
|
505 |
-
$h
|
|
|
506 |
$aligns = Options::scAlignment();
|
507 |
-
$aValue = get_post_meta( get_the_ID(), $key .
|
|
|
508 |
foreach ( $aligns as $align => $alignLabel ) {
|
509 |
-
$aSlt = ( $align == $aValue ?
|
510 |
-
$h
|
511 |
}
|
512 |
-
$h .= "</select>";
|
513 |
-
$h .= "</div>";
|
514 |
-
$h .= "</div>";
|
515 |
|
516 |
-
$h .=
|
517 |
-
$h .=
|
|
|
|
|
|
|
|
|
518 |
}
|
519 |
}
|
520 |
|
@@ -531,7 +622,7 @@ class Fns {
|
|
531 |
}
|
532 |
|
533 |
if ( $max && $max !== $min ) {
|
534 |
-
$price .=
|
535 |
$price .= wc_price( $max );
|
536 |
}
|
537 |
|
@@ -540,20 +631,23 @@ class Fns {
|
|
540 |
|
541 |
public static function getTPGShortCodeList() {
|
542 |
$scList = null;
|
543 |
-
$scQ = get_posts(
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
[
|
551 |
-
|
552 |
-
|
553 |
-
|
|
|
|
|
554 |
],
|
555 |
-
]
|
556 |
-
|
|
|
557 |
if ( ! empty( $scQ ) ) {
|
558 |
foreach ( $scQ as $sc ) {
|
559 |
$scList[ $sc->ID ] = $sc->post_title;
|
@@ -565,13 +659,15 @@ class Fns {
|
|
565 |
|
566 |
public static function getAllTPGShortCodeList() {
|
567 |
$scList = null;
|
568 |
-
$scQ = get_posts(
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
|
|
|
|
575 |
if ( ! empty( $scQ ) ) {
|
576 |
foreach ( $scQ as $sc ) {
|
577 |
$scList[ $sc->ID ] = $sc->post_title;
|
@@ -582,32 +678,32 @@ class Fns {
|
|
582 |
}
|
583 |
|
584 |
public static function socialShare( $pLink ) {
|
585 |
-
$html
|
586 |
$html .= "<div class='single-tpg-share'>
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
$html .= '<div id="fb-root"></div>
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
$html .= "<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
612 |
<script>window.___gcfg = { lang: 'en-US', parsetags: 'onload', };</script>";
|
613 |
$html .= "<script src='https://apis.google.com/js/platform.js' async defer></script>";
|
@@ -639,8 +735,9 @@ class Fns {
|
|
639 |
}
|
640 |
|
641 |
$imgSize = [];
|
|
|
642 |
if ( ! empty( $sizes ) ) {
|
643 |
-
$imgSize['full'] =
|
644 |
foreach ( $sizes as $key => $img ) {
|
645 |
$imgSize[ $key ] = ucfirst( $key ) . " ({$img['width']}*{$img['height']})";
|
646 |
}
|
@@ -658,15 +755,19 @@ class Fns {
|
|
658 |
$img_Class = ''
|
659 |
) {
|
660 |
global $post;
|
|
|
661 |
$imgSrc = null;
|
662 |
-
$img_class =
|
|
|
663 |
if ( $img_Class ) {
|
664 |
$img_class .= $img_Class;
|
665 |
}
|
|
|
666 |
$post_id = ( $post_id ? absint( $post_id ) : $post->ID );
|
667 |
$alt = get_the_title( $post_id );
|
668 |
$image = null;
|
669 |
$cSize = false;
|
|
|
670 |
if ( $fImgSize == 'rt_custom' ) {
|
671 |
$fImgSize = 'full';
|
672 |
$cSize = true;
|
@@ -674,17 +775,29 @@ class Fns {
|
|
674 |
|
675 |
if ( $mediaSource == 'feature_image' ) {
|
676 |
if ( $aID = get_post_thumbnail_id( $post_id ) ) {
|
677 |
-
$image = wp_get_attachment_image(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
678 |
$imgSrc = wp_get_attachment_image_src( $aID, $fImgSize );
|
|
|
679 |
if ( ! empty( $imgSrc ) && $img_Class == 'swiper-lazy' ) {
|
680 |
-
$image =
|
681 |
}
|
|
|
682 |
$imgSrc = ! empty( $imgSrc ) ? $imgSrc[0] : $imgSrc;
|
683 |
}
|
684 |
} elseif ( $mediaSource == 'first_image' ) {
|
685 |
-
if ( $img = preg_match_all(
|
|
|
686 |
get_the_content( $post_id ),
|
687 |
-
$matches
|
|
|
688 |
) {
|
689 |
$imgSrc = $matches[1][0];
|
690 |
$size = '';
|
@@ -702,9 +815,10 @@ class Fns {
|
|
702 |
$size = isset( $info[3] ) ? $info[3] : '';
|
703 |
}
|
704 |
|
705 |
-
$image =
|
|
|
706 |
if ( $img_Class == 'swiper-lazy' ) {
|
707 |
-
$image =
|
708 |
}
|
709 |
}
|
710 |
}
|
@@ -720,16 +834,19 @@ class Fns {
|
|
720 |
|
721 |
if ( $w && $h ) {
|
722 |
$post_thumb_id = get_post_thumbnail_id( $post_id );
|
|
|
723 |
if ( $post_thumb_id ) {
|
724 |
$featured_image = wp_get_attachment_image_src( $post_thumb_id, 'full' );
|
725 |
$w = $featured_image[1] < $w ? $featured_image[1] : $w;
|
726 |
$h = $featured_image[2] < $h ? $featured_image[2] : $h;
|
727 |
}
|
728 |
-
|
|
|
|
|
729 |
if ( $img_Class !== 'swiper-lazy' ) {
|
730 |
-
$image =
|
731 |
} else {
|
732 |
-
$image =
|
733 |
}
|
734 |
}
|
735 |
}
|
@@ -776,9 +893,11 @@ class Fns {
|
|
776 |
public static function get_the_excerpt( $post_id, $data = [] ) {
|
777 |
$type = $data['excerpt_type'];
|
778 |
$post = get_post( $post_id );
|
|
|
779 |
if ( empty( $post ) ) {
|
780 |
return '';
|
781 |
}
|
|
|
782 |
if ( $type == 'full' ) {
|
783 |
ob_start();
|
784 |
the_content();
|
@@ -791,21 +910,25 @@ class Fns {
|
|
791 |
} else {
|
792 |
$defaultExcerpt = get_the_excerpt( $post_id );
|
793 |
}
|
|
|
794 |
$limit = isset( $data['excerpt_limit'] ) && $data['excerpt_limit'] ? abs( $data['excerpt_limit'] ) : 0;
|
795 |
$more = $data['excerpt_more_text'];
|
796 |
$excerpt = preg_replace( '`\[[^\]]*\]`', '', $defaultExcerpt );
|
797 |
$excerpt = strip_shortcodes( $excerpt );
|
798 |
$excerpt = preg_replace( '`[[^]]*]`', '', $excerpt );
|
799 |
$excerpt = str_replace( '…', '', $excerpt );
|
|
|
800 |
if ( $limit ) {
|
801 |
$excerpt = wp_strip_all_tags( $excerpt );
|
802 |
-
|
|
|
803 |
$limit = $limit + 1;
|
804 |
$rawExcerpt = $excerpt;
|
805 |
$excerpt = explode( ' ', $excerpt, $limit );
|
|
|
806 |
if ( count( $excerpt ) >= $limit ) {
|
807 |
array_pop( $excerpt );
|
808 |
-
$excerpt = implode(
|
809 |
} else {
|
810 |
$excerpt = $rawExcerpt;
|
811 |
}
|
@@ -823,10 +946,11 @@ class Fns {
|
|
823 |
'b' => [],
|
824 |
'br' => [ [] ],
|
825 |
];
|
826 |
-
|
|
|
827 |
}
|
828 |
|
829 |
-
$excerpt = ( $more ? $excerpt .
|
830 |
|
831 |
return apply_filters( 'tpg_get_the_excerpt', $excerpt, $post_id, $data, $defaultExcerpt );
|
832 |
}
|
@@ -836,19 +960,21 @@ class Fns {
|
|
836 |
$title = $originalTitle = get_the_title( $post_id );
|
837 |
$limit = isset( $data['title_limit'] ) ? absint( $data['title_limit'] ) : 0;
|
838 |
$limit_type = isset( $data['title_limit_type'] ) ? trim( $data['title_limit_type'] ) : 'character';
|
|
|
839 |
if ( $limit ) {
|
840 |
-
if ( $limit_type ==
|
841 |
$limit = $limit + 1;
|
842 |
$title = explode( ' ', $title, $limit );
|
|
|
843 |
if ( count( $title ) >= $limit ) {
|
844 |
array_pop( $title );
|
845 |
-
$title = implode(
|
846 |
} else {
|
847 |
$title = $originalTitle;
|
848 |
}
|
849 |
} else {
|
850 |
if ( $limit > 0 && strlen( $title ) > $limit ) {
|
851 |
-
$title = mb_substr( $title, 0, $limit,
|
852 |
$title = preg_replace( '/\W\w+\s*(\W*)$/', '$1', $title );
|
853 |
}
|
854 |
}
|
@@ -863,18 +989,20 @@ class Fns {
|
|
863 |
$showitems = ( $range * 2 ) + 1;
|
864 |
|
865 |
$wpQuery = $postGrid;
|
|
|
866 |
global $wp_query;
|
|
|
867 |
if ( empty( $wpQuery ) ) {
|
868 |
$wpQuery = $wp_query;
|
869 |
}
|
870 |
|
871 |
$pages = ! empty( $wpQuery->max_num_pages ) ? $wpQuery->max_num_pages : 1;
|
872 |
$paged = ! empty( $wpQuery->query['paged'] ) ? $wpQuery->query['paged'] : 1;
|
|
|
873 |
if ( is_front_page() ) {
|
874 |
$paged = ! empty( $wp_query->query['paged'] ) ? $wp_query->query['paged'] : 1;
|
875 |
}
|
876 |
|
877 |
-
|
878 |
$ajaxClass = null;
|
879 |
$dataAttr = null;
|
880 |
|
@@ -891,28 +1019,24 @@ class Fns {
|
|
891 |
}
|
892 |
|
893 |
if ( $paged > 1 && $showitems < $pages && ! $ajax ) {
|
894 |
-
$p
|
895 |
$html .= "<li><a data-paged='{$p}' href='" . get_pagenum_link( $p ) . "' aria-label='Previous'>‹</a></li>";
|
896 |
}
|
897 |
|
898 |
if ( $ajax ) {
|
899 |
for ( $i = 1; $i <= $pages; $i ++ ) {
|
900 |
-
$html .= ( $paged == $i ) ?
|
901 |
-
|
902 |
-
</li>" : "<li><a data-paged='{$i}' href='" . get_pagenum_link( $i ) . "'>" . $i . "</a></li>";
|
903 |
}
|
904 |
} else {
|
905 |
for ( $i = 1; $i <= $pages; $i ++ ) {
|
906 |
if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
|
907 |
-
$html .= ( $paged == $i ) ?
|
908 |
-
|
909 |
-
</li>" : "<li><a data-paged='{$i}' href='" . get_pagenum_link( $i ) . "'>" . $i . "</a></li>";
|
910 |
}
|
911 |
}
|
912 |
}
|
913 |
|
914 |
if ( $paged < $pages && $showitems < $pages && ! $ajax ) {
|
915 |
-
$p
|
916 |
$html .= "<li><a data-paged='{$p}' href=\"" . get_pagenum_link( $paged + 1 ) . "\" aria-label='Next'>›</a></li>";
|
917 |
}
|
918 |
|
@@ -920,8 +1044,8 @@ class Fns {
|
|
920 |
$html .= "<li><a data-paged='{$pages}' href='" . get_pagenum_link( $pages ) . "' aria-label='Last'>»</a></li>";
|
921 |
}
|
922 |
|
923 |
-
$html .=
|
924 |
-
$html .=
|
925 |
}
|
926 |
|
927 |
return $html;
|
@@ -930,10 +1054,8 @@ class Fns {
|
|
930 |
public static function rt_pagination_ajax( $scID, $range = 4, $pages = '' ) {
|
931 |
$html = null;
|
932 |
|
933 |
-
|
934 |
$html .= "<div class='rt-tpg-pagination-ajax' data-sc-id='{$scID}' data-paged='1'>";
|
935 |
-
|
936 |
-
$html .= "</div>";
|
937 |
|
938 |
return $html;
|
939 |
}
|
@@ -942,10 +1064,10 @@ class Fns {
|
|
942 |
* Call the Image resize model for resize function
|
943 |
*
|
944 |
* @param $url
|
945 |
-
* @param null
|
946 |
-
* @param null
|
947 |
-
* @param null
|
948 |
-
* @param bool|true
|
949 |
* @param bool|false $upscale
|
950 |
*
|
951 |
* @return array|bool|string
|
@@ -963,17 +1085,17 @@ class Fns {
|
|
963 |
public static function rtHex2rgba( $color, $opacity = .5 ) {
|
964 |
$default = 'rgb(0,0,0)';
|
965 |
|
966 |
-
//Return default if no color provided
|
967 |
if ( empty( $color ) ) {
|
968 |
return $default;
|
969 |
}
|
970 |
|
971 |
-
//Sanitize $color if "#" is provided
|
972 |
if ( $color[0] == '#' ) {
|
973 |
$color = substr( $color, 1 );
|
974 |
}
|
975 |
|
976 |
-
//Check if color has 6 or 3 characters and get values
|
977 |
if ( strlen( $color ) == 6 ) {
|
978 |
$hex = [ $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ];
|
979 |
} elseif ( strlen( $color ) == 3 ) {
|
@@ -982,24 +1104,25 @@ class Fns {
|
|
982 |
return $default;
|
983 |
}
|
984 |
|
985 |
-
//Convert hexadec to rgb
|
986 |
$rgb = array_map( 'hexdec', $hex );
|
987 |
|
988 |
-
//Check if opacity is set(rgba or rgb)
|
989 |
if ( $opacity ) {
|
990 |
if ( absint( $opacity ) > 1 ) {
|
991 |
$opacity = 1.0;
|
992 |
}
|
993 |
-
|
|
|
994 |
} else {
|
995 |
-
$output = 'rgb(' . implode(
|
996 |
}
|
997 |
|
998 |
-
//Return rgb(a) color string
|
999 |
return $output;
|
1000 |
}
|
1001 |
|
1002 |
-
public static function meta_exist( $meta_key, $post_id = null, $type =
|
1003 |
if ( ! $post_id ) {
|
1004 |
return false;
|
1005 |
}
|
@@ -1013,6 +1136,7 @@ class Fns {
|
|
1013 |
'big' => 6,
|
1014 |
'small' => 6,
|
1015 |
];
|
|
|
1016 |
if ( $col ) {
|
1017 |
if ( $col == 12 ) {
|
1018 |
$return['big'] = 12;
|
@@ -1032,17 +1156,19 @@ class Fns {
|
|
1032 |
public static function formatSpacing( $data = '' ) {
|
1033 |
if ( ! empty( $data ) ) {
|
1034 |
$spacing = array_filter( explode( ',', $data ), 'is_numeric' );
|
|
|
1035 |
if ( count( $spacing ) > 4 ) {
|
1036 |
$spacing = array_slice( $spacing, 0, 4, true );
|
1037 |
}
|
1038 |
-
|
|
|
1039 |
}
|
1040 |
|
1041 |
return $data;
|
1042 |
}
|
1043 |
|
1044 |
public static function layoutStyle( $layoutID, $scMeta, $layout, $scId = null ) {
|
1045 |
-
$css
|
1046 |
$css .= "<style type='text/css' media='all'>";
|
1047 |
// primary color
|
1048 |
if ( $scId ) {
|
@@ -1054,8 +1180,10 @@ class Fns {
|
|
1054 |
: ( isset( $scMeta['button_text_color'][0] ) ? $scMeta['button_text_color'][0] : null ) );
|
1055 |
$button_hover_text_color = ( isset( $scMeta['button_hover_text_color'][0] ) ? $scMeta['button_hover_text_color'][0] : null );
|
1056 |
$button_border_color = ( isset( $scMeta['button_border_color'][0] ) ? $scMeta['button_border_color'][0] : null );
|
1057 |
-
$overlay_color = ( ! empty( $scMeta['overlay_color'][0] ) ?
|
1058 |
-
|
|
|
|
|
1059 |
$overlay_padding = ( ! empty( $scMeta['overlay_padding'][0] ) ? absint( $scMeta['overlay_padding'][0] ) : null );
|
1060 |
$gutter = ! empty( $scMeta['tgp_gutter'][0] ) ? absint( $scMeta['tgp_gutter'][0] ) : null;
|
1061 |
$read_more_button_border_radius = isset( $scMeta['tpg_read_more_button_border_radius'][0] ) ? $scMeta['tpg_read_more_button_border_radius'][0] : '';
|
@@ -1122,8 +1250,10 @@ class Fns {
|
|
1122 |
: ( ! empty( $btn_text_color ) ? $btn_text_color : null ) );
|
1123 |
$button_border_color = ( isset( $scMeta['button_border_color'] ) ? $scMeta['button_border_color'] : null );
|
1124 |
$button_hover_text_color = ( isset( $scMeta['button_hover_text_color'] ) ? $scMeta['button_hover_text_color'] : null );
|
1125 |
-
$overlay_color = ( ! empty( $scMeta['overlay_color'] ) ?
|
1126 |
-
|
|
|
|
|
1127 |
$overlay_padding = ( ! empty( $scMeta['overlay_padding'] ) ? absint( $scMeta['overlay_padding'] ) : null );
|
1128 |
$gutter = ! empty( $scMeta['tgp_gutter'] ) ? absint( $scMeta['tgp_gutter'] ) : null;
|
1129 |
$read_more_button_border_radius = isset( $scMeta['tpg_read_more_button_border_radius'] ) ? $scMeta['tpg_read_more_button_border_radius'] : '';
|
@@ -1184,194 +1314,197 @@ class Fns {
|
|
1184 |
|
1185 |
if ( $primaryColor ) {
|
1186 |
$css .= "#{$layoutID} .rt-holder .rt-woo-info .price{";
|
1187 |
-
$css .=
|
1188 |
-
$css .=
|
1189 |
-
$css .= "body .rt-tpg-container .rt-tpg-isotope-buttons .selected,
|
1190 |
-
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
-
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
$css .=
|
1201 |
-
$css .=
|
1202 |
-
|
1203 |
-
|
1204 |
-
|
1205 |
-
! empty( $scMeta['overlay_opacity'][0] ) ? absint( $scMeta['overlay_opacity'][0] ) / 10 : .8
|
|
|
1206 |
$css .= "#{$layoutID} .layout5 .rt-holder .overlay, #{$layoutID} .isotope2 .rt-holder .overlay, #{$layoutID} .carousel2 .rt-holder .overlay,#{$layoutID} .layout15 .rt-holder h3, #{$layoutID} .isotope11 .rt-holder h3, #{$layoutID} .carousel11 .rt-holder h3, #{$layoutID} .layout16 .rt-holder h3,
|
1207 |
#{$layoutID} .isotope12 .rt-holder h3, #{$layoutID} .carousel12 .rt-holder h3 {";
|
1208 |
-
$css .=
|
1209 |
-
$css .=
|
1210 |
}
|
1211 |
|
1212 |
if ( $button_border_color ) {
|
1213 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item,
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
$css .=
|
1220 |
-
$css .=
|
1221 |
$css .= "#{$layoutID} .rt-holder .read-more a {";
|
1222 |
-
$css .=
|
1223 |
-
$css .=
|
1224 |
}
|
1225 |
|
1226 |
if ( $button_bg_color ) {
|
1227 |
$css .= "#{$layoutID} .pagination-list li a,
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
$css .=
|
1249 |
-
$css .=
|
1250 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item,
|
1251 |
-
|
1252 |
-
$css .=
|
1253 |
-
$css .=
|
1254 |
$css .= "#{$layoutID}.rt-tpg-container .layout17 .rt-holder .overlay a.tpg-zoom .fa{";
|
1255 |
-
$css .=
|
1256 |
-
$css .=
|
1257 |
|
1258 |
$css .= "#{$layoutID} .rt-holder .read-more a {";
|
1259 |
-
$css .=
|
1260 |
-
$css .=
|
1261 |
}
|
1262 |
|
1263 |
-
// button active color
|
1264 |
if ( $button_active_bg_color ) {
|
1265 |
-
$css .= "#{$layoutID} .pagination li.active span,
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
$css .=
|
1273 |
-
$css .=
|
1274 |
|
1275 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected,
|
1276 |
-
|
1277 |
-
|
1278 |
-
$css .=
|
1279 |
-
$css .=
|
1280 |
}
|
1281 |
|
1282 |
-
// Button hover bg color
|
1283 |
if ( $button_hover_bg_color ) {
|
1284 |
$css .= "#{$layoutID} .pagination-list li a:hover,
|
1285 |
-
|
1286 |
-
|
1287 |
-
|
1288 |
-
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
-
|
1306 |
-
$css .=
|
1307 |
-
$css .=
|
1308 |
|
1309 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover,
|
1310 |
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item:hover,
|
1311 |
#{$layoutID}.rt-tpg-container .swiper-navigation .slider-btn:hover,
|
1312 |
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li>a:hover{";
|
1313 |
-
$css .=
|
1314 |
-
$css .=
|
1315 |
$css .= "#{$layoutID}.rt-tpg-container .layout17 .rt-holder .overlay a.tpg-zoom:hover .fa{";
|
1316 |
-
$css .=
|
1317 |
-
$css .=
|
1318 |
}
|
1319 |
|
1320 |
-
//Button text color
|
1321 |
if ( $button_text_color ) {
|
1322 |
$css .= "#{$layoutID} .pagination-list li a,
|
1323 |
-
|
1324 |
-
|
1325 |
-
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
-
|
1335 |
-
|
1336 |
-
|
1337 |
-
|
1338 |
-
|
1339 |
-
|
1340 |
-
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
$css .=
|
1349 |
-
$css .=
|
1350 |
}
|
1351 |
|
1352 |
if ( $button_hover_text_color ) {
|
1353 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover,
|
1354 |
-
|
1355 |
-
|
1356 |
-
|
1357 |
-
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
1366 |
-
$css .=
|
1367 |
-
$css .=
|
1368 |
}
|
1369 |
|
1370 |
if ( $overlay_color || $overlay_padding ) {
|
1371 |
if ( in_array( $layout, [ 'layout15', 'isotope11', 'carousel11' ] ) ) {
|
1372 |
$css .= "#{$layoutID} .{$layout} .rt-holder:hover .overlay .post-info{";
|
1373 |
-
} elseif ( in_array(
|
1374 |
-
|
|
|
|
|
1375 |
) {
|
1376 |
$css .= "#{$layoutID} .{$layout} .rt-holder .post-info{";
|
1377 |
} elseif ( in_array( $layout, [ 'layout7', 'isotope4', 'carousel4' ] ) ) {
|
@@ -1384,20 +1517,23 @@ class Fns {
|
|
1384 |
$css .= "#{$layoutID} .rt-post-overlay .post-img > a:first-of-type::after,";
|
1385 |
$css .= "#{$layoutID} .rt-holder .overlay:hover{";
|
1386 |
}
|
|
|
1387 |
if ( $overlay_color ) {
|
1388 |
-
$css .=
|
1389 |
-
$css .=
|
1390 |
}
|
|
|
1391 |
if ( $overlay_padding ) {
|
1392 |
-
$css .=
|
1393 |
}
|
1394 |
-
|
|
|
1395 |
}
|
1396 |
|
1397 |
if ( $boxShadow ) {
|
1398 |
$css .= "#{$layoutID} .{$layout} .rt-holder {";
|
1399 |
$css .= "box-shadow : 0px 0px 2px 0px {$boxShadow};";
|
1400 |
-
$css .=
|
1401 |
}
|
1402 |
|
1403 |
/* gutter */
|
@@ -1407,303 +1543,340 @@ class Fns {
|
|
1407 |
$css .= "padding-right : {$gutter}px !important;";
|
1408 |
$css .= "margin-top : {$gutter}px;";
|
1409 |
$css .= "margin-bottom : {$gutter}px;";
|
1410 |
-
$css .=
|
1411 |
$css .= "#{$layoutID} .rt-row{";
|
1412 |
$css .= "margin-left : -{$gutter}px !important;";
|
1413 |
$css .= "margin-right : -{$gutter}px !important;";
|
1414 |
-
$css .=
|
1415 |
$css .= "#{$layoutID}.rt-container-fluid,#{$layoutID}.rt-container{";
|
1416 |
$css .= "padding-left : {$gutter}px;";
|
1417 |
$css .= "padding-right : {$gutter}px;";
|
1418 |
-
$css .=
|
1419 |
|
1420 |
-
// remove inner row margin
|
1421 |
$css .= "#{$layoutID} .rt-row .rt-row [class*='rt-col-'] {";
|
1422 |
-
$css .=
|
1423 |
-
$css .=
|
1424 |
}
|
1425 |
|
1426 |
-
// Read more button border radius
|
1427 |
if ( isset( $read_more_button_border_radius ) || trim( $read_more_button_border_radius ) !== '' ) {
|
1428 |
$css .= "#{$layoutID} .read-more a{";
|
1429 |
-
$css .=
|
1430 |
-
$css .=
|
1431 |
}
|
1432 |
|
1433 |
-
// Section
|
1434 |
if ( $sectionBg ) {
|
1435 |
$css .= "#{$layoutID}.rt-tpg-container {";
|
1436 |
-
$css .=
|
1437 |
-
$css .=
|
1438 |
}
|
|
|
1439 |
if ( $sectionMargin ) {
|
1440 |
$css .= "#{$layoutID}.rt-tpg-container {";
|
1441 |
-
$css .=
|
1442 |
-
$css .=
|
1443 |
}
|
|
|
1444 |
if ( $sectionPadding ) {
|
1445 |
$css .= "#{$layoutID}.rt-tpg-container {";
|
1446 |
-
$css .=
|
1447 |
-
$css .=
|
1448 |
}
|
1449 |
-
|
|
|
1450 |
if ( $boxBg ) {
|
1451 |
$css .= "#{$layoutID} .rt-holder, #{$layoutID} .rt-holder .rt-detail,#{$layoutID} .rt-post-overlay .post-img + .post-content {";
|
1452 |
-
$css .=
|
1453 |
-
$css .=
|
1454 |
}
|
|
|
1455 |
if ( $boxBorderColor ) {
|
1456 |
$css .= "#{$layoutID} .rt-holder {";
|
1457 |
-
$css .=
|
1458 |
-
$css .=
|
1459 |
}
|
|
|
1460 |
if ( $boxBorder ) {
|
1461 |
$css .= "#{$layoutID} .rt-holder {";
|
1462 |
-
$css .=
|
1463 |
-
$css .=
|
1464 |
-
$css .=
|
1465 |
}
|
|
|
1466 |
if ( $boxBorderRadius ) {
|
1467 |
$css .= "#{$layoutID} .rt-holder {";
|
1468 |
-
$css .=
|
1469 |
-
$css .=
|
1470 |
}
|
|
|
1471 |
if ( $boxPadding ) {
|
1472 |
$css .= "#{$layoutID} .rt-holder {";
|
1473 |
-
$css .=
|
1474 |
-
$css .=
|
1475 |
}
|
|
|
1476 |
if ( $contentPadding ) {
|
1477 |
$css .= "#{$layoutID} .rt-holder .rt-detail {";
|
1478 |
-
$css .=
|
1479 |
-
$css .=
|
1480 |
}
|
1481 |
-
|
|
|
1482 |
if ( $headingBg ) {
|
1483 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading {";
|
1484 |
-
$css .=
|
1485 |
-
$css .=
|
1486 |
|
1487 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading::after {";
|
1488 |
-
$css .=
|
1489 |
-
$css .=
|
1490 |
}
|
|
|
1491 |
if ( $headingColor ) {
|
1492 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading a, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading a, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading a {";
|
1493 |
-
$css .=
|
1494 |
-
$css .=
|
1495 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading::before {";
|
1496 |
-
$css .=
|
1497 |
-
$css .=
|
1498 |
}
|
|
|
1499 |
if ( $headingBorderSize ) {
|
1500 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 {";
|
1501 |
-
//
|
1502 |
-
$css .=
|
1503 |
-
$css .=
|
1504 |
|
1505 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line {";
|
1506 |
-
$css .=
|
1507 |
-
$css .=
|
1508 |
}
|
|
|
1509 |
if ( $headingBorderColor ) {
|
1510 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 {";
|
1511 |
-
$css .=
|
1512 |
-
$css .=
|
1513 |
}
|
|
|
1514 |
if ( $headingMargin ) {
|
1515 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper {";
|
1516 |
-
$css .=
|
1517 |
-
$css .=
|
1518 |
}
|
|
|
1519 |
if ( $headingPadding ) {
|
1520 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper .tpg-widget-heading {";
|
1521 |
-
$css .=
|
1522 |
-
$css .=
|
1523 |
}
|
1524 |
-
|
|
|
1525 |
if ( isset( $image_border_radius ) || trim( $image_border_radius ) !== '' ) {
|
1526 |
$css .= "#{$layoutID} .rt-img-holder img.rt-img-responsive,#{$layoutID} .rt-img-holder,
|
1527 |
-
|
1528 |
-
|
1529 |
-
|
1530 |
-
|
1531 |
-
$css .=
|
1532 |
-
$css .=
|
1533 |
}
|
1534 |
|
1535 |
-
// Title decoration
|
1536 |
if ( $title_color || $title_size || $title_weight || $title_alignment ) {
|
1537 |
$css .= "#{$layoutID} .{$layout} .rt-holder h2.entry-title,
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
|
|
1553 |
if ( $title_color ) {
|
1554 |
-
$css .=
|
1555 |
}
|
|
|
1556 |
if ( $title_size ) {
|
1557 |
$lineHeight = $title_size + 10;
|
1558 |
-
$css
|
1559 |
-
$css
|
1560 |
}
|
|
|
1561 |
if ( $title_weight ) {
|
1562 |
-
$css .=
|
1563 |
}
|
|
|
1564 |
if ( $title_alignment ) {
|
1565 |
-
$css .=
|
1566 |
}
|
1567 |
-
|
|
|
|
|
1568 |
if ( $title_size ) {
|
1569 |
$css .= "#{$layoutID} .post-grid-lg-style-1 .post-title,
|
1570 |
-
#{$layoutID} .post-grid-lg-style-1 .post-title a,
|
1571 |
#{$layoutID} .big-layout .post-title,
|
1572 |
-
#{$layoutID} .big-layout .post-title a,
|
1573 |
#{$layoutID} .post-grid-lg-style-1 .post-title,
|
1574 |
#{$layoutID} .post-grid-lg-style-1 .post-title a {";
|
1575 |
-
$css .=
|
1576 |
-
$css .=
|
1577 |
-
$css .=
|
1578 |
}
|
1579 |
}
|
1580 |
-
|
|
|
1581 |
if ( $title_hover_color ) {
|
1582 |
$css .= "#{$layoutID} .{$layout} .rt-holder h2.entry-title:hover,
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
|
1596 |
-
$css .=
|
1597 |
-
$css .=
|
1598 |
-
}
|
1599 |
-
// Excerpt decoration
|
1600 |
if ( $excerpt_color || $excerpt_size || $excerpt_weight || $excerpt_alignment ) {
|
1601 |
$css .= "#{$layoutID} .{$layout} .rt-holder .tpg-excerpt,#{$layoutID} .{$layout} .tpg-excerpt,#{$layoutID} .{$layout} .rt-holder .post-content,#{$layoutID} .rt-holder .rt-woo-info p,#{$layoutID} .post-content p {";
|
|
|
1602 |
if ( $excerpt_color ) {
|
1603 |
-
$css .=
|
1604 |
}
|
|
|
1605 |
if ( $excerpt_size ) {
|
1606 |
-
$css .=
|
1607 |
}
|
|
|
1608 |
if ( $excerpt_weight ) {
|
1609 |
-
$css .=
|
1610 |
}
|
|
|
1611 |
if ( $excerpt_alignment ) {
|
1612 |
-
$css .=
|
1613 |
}
|
1614 |
-
|
|
|
1615 |
}
|
1616 |
-
|
|
|
1617 |
if ( $meta_data_color || $meta_data_size || $meta_data_weight || $meta_data_alignment ) {
|
1618 |
$css .= "#{$layoutID} .{$layout} .rt-holder .post-meta-user,
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
|
|
1635 |
if ( $meta_data_color ) {
|
1636 |
-
$css .=
|
1637 |
}
|
|
|
1638 |
if ( $meta_data_size ) {
|
1639 |
-
$css .=
|
1640 |
}
|
|
|
1641 |
if ( $meta_data_weight ) {
|
1642 |
-
$css .=
|
1643 |
}
|
|
|
1644 |
if ( $meta_data_alignment ) {
|
1645 |
-
$css .=
|
1646 |
}
|
1647 |
-
|
|
|
1648 |
}
|
1649 |
-
|
|
|
1650 |
if ( $catBg ) {
|
1651 |
$css .= "#{$layoutID} .cat-over-image.style2 .categories-links a,
|
1652 |
-
|
1653 |
-
|
1654 |
-
|
1655 |
-
|
1656 |
-
|
1657 |
-
|
1658 |
|
1659 |
$css .= "#{$layoutID} .cat-above-title.style3 .categories-links a:after,
|
1660 |
-
|
1661 |
-
|
1662 |
-
|
1663 |
-
|
1664 |
-
|
1665 |
|
1666 |
$css .= "#{$layoutID} .rt-tpg-category:not(style1) i {
|
1667 |
color: {$catBg};
|
1668 |
}";
|
1669 |
}
|
|
|
1670 |
if ( $catTextColor ) {
|
1671 |
$css .= "#{$layoutID} .cat-over-image .categories-links a,
|
1672 |
#{$layoutID} .cat-above-title .categories-links a,
|
1673 |
#{$layoutID} .rt-tpg-category.style1 > i,
|
1674 |
#{$layoutID} .rt-tpg-category > a {";
|
1675 |
-
$css .=
|
1676 |
-
$css .=
|
1677 |
}
|
|
|
1678 |
if ( $catBorderRadius ) {
|
1679 |
$css .= "#{$layoutID} .cat-over-image .categories-links a,#{$layoutID} .cat-above-title .categories-links a,#{$layoutID} .rt-tpg-category > a{";
|
1680 |
-
$css .=
|
1681 |
-
$css .=
|
1682 |
}
|
|
|
1683 |
if ( $catPadding ) {
|
1684 |
$css .= "#{$layoutID} .cat-over-image .categories-links a,#{$layoutID} .cat-above-title .categories-links a,#{$layoutID} .rt-tpg-category > a{";
|
1685 |
-
$css .=
|
1686 |
-
$css .=
|
1687 |
}
|
|
|
1688 |
if ( $catMargin ) {
|
1689 |
$css .= "#{$layoutID} .categories-links,#{$layoutID} .rt-tpg-category > a{";
|
1690 |
-
$css .=
|
1691 |
-
$css .=
|
1692 |
}
|
|
|
1693 |
if ( $categorySize ) {
|
1694 |
$css .= "#{$layoutID} .categories-links,#{$layoutID} .rt-tpg-category > a {";
|
1695 |
-
$css .=
|
1696 |
-
$css .=
|
1697 |
}
|
1698 |
|
1699 |
-
$css .=
|
1700 |
|
1701 |
return $css;
|
1702 |
}
|
1703 |
|
1704 |
public static function get_meta_keys( $post_type ) {
|
1705 |
-
// $cache = get_transient( 'tpg_' . $post_type . '_meta_keys' );
|
1706 |
-
// $meta_keys = $cache ? $cache : self::generate_meta_keys( $post_type );
|
1707 |
$meta_keys = self::generate_meta_keys( $post_type );
|
1708 |
|
1709 |
return $meta_keys;
|
@@ -1711,18 +1884,19 @@ class Fns {
|
|
1711 |
|
1712 |
public static function generate_meta_keys( $post_type ) {
|
1713 |
$meta_keys = [];
|
|
|
1714 |
if ( $post_type ) {
|
1715 |
global $wpdb;
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
|
|
1724 |
$meta_keys = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
|
1725 |
-
// set_transient( 'tpg_' . $post_type . '_meta_keys', $meta_keys, 60 * 60 * 24 ); # create 1 Day Expiration
|
1726 |
}
|
1727 |
|
1728 |
return $meta_keys;
|
@@ -1740,6 +1914,7 @@ class Fns {
|
|
1740 |
|
1741 |
public static function is_acf() {
|
1742 |
$plugin = null;
|
|
|
1743 |
if ( class_exists( 'acf' ) ) {
|
1744 |
$plugin = 'acf';
|
1745 |
}
|
@@ -1748,9 +1923,10 @@ class Fns {
|
|
1748 |
}
|
1749 |
|
1750 |
public static function get_groups_by_post_type( $post_type ) {
|
1751 |
-
$post_type = $post_type ? $post_type :
|
1752 |
$groups = [];
|
1753 |
$plugin = self::is_acf();
|
|
|
1754 |
switch ( $plugin ) {
|
1755 |
case 'acf':
|
1756 |
$groups = self::get_groups_by_post_type_acf( $post_type );
|
@@ -1769,25 +1945,28 @@ class Fns {
|
|
1769 |
*/
|
1770 |
public static function get_groups_by_post_type_acf( $post_type ) {
|
1771 |
$groups = [];
|
1772 |
-
$groups_q = get_posts(
|
|
|
|
|
|
|
|
|
|
|
1773 |
|
1774 |
if ( ! empty( $groups_q ) ) {
|
1775 |
foreach ( $groups_q as $group ) {
|
1776 |
$c = $group->post_content ? unserialize( $group->post_content ) : [];
|
1777 |
$flag = false;
|
|
|
1778 |
if ( ! empty( $c['location'] ) ) {
|
1779 |
foreach ( $c['location'] as $rules ) {
|
1780 |
foreach ( $rules as $rule ) {
|
1781 |
-
if (
|
1782 |
-
if ( ( ! empty( $rule['param'] ) && $rule['param'] == 'post_type' )
|
1783 |
-
&& ( ! empty( $rule['operator'] ) && $rule['operator'] == '==' )
|
1784 |
) {
|
1785 |
$flag = true;
|
1786 |
}
|
1787 |
} else {
|
1788 |
-
if ( ( ! empty( $rule['param'] ) && ( $rule['param'] == 'post_type' || ( $rule['param'] == 'post_category' && 'post' == $post_type ) ) )
|
1789 |
-
&& ( ! empty( $rule['operator'] ) && $rule['operator'] == '==' )
|
1790 |
-
&& ( ! empty( $rule['value'] ) && ( $rule['value'] == $post_type || ( $rule['param'] == 'post_category' && 'post' == $post_type ) ) )
|
1791 |
|
1792 |
) {
|
1793 |
$flag = true;
|
@@ -1819,7 +1998,7 @@ class Fns {
|
|
1819 |
|
1820 |
/**
|
1821 |
* Elementor Functionality
|
1822 |
-
|
1823 |
*/
|
1824 |
|
1825 |
|
@@ -1834,8 +2013,10 @@ class Fns {
|
|
1834 |
if ( isset( $data['category'] ) && 'category' == $data['category'] ) {
|
1835 |
return true;
|
1836 |
}
|
|
|
1837 |
if ( 'default' == $data['category_position']
|
1838 |
-
|
|
|
1839 |
[
|
1840 |
'grid-layout4',
|
1841 |
'grid-layout5',
|
@@ -1861,7 +2042,8 @@ class Fns {
|
|
1861 |
'slider-layout9',
|
1862 |
'slider-layout11',
|
1863 |
'slider-layout12',
|
1864 |
-
]
|
|
|
1865 |
) {
|
1866 |
return false;
|
1867 |
}
|
@@ -1879,41 +2061,52 @@ class Fns {
|
|
1879 |
*/
|
1880 |
public static function get_post_link( $pID, $data ) {
|
1881 |
$link_class = $link_start = $link_end = $readmore_link_start = $readmore_link_end = null;
|
|
|
1882 |
if ( 'default' == $data['post_link_type'] ) {
|
1883 |
-
$link_class =
|
1884 |
-
$link_start = $readmore_link_start = sprintf(
|
1885 |
-
|
1886 |
-
|
1887 |
-
|
1888 |
-
$
|
1889 |
-
|
|
|
|
|
1890 |
} elseif ( 'popup' == $data['post_link_type'] ) {
|
1891 |
-
$link_class =
|
|
|
1892 |
if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
1893 |
-
$link_class =
|
1894 |
}
|
1895 |
-
|
1896 |
-
|
|
|
|
|
1897 |
esc_url( get_permalink() ),
|
1898 |
-
$link_class,
|
1899 |
-
$data['link_target'] )
|
1900 |
-
|
|
|
1901 |
} elseif ( 'multi_popup' == $data['post_link_type'] ) {
|
1902 |
-
$link_class =
|
1903 |
-
$link_start = $readmore_link_start = sprintf(
|
1904 |
-
|
1905 |
-
|
1906 |
-
|
1907 |
-
$
|
1908 |
-
|
|
|
|
|
1909 |
} else {
|
1910 |
-
$link_class =
|
1911 |
-
$readmore_link_start = sprintf(
|
1912 |
-
|
1913 |
-
|
1914 |
-
|
1915 |
-
$
|
1916 |
-
|
|
|
|
|
1917 |
}
|
1918 |
|
1919 |
return [
|
@@ -1930,7 +2123,13 @@ class Fns {
|
|
1930 |
* @return string[]|\WP_Post_Type[]
|
1931 |
*/
|
1932 |
public static function get_post_types() {
|
1933 |
-
$post_types = get_post_types(
|
|
|
|
|
|
|
|
|
|
|
|
|
1934 |
$post_types = wp_list_pluck( $post_types, 'label', 'name' );
|
1935 |
|
1936 |
$exclude = [ 'attachment', 'revision', 'nav_menu_item', 'elementor_library', 'tpg_builder' ];
|
@@ -1942,7 +2141,7 @@ class Fns {
|
|
1942 |
if ( ! rtTPG()->hasPro() ) {
|
1943 |
$post_types = [
|
1944 |
'post' => $post_types['post'],
|
1945 |
-
'page' => $post_types['page']
|
1946 |
];
|
1947 |
}
|
1948 |
|
@@ -1959,16 +2158,17 @@ class Fns {
|
|
1959 |
*/
|
1960 |
public static function get_post_meta_html( $post_id, $data ) {
|
1961 |
global $post;
|
|
|
1962 |
$author_id = $post->post_author;
|
1963 |
$author_name = get_the_author_meta( 'display_name', $post->post_author );
|
1964 |
$author = apply_filters( 'rttpg_author_link', sprintf( '<a href="%s">%s</a>', get_author_posts_url( $author_id ), $author_name ) );
|
1965 |
|
1966 |
$comments_number = get_comments_number( $post_id );
|
|
|
1967 |
|
1968 |
-
|
1969 |
-
$comment_label = '';
|
1970 |
if ( isset( $data['show_comment_count_label'] ) && $data['show_comment_count_label'] ) {
|
1971 |
$comment_label = $data['comment_count_label_singular'];
|
|
|
1972 |
if ( $comments_number > 1 ) {
|
1973 |
$comment_label = $data['comment_count_label_plural'];
|
1974 |
}
|
@@ -1977,19 +2177,18 @@ class Fns {
|
|
1977 |
$comments_text = sprintf( '%s (%s)', esc_html( $comment_label ), number_format_i18n( $comments_number ) );
|
1978 |
$date = get_the_date();
|
1979 |
|
1980 |
-
//Category and Tags Management
|
1981 |
$_cat_id = isset( $data['post_type'] ) ? $data['post_type'] . '_taxonomy' : 'category';
|
1982 |
$_tag_id = isset( $data['post_type'] ) ? $data['post_type'] . '_tags' : 'post_tag';
|
1983 |
$categories = get_the_term_list( $post_id, $data[ $_cat_id ], null, '<span class="rt-separator">,</span>' );
|
1984 |
$tags = get_the_term_list( $post_id, $data[ $_tag_id ], null, '<span class="rt-separator">,</span>' );
|
1985 |
|
1986 |
-
$count_key =
|
1987 |
$get_view_count = get_post_meta( $post_id, $count_key, true );
|
1988 |
|
1989 |
-
$meta_separator = ( $data['meta_separator'] && $data['meta_separator']
|
1990 |
-
|
1991 |
-
//Author Meta
|
1992 |
|
|
|
1993 |
|
1994 |
$post_meta_html = [];
|
1995 |
|
@@ -2001,158 +2200,160 @@ class Fns {
|
|
2001 |
$is_author_avatar = 'has-author-avatar';
|
2002 |
}
|
2003 |
?>
|
2004 |
-
|
2005 |
-
|
2006 |
-
|
2007 |
-
|
2008 |
-
|
2009 |
-
|
2010 |
-
|
2011 |
-
|
2012 |
-
|
2013 |
-
|
2014 |
-
|
2015 |
-
|
2016 |
-
|
2017 |
-
|
2018 |
-
|
2019 |
-
|
2020 |
-
|
2021 |
-
|
2022 |
-
|
2023 |
-
|
2024 |
-
|
2025 |
-
<?php
|
|
|
2026 |
}
|
2027 |
|
2028 |
$post_meta_html['author'] = ob_get_clean();
|
2029 |
|
2030 |
ob_start();
|
2031 |
-
//Category Meta
|
|
|
|
|
2032 |
|
2033 |
-
$category_condition = ( $categories && 'show' == $data['show_category'] && self::el_ignore_layout( $data )
|
2034 |
-
&& in_array( $data['category_position'],
|
2035 |
-
[ 'default', 'with_meta' ] ) );
|
2036 |
if ( ! rtTPG()->hasPro() ) {
|
2037 |
$category_condition = ( $categories && 'show' == $data['show_category'] );
|
2038 |
}
|
2039 |
|
2040 |
-
if ( $category_condition ) {
|
2041 |
-
|
2042 |
-
|
2043 |
-
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
|
2048 |
-
|
2049 |
-
|
2050 |
-
|
2051 |
-
|
|
|
2052 |
</span>
|
2053 |
<?php
|
2054 |
-
echo $meta_separator;
|
2055 |
}
|
2056 |
$post_meta_html['category'] = ob_get_clean();
|
2057 |
|
2058 |
ob_start();
|
2059 |
-
//Date Meta
|
2060 |
if ( '' !== $data['show_date'] ) {
|
2061 |
$archive_year = get_the_date( 'Y' );
|
2062 |
$archive_month = get_the_date( 'm' );
|
2063 |
$archive_day = get_the_date( 'j' );
|
2064 |
|
2065 |
?>
|
2066 |
-
|
2067 |
-
|
2068 |
-
|
2069 |
-
|
2070 |
-
|
2071 |
-
|
2072 |
-
|
2073 |
-
|
2074 |
-
|
2075 |
-
|
2076 |
-
|
2077 |
-
|
2078 |
-
|
2079 |
-
|
2080 |
-
|
2081 |
<?php
|
2082 |
-
echo $meta_separator;
|
2083 |
}
|
2084 |
-
$post_meta_html['date'] = ob_get_clean();
|
2085 |
|
|
|
2086 |
|
2087 |
ob_start();
|
2088 |
-
//Tags Meta
|
2089 |
if ( $tags && 'show' == $data['show_tags'] ) {
|
2090 |
?>
|
2091 |
-
|
2092 |
-
|
2093 |
-
|
2094 |
-
|
2095 |
-
|
2096 |
-
|
2097 |
-
|
2098 |
-
|
2099 |
-
|
2100 |
-
|
2101 |
-
|
2102 |
-
|
2103 |
<?php
|
2104 |
-
echo $meta_separator;
|
2105 |
}
|
2106 |
$post_meta_html['tags'] = ob_get_clean();
|
2107 |
|
2108 |
ob_start();
|
2109 |
-
//Comment Meta
|
2110 |
if ( 'show' == $data['show_comment_count'] ) {
|
2111 |
?>
|
2112 |
-
|
2113 |
-
|
2114 |
-
|
2115 |
-
|
2116 |
-
|
2117 |
-
|
2118 |
-
|
2119 |
-
|
2120 |
-
|
2121 |
-
|
2122 |
-
|
2123 |
-
|
2124 |
<?php
|
2125 |
-
echo $meta_separator;
|
2126 |
}
|
2127 |
|
2128 |
$post_meta_html['comment_count'] = ob_get_clean();
|
2129 |
|
2130 |
ob_start();
|
2131 |
-
//
|
2132 |
if ( rtTPG()->hasPro() && 'show' == $data['show_post_count'] && ! empty( $get_view_count ) ) {
|
2133 |
?>
|
2134 |
-
|
2135 |
-
|
2136 |
-
|
2137 |
-
|
2138 |
-
|
2139 |
-
|
2140 |
-
|
2141 |
-
|
2142 |
-
|
2143 |
-
|
2144 |
-
|
2145 |
-
|
2146 |
<?php
|
2147 |
-
echo $meta_separator;
|
2148 |
}
|
2149 |
|
2150 |
$post_meta_html['post_count'] = ob_get_clean();
|
2151 |
|
2152 |
$meta_orering = isset( $data['meta_ordering'] ) && is_array( $data['meta_ordering'] ) ? $data['meta_ordering'] : [];
|
|
|
2153 |
foreach ( $meta_orering as $val ) {
|
2154 |
if ( isset( $post_meta_html[ $val['meta_name'] ] ) ) {
|
2155 |
-
echo $post_meta_html[ $val['meta_name'] ];
|
2156 |
}
|
2157 |
}
|
2158 |
}
|
@@ -2194,13 +2395,15 @@ class Fns {
|
|
2194 |
|
2195 |
public static function get_el_post_title( $title_tag, $title, $link_start, $link_end, $data ) {
|
2196 |
echo '<div class="entry-title-wrapper">';
|
|
|
2197 |
if ( rtTPG()->hasPro() && 'above_title' === $data['category_position'] || ! self::el_ignore_layout( $data ) ) {
|
2198 |
self::get_el_thumb_cat( $data, 'cat-above-title' );
|
2199 |
}
|
|
|
2200 |
printf( '<%s class="entry-title">', esc_attr( $title_tag ) );
|
2201 |
-
|
2202 |
-
|
2203 |
-
|
2204 |
printf( '</%s>', esc_attr( $title_tag ) );
|
2205 |
echo '</div>';
|
2206 |
}
|
@@ -2209,20 +2412,22 @@ class Fns {
|
|
2209 |
if ( ! ( 'show' == $data['show_meta'] && 'show' == $data['show_category'] ) ) {
|
2210 |
return;
|
2211 |
}
|
|
|
2212 |
$pID = get_the_ID();
|
2213 |
$_cat_id = $data['post_type'] . '_taxonomy';
|
2214 |
$categories = get_the_term_list( $pID, $data[ $_cat_id ], null, '<span class="rt-separator">,</span>' );
|
2215 |
$category_position = $data['category_position'];
|
|
|
2216 |
if ( in_array( $data['layout'], [ 'grid-layout4' ] ) && 'default' === $data['category_position'] ) {
|
2217 |
$category_position = 'top_left';
|
2218 |
}
|
2219 |
?>
|
2220 |
-
|
2221 |
-
|
2222 |
-
|
2223 |
-
|
2224 |
-
|
2225 |
-
|
2226 |
<?php
|
2227 |
}
|
2228 |
|
@@ -2231,14 +2436,16 @@ class Fns {
|
|
2231 |
* Get first image from the content
|
2232 |
*
|
2233 |
* @param $post_id
|
2234 |
-
* @param string
|
2235 |
*
|
2236 |
* @return mixed|string
|
2237 |
*/
|
2238 |
public static function get_content_first_image( $post_id, $type = 'markup', $imgClass = '' ) {
|
2239 |
-
if ( $img = preg_match_all(
|
|
|
2240 |
get_the_content( $post_id ),
|
2241 |
-
$matches
|
|
|
2242 |
) {
|
2243 |
$imgSrc = $matches[1][0];
|
2244 |
$size = '';
|
@@ -2249,11 +2456,14 @@ class Fns {
|
|
2249 |
$info = getimagesize( $imgAbs );
|
2250 |
$size = isset( $info[3] ) ? $info[3] : '';
|
2251 |
}
|
|
|
2252 |
$attachment_id = attachment_url_to_postid( $imgSrc );
|
2253 |
$alt_text = null;
|
|
|
2254 |
if ( ! empty( $attachment_id ) ) {
|
2255 |
$alt_text = trim( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) );
|
2256 |
}
|
|
|
2257 |
$alt = $alt_text ? $alt_text : get_the_title( $post_id );
|
2258 |
|
2259 |
if ( $type == 'markup' ) {
|
@@ -2275,39 +2485,46 @@ class Fns {
|
|
2275 |
* @param $data
|
2276 |
* @param $link_start
|
2277 |
* @param $link_end
|
2278 |
-
* @param false
|
2279 |
*/
|
2280 |
public static function get_post_thumbnail( $pID, $data, $link_start, $link_end, $offset_size = false ) {
|
2281 |
$thumb_cat_condition = ( ! ( 'above_title' === $data['category_position'] || 'default' === $data['category_position'] ) );
|
|
|
2282 |
if ( 'grid-layout4' === $data['layout'] && 'default' === $data['category_position'] ) {
|
2283 |
$thumb_cat_condition = true;
|
2284 |
-
} elseif ( in_array(
|
|
|
|
|
2285 |
'grid-layout4',
|
2286 |
-
'grid_hover-layout11'
|
2287 |
-
]
|
|
|
2288 |
$thumb_cat_condition = true;
|
2289 |
}
|
2290 |
|
2291 |
if ( rtTPG()->hasPro() && $data['show_category'] == 'show' && $thumb_cat_condition && 'with_meta' !== $data['category_position'] ) {
|
2292 |
self::get_el_thumb_cat( $data );
|
2293 |
}
|
2294 |
-
$img_link = get_the_post_thumbnail_url( $pID, 'full' );
|
2295 |
|
|
|
2296 |
$img_size_key = 'image';
|
2297 |
|
2298 |
-
|
2299 |
if ( $offset_size ) {
|
2300 |
$img_size_key = 'image_offset';
|
2301 |
}
|
|
|
2302 |
$lazy_load = ( $data['prefix'] == 'slider' && $data['lazy_load'] == 'yes' ) ? true : false;
|
2303 |
$lazy_class = 'rt-img-responsive';
|
|
|
2304 |
if ( $lazy_load ) {
|
2305 |
$lazy_class = 'swiper-lazy';
|
2306 |
}
|
2307 |
|
2308 |
-
echo $data['is_thumb_linked']
|
|
|
2309 |
if ( has_post_thumbnail() && 'feature_image' === $data['media_source'] ) {
|
2310 |
$fImgSize = $data['image_size'];
|
|
|
2311 |
if ( $offset_size ) {
|
2312 |
echo get_the_post_thumbnail( $pID, $data['image_offset'] );
|
2313 |
} else {
|
@@ -2315,20 +2532,22 @@ class Fns {
|
|
2315 |
$attachment_id = get_post_thumbnail_id( $pID );
|
2316 |
$thumb_info = wp_get_attachment_image_src( $attachment_id, $fImgSize );
|
2317 |
$thumb_alt = trim( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) );
|
2318 |
-
if ( $lazy_load ) {
|
2319 |
-
|
2320 |
-
|
2321 |
-
|
2322 |
-
|
2323 |
-
|
2324 |
-
|
|
|
2325 |
<?php
|
2326 |
-
} else {
|
2327 |
-
|
2328 |
-
|
2329 |
-
|
2330 |
-
|
2331 |
-
|
|
|
2332 |
<?php
|
2333 |
}
|
2334 |
?>
|
@@ -2340,10 +2559,10 @@ class Fns {
|
|
2340 |
$defaultImgId = null;
|
2341 |
$customImgSize = [];
|
2342 |
|
2343 |
-
|
2344 |
if ( isset( $data['image_custom_dimension'] ) ) {
|
2345 |
$post_thumb_id = get_post_thumbnail_id( $pID );
|
2346 |
$default_image_dimension = wp_get_attachment_image_src( $post_thumb_id, 'full' );
|
|
|
2347 |
if ( $default_image_dimension[1] <= $data['image_custom_dimension']['width'] || $default_image_dimension[2] <= $data['image_custom_dimension']['height'] ) {
|
2348 |
$customImgSize = [];
|
2349 |
} else {
|
@@ -2352,14 +2571,16 @@ class Fns {
|
|
2352 |
$customImgSize[2] = $data['img_crop_style'];
|
2353 |
}
|
2354 |
}
|
2355 |
-
|
|
|
2356 |
}
|
2357 |
}
|
2358 |
} elseif ( 'first_image' === $data['media_source'] && self::get_content_first_image( $pID ) ) {
|
2359 |
-
echo self::get_content_first_image( $pID, 'markup', $lazy_class );
|
2360 |
$img_link = self::get_content_first_image( $pID, 'url' );
|
2361 |
} elseif ( 'yes' === $data['is_default_img'] || 'grid_hover' == $data['prefix'] ) {
|
2362 |
echo \Elementor\Group_Control_Image_Size::get_attachment_image_html( $data, $img_size_key, 'default_image' );
|
|
|
2363 |
if ( ! empty( $data['default_image'] ) && isset( $data['default_image']['url'] ) ) {
|
2364 |
$img_link = $data['default_image']['url'];
|
2365 |
}
|
@@ -2367,28 +2588,30 @@ class Fns {
|
|
2367 |
|
2368 |
?>
|
2369 |
<?php if ( $lazy_load ) : ?>
|
2370 |
-
|
2371 |
<?php endif; ?>
|
2372 |
|
2373 |
-
<?php echo $data['is_thumb_linked']
|
2374 |
|
2375 |
-
<?php
|
|
|
2376 |
?>
|
2377 |
-
|
2378 |
-
|
2379 |
-
|
2380 |
-
|
2381 |
-
|
2382 |
-
|
2383 |
-
|
2384 |
-
|
2385 |
-
|
2386 |
-
|
2387 |
-
|
2388 |
-
|
2389 |
-
|
|
|
2390 |
<?php endif; ?>
|
2391 |
-
|
2392 |
<?php
|
2393 |
}
|
2394 |
|
@@ -2402,7 +2625,7 @@ class Fns {
|
|
2402 |
* @return bool
|
2403 |
*/
|
2404 |
public static function tpg_get_acf_data_elementor( $data, $pID, $return_type = true ) {
|
2405 |
-
if ( ! ( rtTPG()->hasPro() &&
|
2406 |
return;
|
2407 |
}
|
2408 |
|
@@ -2416,11 +2639,12 @@ class Fns {
|
|
2416 |
];
|
2417 |
|
2418 |
if ( ! empty( $cf_group ) ) {
|
2419 |
-
$acf_html
|
2420 |
$acf_html .= Functions::get_cf_formatted_fields( $cf_group, $format, $pID );
|
2421 |
-
$acf_html .=
|
|
|
2422 |
if ( $return_type ) {
|
2423 |
-
|
2424 |
} else {
|
2425 |
return $acf_html;
|
2426 |
}
|
@@ -2438,12 +2662,12 @@ class Fns {
|
|
2438 |
*/
|
2439 |
public static function is_filter_enable( $data ) {
|
2440 |
if ( rtTPG()->hasPro()
|
2441 |
-
|
2442 |
-
|
2443 |
-
|
2444 |
-
|
2445 |
-
|
2446 |
-
|
2447 |
) {
|
2448 |
return true;
|
2449 |
}
|
@@ -2451,4 +2675,186 @@ class Fns {
|
|
2451 |
return false;
|
2452 |
}
|
2453 |
|
2454 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Helper class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Helpers;
|
9 |
|
11 |
use RT\ThePostGrid\Models\ReSizer;
|
12 |
use RT\ThePostGridPro\Helpers\Functions;
|
13 |
|
14 |
+
// Do not allow directly accessing this file.
|
15 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
16 |
+
exit( 'This script cannot be accessed directly.' );
|
17 |
+
}
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Helper class.
|
21 |
+
*/
|
22 |
class Fns {
|
23 |
|
24 |
/**
|
32 |
|
33 |
|
34 |
/**
|
35 |
+
* Render view
|
|
|
|
|
36 |
*
|
37 |
+
* @param string $viewName View name.
|
38 |
+
* @param array $args Args.
|
39 |
+
* @param boolean $return Include/return.
|
40 |
+
* @return string
|
41 |
*/
|
42 |
public static function view( $viewName, $args = [], $return = false ) {
|
43 |
+
$file = str_replace( '.', '/', $viewName );
|
44 |
$file = ltrim( $file, '/' );
|
45 |
$viewFile = trailingslashit( RT_THE_POST_GRID_PLUGIN_PATH . '/resources' ) . $file . '.php';
|
46 |
+
|
47 |
if ( ! file_exists( $viewFile ) ) {
|
48 |
+
return new \WP_Error(
|
49 |
+
'brock',
|
50 |
+
sprintf(
|
51 |
+
/* translators: %s File name */
|
52 |
+
esc_html__( '%s file not found', 'the-post-grid' ),
|
53 |
+
$viewFile
|
54 |
+
)
|
55 |
+
);
|
56 |
}
|
57 |
+
|
58 |
if ( $args ) {
|
59 |
+
extract( $args ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
60 |
}
|
61 |
+
|
62 |
if ( $return ) {
|
63 |
ob_start();
|
64 |
include $viewFile;
|
65 |
|
66 |
return ob_get_clean();
|
67 |
}
|
68 |
+
|
69 |
include $viewFile;
|
70 |
}
|
71 |
|
72 |
/**
|
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 ) {
|
79 |
if ( ! $post_id && is_admin() ) {
|
80 |
return;
|
81 |
}
|
82 |
|
83 |
+
$user_ip = sanitize_text_field( wp_unslash( $_SERVER['REMOTE_ADDR'] ) ); // retrieve the current IP address of the visitor.
|
84 |
$key = 'tpg_cache_' . $user_ip . '_' . $post_id;
|
85 |
$value = [ $user_ip, $post_id ];
|
86 |
$visited = get_transient( $key );
|
87 |
+
|
88 |
if ( false === ( $visited ) ) {
|
89 |
+
set_transient( $key, $value, HOUR_IN_SECONDS * 12 ); // store the unique key, Post ID & IP address for 12 hours if it does not exist.
|
90 |
|
91 |
+
// now run post views function.
|
92 |
$count_key = self::get_post_view_count_meta_key();
|
93 |
$count = get_post_meta( $post_id, $count_key, true );
|
94 |
+
|
95 |
if ( '' == $count ) {
|
96 |
update_post_meta( $post_id, $count_key, 1 );
|
97 |
} else {
|
98 |
$count = absint( $count );
|
99 |
$count ++;
|
100 |
+
|
101 |
update_post_meta( $post_id, $count_key, $count );
|
102 |
}
|
103 |
}
|
107 |
* Template Content
|
108 |
*
|
109 |
* @param string $template_name Template name.
|
110 |
+
* @param array $args Arguments. (default: array).
|
111 |
* @param string $template_path Template path. (default: '').
|
112 |
* @param string $default_path Default path. (default: '').
|
113 |
*/
|
114 |
+
public static function get_template( $template_name, $args = null, $template_path = '', $default_path = '' ) {
|
115 |
if ( ! empty( $args ) && is_array( $args ) ) {
|
116 |
+
extract( $args ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract
|
117 |
}
|
118 |
|
119 |
$located = self::locate_template( $template_name, $template_path, $default_path );
|
120 |
|
|
|
121 |
if ( ! file_exists( $located ) ) {
|
122 |
/* translators: %s template */
|
123 |
+
self::doing_it_wrong( __FUNCTION__, sprintf( esc_html__( '%s does not exist.', 'the-post-grid' ), '<code>' . $located . '</code>' ), '1.0' );
|
124 |
|
125 |
return;
|
126 |
}
|
139 |
* Get template content and return
|
140 |
*
|
141 |
* @param string $template_name Template name.
|
142 |
+
* @param array $args Arguments. (default: array).
|
143 |
* @param string $template_path Template path. (default: '').
|
144 |
* @param string $default_path Default path. (default: '').
|
145 |
*
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
+
* Locate template.
|
|
|
|
|
157 |
*
|
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 = '' ) {
|
164 |
+
$template_name = $template_name . '.php';
|
165 |
+
|
166 |
if ( ! $template_path ) {
|
167 |
$template_path = rtTPG()->get_template_path();
|
168 |
}
|
170 |
if ( ! $default_path ) {
|
171 |
$default_path = rtTPG()->default_template_path() . '/templates/';
|
172 |
}
|
173 |
+
|
174 |
// Look within passed path within the theme - this is priority.
|
175 |
$template_files = [];
|
176 |
$template_files[] = trailingslashit( $template_path ) . $template_name;
|
185 |
return apply_filters( 'rttpg_locate_template', $template, $template_name );
|
186 |
}
|
187 |
|
188 |
+
/**
|
189 |
+
* Mark something as being incorrectly called.
|
190 |
+
*
|
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 ) {
|
197 |
+
// phpcs:disable
|
198 |
$message .= ' Backtrace: ' . wp_debug_backtrace_summary();
|
199 |
_doing_it_wrong( $function, $message, $version );
|
200 |
+
// phpcs:enable
|
201 |
}
|
202 |
|
203 |
+
/**
|
204 |
+
* Verify nonce.
|
205 |
+
*
|
206 |
+
* @return bool
|
207 |
+
*/
|
208 |
public static function verifyNonce() {
|
209 |
+
$nonce = isset( $_REQUEST[ rtTPG()->nonceId() ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ rtTPG()->nonceId() ] ) ) : null;
|
210 |
$nonceText = rtTPG()->nonceText();
|
211 |
+
|
212 |
if ( ! wp_verify_nonce( $nonce, $nonceText ) ) {
|
213 |
return false;
|
214 |
}
|
216 |
return true;
|
217 |
}
|
218 |
|
219 |
+
/**
|
220 |
+
* All settings.
|
221 |
+
*
|
222 |
+
* @return array
|
223 |
+
*/
|
|
|
|
|
|
|
224 |
public static function rtAllOptionFields() {
|
225 |
$fields = array_merge(
|
226 |
Options::rtTPGCommonFilterFields(),
|
228 |
Options::responsiveSettingsColumn(),
|
229 |
Options::layoutMiscSettings(),
|
230 |
Options::stickySettings(),
|
231 |
+
// settings.
|
232 |
Options::rtTPGSCHeadingSettings(),
|
233 |
Options::rtTPGSCCategorySettings(),
|
234 |
Options::rtTPGSCTitleSettings(),
|
236 |
Options::rtTPGSCImageSettings(),
|
237 |
Options::rtTPGSCExcerptSettings(),
|
238 |
Options::rtTPGSCButtonSettings(),
|
239 |
+
// style.
|
240 |
Options::rtTPGStyleFields(),
|
241 |
Options::rtTPGStyleHeading(),
|
242 |
Options::rtTPGStyleFullArea(),
|
253 |
|
254 |
public static function rt_get_all_term_by_taxonomy( $taxonomy = null, $count = false, $parent = false ) {
|
255 |
$terms = [];
|
256 |
+
|
257 |
if ( $taxonomy ) {
|
258 |
+
$temp_terms = get_terms(
|
259 |
+
[
|
260 |
+
'taxonomy' => $taxonomy,
|
261 |
+
'hide_empty' => 0,
|
262 |
+
]
|
263 |
+
);
|
264 |
+
|
265 |
if ( is_array( $temp_terms ) && ! empty( $temp_terms ) && empty( $temp_terms['errors'] ) ) {
|
266 |
foreach ( $temp_terms as $term ) {
|
267 |
$order = get_term_meta( $term->term_id, '_rt_order', true );
|
268 |
+
if ( $order === '' ) {
|
269 |
update_term_meta( $term->term_id, '_rt_order', 0 );
|
270 |
}
|
271 |
}
|
272 |
+
|
273 |
global $wp_version;
|
274 |
+
|
275 |
$args = [
|
276 |
'taxonomy' => $taxonomy,
|
277 |
'orderby' => 'meta_value_num',
|
278 |
'meta_key' => '_rt_order',
|
279 |
'hide_empty' => false,
|
280 |
];
|
281 |
+
|
282 |
if ( $parent >= 0 && $parent !== false ) {
|
283 |
$args['parent'] = absint( $parent );
|
284 |
}
|
285 |
+
|
286 |
$args['orderby'] = 'meta_value_num';
|
287 |
$args['meta_key'] = '_rt_order';
|
288 |
|
290 |
|
291 |
foreach ( $termObjs as $term ) {
|
292 |
if ( $count ) {
|
293 |
+
$terms[ $term->term_id ] = [
|
294 |
+
'name' => $term->name,
|
295 |
+
'count' => $term->count,
|
296 |
+
];
|
297 |
} else {
|
298 |
$terms[ $term->term_id ] = $term->name;
|
299 |
}
|
306 |
|
307 |
public static function rt_get_selected_term_by_taxonomy( $taxonomy = null, $include = [], $count = false, $parent = false ) {
|
308 |
$terms = [];
|
309 |
+
|
310 |
if ( $taxonomy ) {
|
311 |
+
$temp_terms = get_terms(
|
312 |
+
[
|
313 |
+
'taxonomy' => $taxonomy,
|
314 |
+
'hide_empty' => 0,
|
315 |
+
]
|
316 |
+
);
|
317 |
+
|
318 |
if ( is_array( $temp_terms ) && ! empty( $temp_terms ) && empty( $temp_terms['errors'] ) ) {
|
319 |
foreach ( $temp_terms as $term ) {
|
320 |
$order = get_term_meta( $term->term_id, '_rt_order', true );
|
321 |
+
if ( $order === '' ) {
|
322 |
update_term_meta( $term->term_id, '_rt_order', 0 );
|
323 |
}
|
324 |
}
|
325 |
+
|
326 |
global $wp_version;
|
327 |
+
|
328 |
$args = [
|
329 |
'taxonomy' => $taxonomy,
|
330 |
'orderby' => 'meta_value_num',
|
332 |
'include' => $include,
|
333 |
'hide_empty' => false,
|
334 |
];
|
335 |
+
|
336 |
if ( $parent >= 0 && $parent !== false ) {
|
337 |
$args['parent'] = absint( $parent );
|
338 |
}
|
339 |
+
|
340 |
$args['orderby'] = 'meta_value_num';
|
341 |
$args['meta_key'] = '_rt_order';
|
342 |
|
344 |
|
345 |
foreach ( $termObjs as $term ) {
|
346 |
if ( $count ) {
|
347 |
+
$terms[ $term->term_id ] = [
|
348 |
+
'name' => $term->name,
|
349 |
+
'count' => $term->count,
|
350 |
+
];
|
351 |
} else {
|
352 |
$terms[ $term->term_id ] = $term->name;
|
353 |
}
|
368 |
if ( ! $post_type ) {
|
369 |
$post_type = get_post_meta( get_the_ID(), 'tpg_post_type', true );
|
370 |
}
|
371 |
+
|
372 |
if ( ! $post_type ) {
|
373 |
$post_type = 'post';
|
374 |
}
|
378 |
|
379 |
public static function rt_get_all_taxonomy_by_post_type( $post_type = null ) {
|
380 |
$taxonomies = [];
|
381 |
+
|
382 |
if ( $post_type && post_type_exists( $post_type ) ) {
|
383 |
$taxObj = get_object_taxonomies( $post_type, 'objects' );
|
384 |
+
|
385 |
if ( is_array( $taxObj ) && ! empty( $taxObj ) ) {
|
386 |
foreach ( $taxObj as $tKey => $taxonomy ) {
|
387 |
$taxonomies[ $tKey ] = $taxonomy->label;
|
388 |
}
|
389 |
}
|
390 |
}
|
391 |
+
|
392 |
if ( $post_type == 'post' ) {
|
393 |
unset( $taxonomies['post_format'] );
|
394 |
}
|
399 |
public static function rt_get_users() {
|
400 |
$users = [];
|
401 |
$u = get_users( apply_filters( 'tpg_author_arg', [] ) );
|
402 |
+
|
403 |
if ( ! empty( $u ) ) {
|
404 |
foreach ( $u as $user ) {
|
405 |
$users[ $user->ID ] = $user->display_name;
|
411 |
|
412 |
public static function rtFieldGenerator( $fields = [] ) {
|
413 |
$html = null;
|
414 |
+
|
415 |
if ( is_array( $fields ) && ! empty( $fields ) ) {
|
416 |
$tpgField = new Field();
|
417 |
foreach ( $fields as $fieldKey => $field ) {
|
426 |
* Sanitize field value
|
427 |
*
|
428 |
* @param array $field
|
429 |
+
* @param null $value
|
430 |
*
|
431 |
* @return array|null
|
432 |
* @internal param $value
|
433 |
*/
|
434 |
public static function sanitize( $field = [], $value = null ) {
|
435 |
$newValue = null;
|
436 |
+
|
437 |
if ( is_array( $field ) ) {
|
438 |
$type = ( ! empty( $field['type'] ) ? $field['type'] : 'text' );
|
439 |
+
|
440 |
if ( empty( $field['multiple'] ) ) {
|
441 |
if ( $type == 'text' || $type == 'number' || $type == 'select' || $type == 'checkbox' || $type == 'radio' ) {
|
442 |
$newValue = sanitize_text_field( $value );
|
452 |
$newValue = self::sanitize_hex_color( $value );
|
453 |
} elseif ( $type == 'image_size' ) {
|
454 |
$newValue = [];
|
455 |
+
|
456 |
foreach ( $value as $k => $v ) {
|
457 |
$newValue[ $k ] = esc_attr( $v );
|
458 |
}
|
459 |
} elseif ( $type == 'style' ) {
|
460 |
$newValue = [];
|
461 |
+
|
462 |
foreach ( $value as $k => $v ) {
|
463 |
if ( $k == 'color' ) {
|
464 |
$newValue[ $k ] = self::sanitize_hex_color( $v );
|
471 |
}
|
472 |
} else {
|
473 |
$newValue = [];
|
474 |
+
|
475 |
if ( ! empty( $value ) ) {
|
476 |
if ( is_array( $value ) ) {
|
477 |
foreach ( $value as $key => $val ) {
|
512 |
|
513 |
public static function rtFieldGeneratorBackup( $fields = [], $multi = false ) {
|
514 |
$html = null;
|
515 |
+
|
516 |
if ( is_array( $fields ) && ! empty( $fields ) ) {
|
517 |
$rtField = new Field();
|
518 |
+
|
519 |
if ( $multi ) {
|
520 |
foreach ( $fields as $field ) {
|
521 |
$html .= $rtField->Field( $field );
|
530 |
|
531 |
public static function rtSmartStyle( $fields = [] ) {
|
532 |
$h = null;
|
533 |
+
|
534 |
if ( ! empty( $fields ) ) {
|
535 |
foreach ( $fields as $key => $label ) {
|
536 |
$atts = '';
|
537 |
$proText = '';
|
538 |
$class = '';
|
539 |
|
540 |
+
$h .= '<div class="field-holder ' . esc_attr( $class ) . '">';
|
541 |
|
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 .= "<div class='field-inner col-4'>";
|
546 |
+
$h .= "<div class='field-inner-container size'>";
|
547 |
+
$h .= "<span class='label'>Color</span>";
|
548 |
+
$cValue = get_post_meta( get_the_ID(), $key . '_color', true );
|
549 |
+
$h .= '<input type="text" value="' . esc_attr( $cValue ) . '" class="rt-color" name="' . esc_attr( $key ) . '_color">';
|
550 |
+
$h .= '</div>';
|
551 |
+
$h .= '</div>';
|
552 |
+
|
553 |
+
// Font size.
|
554 |
+
$h .= "<div class='field-inner col-4'>";
|
555 |
+
$h .= "<div class='field-inner-container size'>";
|
556 |
+
$h .= "<span class='label'>Font size</span>";
|
557 |
+
$h .= '<select ' . self::htmlKses( $atts, 'basic' ) . ' name="' . esc_attr( $key ) . '_size" class="rt-select2">';
|
558 |
$fSizes = Options::scFontSize();
|
559 |
+
$sValue = get_post_meta( get_the_ID(), $key . '_size', true );
|
560 |
+
$h .= "<option value=''>Default</option>";
|
561 |
+
|
562 |
foreach ( $fSizes as $size => $sizeLabel ) {
|
563 |
+
$sSlt = ( $size == $sValue ? 'selected' : null );
|
564 |
+
$h .= '<option value="' . esc_attr( $size ) . '" ' . esc_attr( $sSlt ) . '>' . esc_html( $sizeLabel ) . '</option>';
|
565 |
}
|
|
|
|
|
|
|
566 |
|
567 |
+
$h .= '</select>';
|
568 |
+
$h .= '</div>';
|
569 |
+
$h .= '</div>';
|
570 |
|
571 |
+
// Weight.
|
572 |
+
$h .= "<div class='field-inner col-4'>";
|
573 |
+
$h .= "<div class='field-inner-container weight'>";
|
574 |
+
$h .= "<span class='label'>Weight</span>";
|
575 |
+
$h .= '<select ' . self::htmlKses( $atts, 'basic' ) . ' name="' . esc_attr( $key ) . '_weight" class="rt-select2">';
|
576 |
+
$h .= "<option value=''>Default</option>";
|
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 .= '<option value="' . esc_attr( $weight ) . '" ' . esc_attr( $wSlt ) . '>' . esc_html( $weightLabel ) . '</option>';
|
583 |
}
|
|
|
|
|
|
|
584 |
|
585 |
+
$h .= '</select>';
|
586 |
+
$h .= '</div>';
|
587 |
+
$h .= '</div>';
|
588 |
|
589 |
+
// Alignment.
|
590 |
+
$h .= "<div class='field-inner col-4'>";
|
591 |
+
$h .= "<div class='field-inner-container alignment'>";
|
592 |
+
$h .= "<span class='label'>Alignment</span>";
|
593 |
+
$h .= '<select ' . self::htmlKses( $atts, 'basic' ) . ' name="' . esc_attr( $key ) . '_alignment" class="rt-select2">';
|
594 |
+
$h .= "<option value=''>Default</option>";
|
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 .= '<option value="' . esc_attr( $align ) . '" ' . esc_attr( $aSlt ) . '>' . esc_html( $alignLabel ) . '</option>';
|
601 |
}
|
|
|
|
|
|
|
602 |
|
603 |
+
$h .= '</select>';
|
604 |
+
$h .= '</div>';
|
605 |
+
$h .= '</div>';
|
606 |
+
|
607 |
+
$h .= '</div>';
|
608 |
+
$h .= '</div>';
|
609 |
}
|
610 |
}
|
611 |
|
622 |
}
|
623 |
|
624 |
if ( $max && $max !== $min ) {
|
625 |
+
$price .= ' - ';
|
626 |
$price .= wc_price( $max );
|
627 |
}
|
628 |
|
631 |
|
632 |
public static function getTPGShortCodeList() {
|
633 |
$scList = null;
|
634 |
+
$scQ = get_posts(
|
635 |
+
[
|
636 |
+
'post_type' => rtTPG()->post_type,
|
637 |
+
'order_by' => 'title',
|
638 |
+
'order' => 'DESC',
|
639 |
+
'post_status' => 'publish',
|
640 |
+
'posts_per_page' => - 1,
|
641 |
+
'meta_query' => [
|
642 |
+
[
|
643 |
+
'key' => 'layout',
|
644 |
+
'value' => 'layout',
|
645 |
+
'compare' => 'LIKE',
|
646 |
+
],
|
647 |
],
|
648 |
+
]
|
649 |
+
);
|
650 |
+
|
651 |
if ( ! empty( $scQ ) ) {
|
652 |
foreach ( $scQ as $sc ) {
|
653 |
$scList[ $sc->ID ] = $sc->post_title;
|
659 |
|
660 |
public static function getAllTPGShortCodeList() {
|
661 |
$scList = null;
|
662 |
+
$scQ = get_posts(
|
663 |
+
[
|
664 |
+
'post_type' => rtTPG()->post_type,
|
665 |
+
'order_by' => 'title',
|
666 |
+
'order' => 'ASC',
|
667 |
+
'post_status' => 'publish',
|
668 |
+
'posts_per_page' => - 1,
|
669 |
+
]
|
670 |
+
);
|
671 |
if ( ! empty( $scQ ) ) {
|
672 |
foreach ( $scQ as $sc ) {
|
673 |
$scList[ $sc->ID ] = $sc->post_title;
|
678 |
}
|
679 |
|
680 |
public static function socialShare( $pLink ) {
|
681 |
+
$html = null;
|
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>
|
685 |
+
</div>
|
686 |
+
<div class='twitter-share'>
|
687 |
+
<a href='" . esc_url( $pLink ) . "' class='twitter-share-button'{count} data-url='https://about.twitter.com/resources/buttons#tweet'>Tweet</a>
|
688 |
+
</div>
|
689 |
+
<div class='googleplus-share'>
|
690 |
+
<div class='g-plusone'></div>
|
691 |
+
</div>
|
692 |
+
<div class='linkedin-share'>
|
693 |
+
<script type='IN/Share' data-counter='right'></script>
|
694 |
+
</div>
|
695 |
+
<div class='linkedin-share'>
|
696 |
+
<a data-pin-do='buttonPin' data-pin-count='beside' href='https://www.pinterest.com/pin/create/button/?url=https%3A%2F%2Fwww.flickr.com%2Fphotos%2Fkentbrew%2F6851755809%2F&media=https%3A%2F%2Ffarm8.staticflickr.com%2F7027%2F6851755809_df5b2051c9_z.jpg&description=Next%20stop%3A%20Pinterest'><img src='//assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png' /></a>
|
697 |
+
</div>
|
698 |
+
</div>";
|
699 |
$html .= '<div id="fb-root"></div>
|
700 |
+
<script>(function(d, s, id) {
|
701 |
+
var js, fjs = d.getElementsByTagName(s)[0];
|
702 |
+
if (d.getElementById(id)) return;
|
703 |
+
js = d.createElement(s); js.id = id;
|
704 |
+
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5";
|
705 |
+
fjs.parentNode.insertBefore(js, fjs);
|
706 |
+
}(document, "script", "facebook-jssdk"));</script>';
|
707 |
$html .= "<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
708 |
<script>window.___gcfg = { lang: 'en-US', parsetags: 'onload', };</script>";
|
709 |
$html .= "<script src='https://apis.google.com/js/platform.js' async defer></script>";
|
735 |
}
|
736 |
|
737 |
$imgSize = [];
|
738 |
+
|
739 |
if ( ! empty( $sizes ) ) {
|
740 |
+
$imgSize['full'] = esc_html__( 'Full Size', 'the-post-grid' );
|
741 |
foreach ( $sizes as $key => $img ) {
|
742 |
$imgSize[ $key ] = ucfirst( $key ) . " ({$img['width']}*{$img['height']})";
|
743 |
}
|
755 |
$img_Class = ''
|
756 |
) {
|
757 |
global $post;
|
758 |
+
|
759 |
$imgSrc = null;
|
760 |
+
$img_class = 'rt-img-responsive ';
|
761 |
+
|
762 |
if ( $img_Class ) {
|
763 |
$img_class .= $img_Class;
|
764 |
}
|
765 |
+
|
766 |
$post_id = ( $post_id ? absint( $post_id ) : $post->ID );
|
767 |
$alt = get_the_title( $post_id );
|
768 |
$image = null;
|
769 |
$cSize = false;
|
770 |
+
|
771 |
if ( $fImgSize == 'rt_custom' ) {
|
772 |
$fImgSize = 'full';
|
773 |
$cSize = true;
|
775 |
|
776 |
if ( $mediaSource == 'feature_image' ) {
|
777 |
if ( $aID = get_post_thumbnail_id( $post_id ) ) {
|
778 |
+
$image = wp_get_attachment_image(
|
779 |
+
$aID,
|
780 |
+
$fImgSize,
|
781 |
+
'',
|
782 |
+
[
|
783 |
+
'class' => $img_class,
|
784 |
+
'loading' => false,
|
785 |
+
]
|
786 |
+
);
|
787 |
$imgSrc = wp_get_attachment_image_src( $aID, $fImgSize );
|
788 |
+
|
789 |
if ( ! empty( $imgSrc ) && $img_Class == 'swiper-lazy' ) {
|
790 |
+
$image = '<img class="' . esc_attr( $img_class ) . '" data-src="' . esc_url( $imgSrc[0] ) . '" src="#none" width="' . absint( $imgSrc[1] ) . '" height="' . absint( $imgSrc[2] ) . '" alt="' . esc_attr( $alt ) . '"/><div class="lazy-overlay-wrap"><div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div></div>';
|
791 |
}
|
792 |
+
|
793 |
$imgSrc = ! empty( $imgSrc ) ? $imgSrc[0] : $imgSrc;
|
794 |
}
|
795 |
} elseif ( $mediaSource == 'first_image' ) {
|
796 |
+
if ( $img = preg_match_all(
|
797 |
+
'/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
|
798 |
get_the_content( $post_id ),
|
799 |
+
$matches
|
800 |
+
)
|
801 |
) {
|
802 |
$imgSrc = $matches[1][0];
|
803 |
$size = '';
|
815 |
$size = isset( $info[3] ) ? $info[3] : '';
|
816 |
}
|
817 |
|
818 |
+
$image = '<img class="' . esc_attr( $img_class ) . '" src="' . esc_url( $imgSrc ) . '" ' . $size . ' alt="' . esc_attr( $alt ) . '">';
|
819 |
+
|
820 |
if ( $img_Class == 'swiper-lazy' ) {
|
821 |
+
$image = '<img class="' . esc_attr( $img_class ) . ' img-responsive" data-src="' . esc_url( $imgSrc ) . '" src="#none" ' . $size . ' alt="' . esc_attr( $alt ) . '"/><div class="lazy-overlay-wrap"><div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div></div>';
|
822 |
}
|
823 |
}
|
824 |
}
|
834 |
|
835 |
if ( $w && $h ) {
|
836 |
$post_thumb_id = get_post_thumbnail_id( $post_id );
|
837 |
+
|
838 |
if ( $post_thumb_id ) {
|
839 |
$featured_image = wp_get_attachment_image_src( $post_thumb_id, 'full' );
|
840 |
$w = $featured_image[1] < $w ? $featured_image[1] : $w;
|
841 |
$h = $featured_image[2] < $h ? $featured_image[2] : $h;
|
842 |
}
|
843 |
+
|
844 |
+
$imgSrc = self::rtImageReSize( $imgSrc, $w, $h, $c );
|
845 |
+
|
846 |
if ( $img_Class !== 'swiper-lazy' ) {
|
847 |
+
$image = '<img class="' . esc_attr( $img_class ) . '" src="' . esc_url( $imgSrc ) . '" width="' . absint( $w ) . '" height="' . absint( $h ) . '" alt="' . esc_attr( $alt ) . '"/>';
|
848 |
} else {
|
849 |
+
$image = '<img class="' . esc_attr( $img_class ) . ' img-responsive" data-src="' . esc_url( $imgSrc ) . '" src="#none" width="' . absint( $w ) . '" height="' . absint( $h ) . '" alt="' . esc_attr( $alt ) . '"/><div class="lazy-overlay-wrap"><div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div></div>';
|
850 |
}
|
851 |
}
|
852 |
}
|
893 |
public static function get_the_excerpt( $post_id, $data = [] ) {
|
894 |
$type = $data['excerpt_type'];
|
895 |
$post = get_post( $post_id );
|
896 |
+
|
897 |
if ( empty( $post ) ) {
|
898 |
return '';
|
899 |
}
|
900 |
+
|
901 |
if ( $type == 'full' ) {
|
902 |
ob_start();
|
903 |
the_content();
|
910 |
} else {
|
911 |
$defaultExcerpt = get_the_excerpt( $post_id );
|
912 |
}
|
913 |
+
|
914 |
$limit = isset( $data['excerpt_limit'] ) && $data['excerpt_limit'] ? abs( $data['excerpt_limit'] ) : 0;
|
915 |
$more = $data['excerpt_more_text'];
|
916 |
$excerpt = preg_replace( '`\[[^\]]*\]`', '', $defaultExcerpt );
|
917 |
$excerpt = strip_shortcodes( $excerpt );
|
918 |
$excerpt = preg_replace( '`[[^]]*]`', '', $excerpt );
|
919 |
$excerpt = str_replace( '…', '', $excerpt );
|
920 |
+
|
921 |
if ( $limit ) {
|
922 |
$excerpt = wp_strip_all_tags( $excerpt );
|
923 |
+
|
924 |
+
if ( $type == 'word' ) {
|
925 |
$limit = $limit + 1;
|
926 |
$rawExcerpt = $excerpt;
|
927 |
$excerpt = explode( ' ', $excerpt, $limit );
|
928 |
+
|
929 |
if ( count( $excerpt ) >= $limit ) {
|
930 |
array_pop( $excerpt );
|
931 |
+
$excerpt = implode( ' ', $excerpt );
|
932 |
} else {
|
933 |
$excerpt = $rawExcerpt;
|
934 |
}
|
946 |
'b' => [],
|
947 |
'br' => [ [] ],
|
948 |
];
|
949 |
+
|
950 |
+
$excerpt = nl2br( wp_kses( $excerpt, $allowed_html ) );
|
951 |
}
|
952 |
|
953 |
+
$excerpt = ( $more ? $excerpt . ' ' . $more : $excerpt );
|
954 |
|
955 |
return apply_filters( 'tpg_get_the_excerpt', $excerpt, $post_id, $data, $defaultExcerpt );
|
956 |
}
|
960 |
$title = $originalTitle = get_the_title( $post_id );
|
961 |
$limit = isset( $data['title_limit'] ) ? absint( $data['title_limit'] ) : 0;
|
962 |
$limit_type = isset( $data['title_limit_type'] ) ? trim( $data['title_limit_type'] ) : 'character';
|
963 |
+
|
964 |
if ( $limit ) {
|
965 |
+
if ( $limit_type == 'word' ) {
|
966 |
$limit = $limit + 1;
|
967 |
$title = explode( ' ', $title, $limit );
|
968 |
+
|
969 |
if ( count( $title ) >= $limit ) {
|
970 |
array_pop( $title );
|
971 |
+
$title = implode( ' ', $title );
|
972 |
} else {
|
973 |
$title = $originalTitle;
|
974 |
}
|
975 |
} else {
|
976 |
if ( $limit > 0 && strlen( $title ) > $limit ) {
|
977 |
+
$title = mb_substr( $title, 0, $limit, 'utf-8' );
|
978 |
$title = preg_replace( '/\W\w+\s*(\W*)$/', '$1', $title );
|
979 |
}
|
980 |
}
|
989 |
$showitems = ( $range * 2 ) + 1;
|
990 |
|
991 |
$wpQuery = $postGrid;
|
992 |
+
|
993 |
global $wp_query;
|
994 |
+
|
995 |
if ( empty( $wpQuery ) ) {
|
996 |
$wpQuery = $wp_query;
|
997 |
}
|
998 |
|
999 |
$pages = ! empty( $wpQuery->max_num_pages ) ? $wpQuery->max_num_pages : 1;
|
1000 |
$paged = ! empty( $wpQuery->query['paged'] ) ? $wpQuery->query['paged'] : 1;
|
1001 |
+
|
1002 |
if ( is_front_page() ) {
|
1003 |
$paged = ! empty( $wp_query->query['paged'] ) ? $wp_query->query['paged'] : 1;
|
1004 |
}
|
1005 |
|
|
|
1006 |
$ajaxClass = null;
|
1007 |
$dataAttr = null;
|
1008 |
|
1019 |
}
|
1020 |
|
1021 |
if ( $paged > 1 && $showitems < $pages && ! $ajax ) {
|
1022 |
+
$p = $paged - 1;
|
1023 |
$html .= "<li><a data-paged='{$p}' href='" . get_pagenum_link( $p ) . "' aria-label='Previous'>‹</a></li>";
|
1024 |
}
|
1025 |
|
1026 |
if ( $ajax ) {
|
1027 |
for ( $i = 1; $i <= $pages; $i ++ ) {
|
1028 |
+
$html .= ( $paged == $i ) ? '<li class="active"><span>' . $i . '</span></li>' : "<li><a data-paged='{$i}' href='" . get_pagenum_link( $i ) . "'>" . $i . '</a></li>';
|
|
|
|
|
1029 |
}
|
1030 |
} else {
|
1031 |
for ( $i = 1; $i <= $pages; $i ++ ) {
|
1032 |
if ( 1 != $pages && ( ! ( $i >= $paged + $range + 1 || $i <= $paged - $range - 1 ) || $pages <= $showitems ) ) {
|
1033 |
+
$html .= ( $paged == $i ) ? '<li class="active"><span>' . $i . '</span></li>' : "<li><a data-paged='{$i}' href='" . get_pagenum_link( $i ) . "'>" . $i . '</a></li>';
|
|
|
|
|
1034 |
}
|
1035 |
}
|
1036 |
}
|
1037 |
|
1038 |
if ( $paged < $pages && $showitems < $pages && ! $ajax ) {
|
1039 |
+
$p = $paged + 1;
|
1040 |
$html .= "<li><a data-paged='{$p}' href=\"" . get_pagenum_link( $paged + 1 ) . "\" aria-label='Next'>›</a></li>";
|
1041 |
}
|
1042 |
|
1044 |
$html .= "<li><a data-paged='{$pages}' href='" . get_pagenum_link( $pages ) . "' aria-label='Last'>»</a></li>";
|
1045 |
}
|
1046 |
|
1047 |
+
$html .= '</ul>';
|
1048 |
+
$html .= '</div>';
|
1049 |
}
|
1050 |
|
1051 |
return $html;
|
1054 |
public static function rt_pagination_ajax( $scID, $range = 4, $pages = '' ) {
|
1055 |
$html = null;
|
1056 |
|
|
|
1057 |
$html .= "<div class='rt-tpg-pagination-ajax' data-sc-id='{$scID}' data-paged='1'>";
|
1058 |
+
$html .= '</div>';
|
|
|
1059 |
|
1060 |
return $html;
|
1061 |
}
|
1064 |
* Call the Image resize model for resize function
|
1065 |
*
|
1066 |
* @param $url
|
1067 |
+
* @param null $width
|
1068 |
+
* @param null $height
|
1069 |
+
* @param null $crop
|
1070 |
+
* @param bool|true $single
|
1071 |
* @param bool|false $upscale
|
1072 |
*
|
1073 |
* @return array|bool|string
|
1085 |
public static function rtHex2rgba( $color, $opacity = .5 ) {
|
1086 |
$default = 'rgb(0,0,0)';
|
1087 |
|
1088 |
+
// Return default if no color provided.
|
1089 |
if ( empty( $color ) ) {
|
1090 |
return $default;
|
1091 |
}
|
1092 |
|
1093 |
+
// Sanitize $color if "#" is provided.
|
1094 |
if ( $color[0] == '#' ) {
|
1095 |
$color = substr( $color, 1 );
|
1096 |
}
|
1097 |
|
1098 |
+
// Check if color has 6 or 3 characters and get values.
|
1099 |
if ( strlen( $color ) == 6 ) {
|
1100 |
$hex = [ $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] ];
|
1101 |
} elseif ( strlen( $color ) == 3 ) {
|
1104 |
return $default;
|
1105 |
}
|
1106 |
|
1107 |
+
// Convert hexadec to rgb.
|
1108 |
$rgb = array_map( 'hexdec', $hex );
|
1109 |
|
1110 |
+
// Check if opacity is set(rgba or rgb).
|
1111 |
if ( $opacity ) {
|
1112 |
if ( absint( $opacity ) > 1 ) {
|
1113 |
$opacity = 1.0;
|
1114 |
}
|
1115 |
+
|
1116 |
+
$output = 'rgba(' . implode( ',', $rgb ) . ',' . $opacity . ')';
|
1117 |
} else {
|
1118 |
+
$output = 'rgb(' . implode( ',', $rgb ) . ')';
|
1119 |
}
|
1120 |
|
1121 |
+
// Return rgb(a) color string.
|
1122 |
return $output;
|
1123 |
}
|
1124 |
|
1125 |
+
public static function meta_exist( $meta_key, $post_id = null, $type = 'post' ) {
|
1126 |
if ( ! $post_id ) {
|
1127 |
return false;
|
1128 |
}
|
1136 |
'big' => 6,
|
1137 |
'small' => 6,
|
1138 |
];
|
1139 |
+
|
1140 |
if ( $col ) {
|
1141 |
if ( $col == 12 ) {
|
1142 |
$return['big'] = 12;
|
1156 |
public static function formatSpacing( $data = '' ) {
|
1157 |
if ( ! empty( $data ) ) {
|
1158 |
$spacing = array_filter( explode( ',', $data ), 'is_numeric' );
|
1159 |
+
|
1160 |
if ( count( $spacing ) > 4 ) {
|
1161 |
$spacing = array_slice( $spacing, 0, 4, true );
|
1162 |
}
|
1163 |
+
|
1164 |
+
$data = implode( 'px ', $spacing );
|
1165 |
}
|
1166 |
|
1167 |
return $data;
|
1168 |
}
|
1169 |
|
1170 |
public static function layoutStyle( $layoutID, $scMeta, $layout, $scId = null ) {
|
1171 |
+
$css = null;
|
1172 |
$css .= "<style type='text/css' media='all'>";
|
1173 |
// primary color
|
1174 |
if ( $scId ) {
|
1180 |
: ( isset( $scMeta['button_text_color'][0] ) ? $scMeta['button_text_color'][0] : null ) );
|
1181 |
$button_hover_text_color = ( isset( $scMeta['button_hover_text_color'][0] ) ? $scMeta['button_hover_text_color'][0] : null );
|
1182 |
$button_border_color = ( isset( $scMeta['button_border_color'][0] ) ? $scMeta['button_border_color'][0] : null );
|
1183 |
+
$overlay_color = ( ! empty( $scMeta['overlay_color'][0] ) ? self::rtHex2rgba(
|
1184 |
+
$scMeta['overlay_color'][0],
|
1185 |
+
! empty( $scMeta['overlay_opacity'][0] ) ? absint( $scMeta['overlay_opacity'][0] ) / 10 : .8
|
1186 |
+
) : null );
|
1187 |
$overlay_padding = ( ! empty( $scMeta['overlay_padding'][0] ) ? absint( $scMeta['overlay_padding'][0] ) : null );
|
1188 |
$gutter = ! empty( $scMeta['tgp_gutter'][0] ) ? absint( $scMeta['tgp_gutter'][0] ) : null;
|
1189 |
$read_more_button_border_radius = isset( $scMeta['tpg_read_more_button_border_radius'][0] ) ? $scMeta['tpg_read_more_button_border_radius'][0] : '';
|
1250 |
: ( ! empty( $btn_text_color ) ? $btn_text_color : null ) );
|
1251 |
$button_border_color = ( isset( $scMeta['button_border_color'] ) ? $scMeta['button_border_color'] : null );
|
1252 |
$button_hover_text_color = ( isset( $scMeta['button_hover_text_color'] ) ? $scMeta['button_hover_text_color'] : null );
|
1253 |
+
$overlay_color = ( ! empty( $scMeta['overlay_color'] ) ? self::rtHex2rgba(
|
1254 |
+
$scMeta['overlay_color'],
|
1255 |
+
! empty( $scMeta['overlay_opacity'] ) ? absint( $scMeta['overlay_opacity'] ) / 10 : .8
|
1256 |
+
) : null );
|
1257 |
$overlay_padding = ( ! empty( $scMeta['overlay_padding'] ) ? absint( $scMeta['overlay_padding'] ) : null );
|
1258 |
$gutter = ! empty( $scMeta['tgp_gutter'] ) ? absint( $scMeta['tgp_gutter'] ) : null;
|
1259 |
$read_more_button_border_radius = isset( $scMeta['tpg_read_more_button_border_radius'] ) ? $scMeta['tpg_read_more_button_border_radius'] : '';
|
1314 |
|
1315 |
if ( $primaryColor ) {
|
1316 |
$css .= "#{$layoutID} .rt-holder .rt-woo-info .price{";
|
1317 |
+
$css .= 'color:' . $primaryColor . ';';
|
1318 |
+
$css .= '}';
|
1319 |
+
$css .= "body .rt-tpg-container .rt-tpg-isotope-buttons .selected,
|
1320 |
+
#{$layoutID} .layout12 .rt-holder:hover .rt-detail,
|
1321 |
+
#{$layoutID} .isotope8 .rt-holder:hover .rt-detail,
|
1322 |
+
#{$layoutID} .carousel8 .rt-holder:hover .rt-detail,
|
1323 |
+
#{$layoutID} .layout13 .rt-holder .overlay .post-info,
|
1324 |
+
#{$layoutID} .isotope9 .rt-holder .overlay .post-info,
|
1325 |
+
#{$layoutID}.rt-tpg-container .layout4 .rt-holder .rt-detail,
|
1326 |
+
.rt-modal-{$id} .md-content,
|
1327 |
+
.rt-modal-{$id} .md-content > .rt-md-content-holder .rt-md-content,
|
1328 |
+
.rt-popup-wrap-{$id}.rt-popup-wrap .rt-popup-navigation-wrap,
|
1329 |
+
#{$layoutID} .carousel9 .rt-holder .overlay .post-info{";
|
1330 |
+
$css .= 'background-color:' . $primaryColor . ';';
|
1331 |
+
$css .= '}';
|
1332 |
+
|
1333 |
+
$ocp = self::rtHex2rgba(
|
1334 |
+
$primaryColor,
|
1335 |
+
! empty( $scMeta['overlay_opacity'][0] ) ? absint( $scMeta['overlay_opacity'][0] ) / 10 : .8
|
1336 |
+
);
|
1337 |
$css .= "#{$layoutID} .layout5 .rt-holder .overlay, #{$layoutID} .isotope2 .rt-holder .overlay, #{$layoutID} .carousel2 .rt-holder .overlay,#{$layoutID} .layout15 .rt-holder h3, #{$layoutID} .isotope11 .rt-holder h3, #{$layoutID} .carousel11 .rt-holder h3, #{$layoutID} .layout16 .rt-holder h3,
|
1338 |
#{$layoutID} .isotope12 .rt-holder h3, #{$layoutID} .carousel12 .rt-holder h3 {";
|
1339 |
+
$css .= 'background-color:' . $ocp . ';';
|
1340 |
+
$css .= '}';
|
1341 |
}
|
1342 |
|
1343 |
if ( $button_border_color ) {
|
1344 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item,
|
1345 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item,
|
1346 |
+
#{$layoutID}.rt-tpg-container .swiper-navigation .slider-btn,
|
1347 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action,
|
1348 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item,
|
1349 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap{";
|
1350 |
+
$css .= 'border-color:' . $button_border_color . ' !important;';
|
1351 |
+
$css .= '}';
|
1352 |
$css .= "#{$layoutID} .rt-holder .read-more a {";
|
1353 |
+
$css .= 'border-color:' . $button_border_color . ';';
|
1354 |
+
$css .= '}';
|
1355 |
}
|
1356 |
|
1357 |
if ( $button_bg_color ) {
|
1358 |
$css .= "#{$layoutID} .pagination-list li a,
|
1359 |
+
{$layoutID} .pagination-list li span,
|
1360 |
+
{$layoutID} .pagination li a,
|
1361 |
+
#{$layoutID} .rt-tpg-isotope-buttons button,
|
1362 |
+
#{$layoutID} .rt-tpg-utility .rt-tpg-load-more button,
|
1363 |
+
#{$layoutID}.rt-tpg-container .swiper-navigation .slider-btn,
|
1364 |
+
#{$layoutID}.rt-tpg-container .swiper-pagination-bullet,
|
1365 |
+
#{$layoutID} .wc1 .rt-holder .rt-img-holder .overlay .product-more ul li a,
|
1366 |
+
#{$layoutID} .wc2 .rt-detail .rt-wc-add-to-cart,
|
1367 |
+
#{$layoutID} .wc3 .rt-detail .rt-wc-add-to-cart,
|
1368 |
+
#{$layoutID} .wc4 .rt-detail .rt-wc-add-to-cart,
|
1369 |
+
#{$layoutID} .wc-carousel2 .rt-detail .rt-wc-add-to-cart,
|
1370 |
+
#{$layoutID} .wc-isotope2 .rt-detail .rt-wc-add-to-cart,
|
1371 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown,
|
1372 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item,
|
1373 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li>a,
|
1374 |
+
#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item,
|
1375 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn,
|
1376 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-cb-page-prev-next > *,
|
1377 |
+
#{$layoutID} .rt-read-more,
|
1378 |
+
#rt-tooltip-{$id}, #rt-tooltip-{$id} .rt-tooltip-bottom:after{";
|
1379 |
+
$css .= 'background-color:' . $button_bg_color . ';';
|
1380 |
+
$css .= '}';
|
1381 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item,
|
1382 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item{";
|
1383 |
+
$css .= 'border-color:' . $button_bg_color . ';';
|
1384 |
+
$css .= '}';
|
1385 |
$css .= "#{$layoutID}.rt-tpg-container .layout17 .rt-holder .overlay a.tpg-zoom .fa{";
|
1386 |
+
$css .= 'color:' . $button_bg_color . ';';
|
1387 |
+
$css .= '}';
|
1388 |
|
1389 |
$css .= "#{$layoutID} .rt-holder .read-more a {";
|
1390 |
+
$css .= 'background-color:' . $button_bg_color . ';padding: 8px 15px;';
|
1391 |
+
$css .= '}';
|
1392 |
}
|
1393 |
|
1394 |
+
// button active color.
|
1395 |
if ( $button_active_bg_color ) {
|
1396 |
+
$css .= "#{$layoutID} .pagination li.active span,
|
1397 |
+
#{$layoutID} .pagination-list li.active span,
|
1398 |
+
#{$layoutID} .rt-tpg-isotope-buttons button.selected,
|
1399 |
+
#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected,
|
1400 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item.selected,
|
1401 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active>a,
|
1402 |
+
#{$layoutID}.rt-tpg-container .swiper-pagination-bullet.swiper-pagination-bullet-active-main{";
|
1403 |
+
$css .= 'background-color:' . $button_active_bg_color . ';';
|
1404 |
+
$css .= '}';
|
1405 |
|
1406 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected,
|
1407 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item.selected,
|
1408 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active>a{";
|
1409 |
+
$css .= 'border-color:' . $button_active_bg_color . ';';
|
1410 |
+
$css .= '}';
|
1411 |
}
|
1412 |
|
1413 |
+
// Button hover bg color.
|
1414 |
if ( $button_hover_bg_color ) {
|
1415 |
$css .= "#{$layoutID} .pagination-list li a:hover,
|
1416 |
+
#{$layoutID} .pagination li a:hover,
|
1417 |
+
#{$layoutID} .rt-tpg-isotope-buttons button:hover,
|
1418 |
+
#{$layoutID} .rt-holder .read-more a:hover,
|
1419 |
+
#{$layoutID} .rt-tpg-utility .rt-tpg-load-more button:hover,
|
1420 |
+
#{$layoutID}.rt-tpg-container .swiper-pagination-bullet:hover,
|
1421 |
+
#{$layoutID}.rt-tpg-container .swiper-navigation .slider-btn:hover,
|
1422 |
+
#{$layoutID} .wc1 .rt-holder .rt-img-holder .overlay .product-more ul li a:hover,
|
1423 |
+
#{$layoutID} .wc2 .rt-detail .rt-wc-add-to-cart:hover,
|
1424 |
+
#{$layoutID} .wc3 .rt-detail .rt-wc-add-to-cart:hover,
|
1425 |
+
#{$layoutID} .wc4 .rt-detail .rt-wc-add-to-cart:hover,
|
1426 |
+
#{$layoutID} .wc-carousel2 .rt-detail .rt-wc-add-to-cart:hover,
|
1427 |
+
#{$layoutID} .wc-isotope2 .rt-detail .rt-wc-add-to-cart:hover,
|
1428 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover,
|
1429 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item.selected,
|
1430 |
+
#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover,
|
1431 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item:hover,
|
1432 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li>a:hover,
|
1433 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-cb-page-prev-next > *:hover,
|
1434 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover,
|
1435 |
+
#{$layoutID} .rt-read-more:hover,
|
1436 |
+
#{$layoutID} .rt-tpg-utility .rt-tpg-load-more button:hover{";
|
1437 |
+
$css .= 'background-color:' . $button_hover_bg_color . ';';
|
1438 |
+
$css .= '}';
|
1439 |
|
1440 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover,
|
1441 |
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item:hover,
|
1442 |
#{$layoutID}.rt-tpg-container .swiper-navigation .slider-btn:hover,
|
1443 |
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li>a:hover{";
|
1444 |
+
$css .= 'border-color:' . $button_hover_bg_color . ';';
|
1445 |
+
$css .= '}';
|
1446 |
$css .= "#{$layoutID}.rt-tpg-container .layout17 .rt-holder .overlay a.tpg-zoom:hover .fa{";
|
1447 |
+
$css .= 'color:' . $button_hover_bg_color . ';';
|
1448 |
+
$css .= '}';
|
1449 |
}
|
1450 |
|
1451 |
+
// Button text color.
|
1452 |
if ( $button_text_color ) {
|
1453 |
$css .= "#{$layoutID} .pagination-list li a,
|
1454 |
+
#{$layoutID} .pagination li a,
|
1455 |
+
#{$layoutID} .rt-tpg-isotope-buttons button,
|
1456 |
+
#{$layoutID} .rt-holder .read-more a,
|
1457 |
+
#{$layoutID} .rt-tpg-utility .rt-tpg-load-more button,
|
1458 |
+
#{$layoutID}.rt-tpg-container .swiper-navigation .slider-btn,
|
1459 |
+
#{$layoutID} .wc1 .rt-holder .rt-img-holder .overlay .product-more ul li a,
|
1460 |
+
#{$layoutID} .edd1 .rt-holder .rt-img-holder .overlay .product-more ul li a,
|
1461 |
+
#{$layoutID} .wc2 .rt-detail .rt-wc-add-to-cart,
|
1462 |
+
#{$layoutID} .wc3 .rt-detail .rt-wc-add-to-cart,
|
1463 |
+
#{$layoutID} .edd2 .rt-detail .rt-wc-add-to-cart,
|
1464 |
+
#{$layoutID} .wc4 .rt-detail .rt-wc-add-to-cart,
|
1465 |
+
#{$layoutID} .edd3 .rt-detail .rt-wc-add-to-cart,
|
1466 |
+
#{$layoutID} .wc-carousel2 .rt-detail .rt-wc-add-to-cart,
|
1467 |
+
#{$layoutID} .wc-isotope2 .rt-detail .rt-wc-add-to-cart,
|
1468 |
+
#{$layoutID} .rt-tpg-utility .rt-tpg-load-more button,
|
1469 |
+
#rt-tooltip-{$id},
|
1470 |
+
#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item,
|
1471 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item,
|
1472 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action,
|
1473 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item,
|
1474 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li>a,
|
1475 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-cb-page-prev-next > *,
|
1476 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn,
|
1477 |
+
#{$layoutID} .rt-read-more,
|
1478 |
+
#rt-tooltip-{$id} .rt-tooltip-bottom:after{";
|
1479 |
+
$css .= 'color:' . $button_text_color . ';';
|
1480 |
+
$css .= '}';
|
1481 |
}
|
1482 |
|
1483 |
if ( $button_hover_text_color ) {
|
1484 |
$css .= "#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover,
|
1485 |
+
#{$layoutID} .rt-holder .read-more a:hover,
|
1486 |
+
#{$layoutID}.rt-tpg-container .swiper-navigation .slider-btn:hover,
|
1487 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-sub-tax.sub-button-group .rt-filter-button-item:hover,
|
1488 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover,
|
1489 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item.selected,
|
1490 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action:hover,
|
1491 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active>a:hover,
|
1492 |
+
#{$layoutID} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected,
|
1493 |
+
#{$layoutID} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-sort-order-action,
|
1494 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-loadmore-btn:hover,
|
1495 |
+
#{$layoutID} .rt-read-more:hover,
|
1496 |
+
#{$layoutID}.rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active>a{";
|
1497 |
+
$css .= 'color:' . $button_hover_text_color . ';';
|
1498 |
+
$css .= '}';
|
1499 |
}
|
1500 |
|
1501 |
if ( $overlay_color || $overlay_padding ) {
|
1502 |
if ( in_array( $layout, [ 'layout15', 'isotope11', 'carousel11' ] ) ) {
|
1503 |
$css .= "#{$layoutID} .{$layout} .rt-holder:hover .overlay .post-info{";
|
1504 |
+
} elseif ( in_array(
|
1505 |
+
$layout,
|
1506 |
+
[ 'layout10', 'isotope7', 'carousel6', 'carousel7', 'layout9', 'offset04' ]
|
1507 |
+
)
|
1508 |
) {
|
1509 |
$css .= "#{$layoutID} .{$layout} .rt-holder .post-info{";
|
1510 |
} elseif ( in_array( $layout, [ 'layout7', 'isotope4', 'carousel4' ] ) ) {
|
1517 |
$css .= "#{$layoutID} .rt-post-overlay .post-img > a:first-of-type::after,";
|
1518 |
$css .= "#{$layoutID} .rt-holder .overlay:hover{";
|
1519 |
}
|
1520 |
+
|
1521 |
if ( $overlay_color ) {
|
1522 |
+
$css .= 'background-image: none;';
|
1523 |
+
$css .= 'background-color:' . $overlay_color . ';';
|
1524 |
}
|
1525 |
+
|
1526 |
if ( $overlay_padding ) {
|
1527 |
+
$css .= 'padding-top:' . $overlay_padding . '%;';
|
1528 |
}
|
1529 |
+
|
1530 |
+
$css .= '}';
|
1531 |
}
|
1532 |
|
1533 |
if ( $boxShadow ) {
|
1534 |
$css .= "#{$layoutID} .{$layout} .rt-holder {";
|
1535 |
$css .= "box-shadow : 0px 0px 2px 0px {$boxShadow};";
|
1536 |
+
$css .= '}';
|
1537 |
}
|
1538 |
|
1539 |
/* gutter */
|
1543 |
$css .= "padding-right : {$gutter}px !important;";
|
1544 |
$css .= "margin-top : {$gutter}px;";
|
1545 |
$css .= "margin-bottom : {$gutter}px;";
|
1546 |
+
$css .= '}';
|
1547 |
$css .= "#{$layoutID} .rt-row{";
|
1548 |
$css .= "margin-left : -{$gutter}px !important;";
|
1549 |
$css .= "margin-right : -{$gutter}px !important;";
|
1550 |
+
$css .= '}';
|
1551 |
$css .= "#{$layoutID}.rt-container-fluid,#{$layoutID}.rt-container{";
|
1552 |
$css .= "padding-left : {$gutter}px;";
|
1553 |
$css .= "padding-right : {$gutter}px;";
|
1554 |
+
$css .= '}';
|
1555 |
|
1556 |
+
// remove inner row margin.
|
1557 |
$css .= "#{$layoutID} .rt-row .rt-row [class*='rt-col-'] {";
|
1558 |
+
$css .= 'margin-top : 0;';
|
1559 |
+
$css .= '}';
|
1560 |
}
|
1561 |
|
1562 |
+
// Read more button border radius.
|
1563 |
if ( isset( $read_more_button_border_radius ) || trim( $read_more_button_border_radius ) !== '' ) {
|
1564 |
$css .= "#{$layoutID} .read-more a{";
|
1565 |
+
$css .= 'border-radius:' . $read_more_button_border_radius . 'px;';
|
1566 |
+
$css .= '}';
|
1567 |
}
|
1568 |
|
1569 |
+
// Section.
|
1570 |
if ( $sectionBg ) {
|
1571 |
$css .= "#{$layoutID}.rt-tpg-container {";
|
1572 |
+
$css .= 'background:' . $sectionBg . ';';
|
1573 |
+
$css .= '}';
|
1574 |
}
|
1575 |
+
|
1576 |
if ( $sectionMargin ) {
|
1577 |
$css .= "#{$layoutID}.rt-tpg-container {";
|
1578 |
+
$css .= 'margin:' . $sectionMargin . 'px;';
|
1579 |
+
$css .= '}';
|
1580 |
}
|
1581 |
+
|
1582 |
if ( $sectionPadding ) {
|
1583 |
$css .= "#{$layoutID}.rt-tpg-container {";
|
1584 |
+
$css .= 'padding:' . $sectionPadding . 'px;';
|
1585 |
+
$css .= '}';
|
1586 |
}
|
1587 |
+
|
1588 |
+
// Box.
|
1589 |
if ( $boxBg ) {
|
1590 |
$css .= "#{$layoutID} .rt-holder, #{$layoutID} .rt-holder .rt-detail,#{$layoutID} .rt-post-overlay .post-img + .post-content {";
|
1591 |
+
$css .= 'background-color:' . $boxBg . ';';
|
1592 |
+
$css .= '}';
|
1593 |
}
|
1594 |
+
|
1595 |
if ( $boxBorderColor ) {
|
1596 |
$css .= "#{$layoutID} .rt-holder {";
|
1597 |
+
$css .= 'border-color:' . $boxBorderColor . ';';
|
1598 |
+
$css .= '}';
|
1599 |
}
|
1600 |
+
|
1601 |
if ( $boxBorder ) {
|
1602 |
$css .= "#{$layoutID} .rt-holder {";
|
1603 |
+
$css .= 'border-style: solid;';
|
1604 |
+
$css .= 'border-width:' . $boxBorder . 'px;';
|
1605 |
+
$css .= '}';
|
1606 |
}
|
1607 |
+
|
1608 |
if ( $boxBorderRadius ) {
|
1609 |
$css .= "#{$layoutID} .rt-holder {";
|
1610 |
+
$css .= 'border-radius:' . $boxBorderRadius . 'px;';
|
1611 |
+
$css .= '}';
|
1612 |
}
|
1613 |
+
|
1614 |
if ( $boxPadding ) {
|
1615 |
$css .= "#{$layoutID} .rt-holder {";
|
1616 |
+
$css .= 'padding:' . $boxPadding . 'px;';
|
1617 |
+
$css .= '}';
|
1618 |
}
|
1619 |
+
|
1620 |
if ( $contentPadding ) {
|
1621 |
$css .= "#{$layoutID} .rt-holder .rt-detail {";
|
1622 |
+
$css .= 'padding:' . $contentPadding . 'px;';
|
1623 |
+
$css .= '}';
|
1624 |
}
|
1625 |
+
|
1626 |
+
// Widget heading.
|
1627 |
if ( $headingBg ) {
|
1628 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading {";
|
1629 |
+
$css .= 'background:' . $headingBg . ';';
|
1630 |
+
$css .= '}';
|
1631 |
|
1632 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading::after {";
|
1633 |
+
$css .= 'border-top-color:' . $headingBg . ';';
|
1634 |
+
$css .= '}';
|
1635 |
}
|
1636 |
+
|
1637 |
if ( $headingColor ) {
|
1638 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading a, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading a, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading a {";
|
1639 |
+
$css .= 'color:' . $headingColor . ';';
|
1640 |
+
$css .= '}';
|
1641 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading::before {";
|
1642 |
+
$css .= 'background-color:' . $headingColor . ';';
|
1643 |
+
$css .= '}';
|
1644 |
}
|
1645 |
+
|
1646 |
if ( $headingBorderSize ) {
|
1647 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 {";
|
1648 |
+
// $css .= "border-bottom-style: solid;";
|
1649 |
+
$css .= 'border-bottom-width:' . $headingBorderSize . 'px;';
|
1650 |
+
$css .= '}';
|
1651 |
|
1652 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line {";
|
1653 |
+
$css .= 'border-width:' . $headingBorderSize . 'px 0;';
|
1654 |
+
$css .= '}';
|
1655 |
}
|
1656 |
+
|
1657 |
if ( $headingBorderColor ) {
|
1658 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line, #{$layoutID} .tpg-widget-heading-wrapper.heading-style2, #{$layoutID} .tpg-widget-heading-wrapper.heading-style3 {";
|
1659 |
+
$css .= 'border-color:' . $headingBorderColor . ';';
|
1660 |
+
$css .= '}';
|
1661 |
}
|
1662 |
+
|
1663 |
if ( $headingMargin ) {
|
1664 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper {";
|
1665 |
+
$css .= 'margin:' . $headingMargin . 'px;';
|
1666 |
+
$css .= '}';
|
1667 |
}
|
1668 |
+
|
1669 |
if ( $headingPadding ) {
|
1670 |
$css .= "#{$layoutID} .tpg-widget-heading-wrapper .tpg-widget-heading {";
|
1671 |
+
$css .= 'padding:' . $headingPadding . 'px;';
|
1672 |
+
$css .= '}';
|
1673 |
}
|
1674 |
+
|
1675 |
+
// Image border.
|
1676 |
if ( isset( $image_border_radius ) || trim( $image_border_radius ) !== '' ) {
|
1677 |
$css .= "#{$layoutID} .rt-img-holder img.rt-img-responsive,#{$layoutID} .rt-img-holder,
|
1678 |
+
#{$layoutID} .rt-post-overlay .post-img,
|
1679 |
+
#{$layoutID} .post-sm .post-img,
|
1680 |
+
#{$layoutID} .rt-post-grid .post-img,
|
1681 |
+
#{$layoutID} .post-img img {";
|
1682 |
+
$css .= 'border-radius:' . $image_border_radius . 'px;';
|
1683 |
+
$css .= '}';
|
1684 |
}
|
1685 |
|
1686 |
+
// Title decoration.
|
1687 |
if ( $title_color || $title_size || $title_weight || $title_alignment ) {
|
1688 |
$css .= "#{$layoutID} .{$layout} .rt-holder h2.entry-title,
|
1689 |
+
#{$layoutID} .{$layout} .rt-holder h3.entry-title,
|
1690 |
+
#{$layoutID} .{$layout} .rt-holder h4.entry-title,
|
1691 |
+
#{$layoutID} .{$layout} .rt-holder h2.entry-title a,
|
1692 |
+
#{$layoutID} .{$layout} .rt-holder h3.entry-title a,
|
1693 |
+
#{$layoutID} .{$layout} .rt-holder h4.entry-title a,
|
1694 |
+
#{$layoutID} .rt-holder .rt-woo-info h2 a,
|
1695 |
+
#{$layoutID} .rt-holder .rt-woo-info h3 a,
|
1696 |
+
#{$layoutID} .rt-holder .rt-woo-info h4 a,
|
1697 |
+
#{$layoutID} .post-content .post-title,
|
1698 |
+
#{$layoutID} .rt-post-grid .post-title,
|
1699 |
+
#{$layoutID} .rt-post-grid .post-title a,
|
1700 |
+
#{$layoutID} .post-content .post-title a,
|
1701 |
+
#{$layoutID} .rt-holder .rt-woo-info h2,
|
1702 |
+
#{$layoutID} .rt-holder .rt-woo-info h3,
|
1703 |
+
#{$layoutID} .rt-holder .rt-woo-info h4{";
|
1704 |
+
|
1705 |
if ( $title_color ) {
|
1706 |
+
$css .= 'color:' . $title_color . ';';
|
1707 |
}
|
1708 |
+
|
1709 |
if ( $title_size ) {
|
1710 |
$lineHeight = $title_size + 10;
|
1711 |
+
$css .= 'font-size:' . $title_size . 'px;';
|
1712 |
+
$css .= 'line-height:' . $lineHeight . 'px;';
|
1713 |
}
|
1714 |
+
|
1715 |
if ( $title_weight ) {
|
1716 |
+
$css .= 'font-weight:' . $title_weight . ';';
|
1717 |
}
|
1718 |
+
|
1719 |
if ( $title_alignment ) {
|
1720 |
+
$css .= 'text-align:' . $title_alignment . ';';
|
1721 |
}
|
1722 |
+
|
1723 |
+
$css .= '}';
|
1724 |
+
|
1725 |
if ( $title_size ) {
|
1726 |
$css .= "#{$layoutID} .post-grid-lg-style-1 .post-title,
|
1727 |
+
#{$layoutID} .post-grid-lg-style-1 .post-title a,
|
1728 |
#{$layoutID} .big-layout .post-title,
|
1729 |
+
#{$layoutID} .big-layout .post-title a,
|
1730 |
#{$layoutID} .post-grid-lg-style-1 .post-title,
|
1731 |
#{$layoutID} .post-grid-lg-style-1 .post-title a {";
|
1732 |
+
$css .= 'font-size:' . ( $title_size + 8 ) . 'px;';
|
1733 |
+
$css .= 'line-height:' . ( $lineHeight + 8 ) . 'px;';
|
1734 |
+
$css .= '}';
|
1735 |
}
|
1736 |
}
|
1737 |
+
|
1738 |
+
// Title hover color.
|
1739 |
if ( $title_hover_color ) {
|
1740 |
$css .= "#{$layoutID} .{$layout} .rt-holder h2.entry-title:hover,
|
1741 |
+
#{$layoutID} .{$layout} .rt-holder h3.entry-title:hover,
|
1742 |
+
#{$layoutID} .{$layout} .rt-holder h4.entry-title:hover,
|
1743 |
+
#{$layoutID} .{$layout} .rt-holder h2.entry-title a:hover,
|
1744 |
+
#{$layoutID} .{$layout} .rt-holder h3.entry-title a:hover,
|
1745 |
+
#{$layoutID} .{$layout} .rt-holder h4.entry-title a:hover,
|
1746 |
+
#{$layoutID} .post-content .post-title a:hover,
|
1747 |
+
#{$layoutID} .rt-post-grid .post-title a:hover,
|
1748 |
+
#{$layoutID} .rt-holder .rt-woo-info h2 a:hover,
|
1749 |
+
#{$layoutID} .rt-holder .rt-woo-info h3 a:hover,
|
1750 |
+
#{$layoutID} .rt-holder .rt-woo-info h4 a:hover,
|
1751 |
+
#{$layoutID} .rt-holder .rt-woo-info h2:hover,
|
1752 |
+
#{$layoutID} .rt-holder .rt-woo-info h3:hover,
|
1753 |
+
#{$layoutID} .rt-holder .rt-woo-info h4:hover{";
|
1754 |
+
$css .= 'color:' . $title_hover_color . ' !important;';
|
1755 |
+
$css .= '}';
|
1756 |
+
}
|
1757 |
+
// Excerpt decoration.
|
1758 |
if ( $excerpt_color || $excerpt_size || $excerpt_weight || $excerpt_alignment ) {
|
1759 |
$css .= "#{$layoutID} .{$layout} .rt-holder .tpg-excerpt,#{$layoutID} .{$layout} .tpg-excerpt,#{$layoutID} .{$layout} .rt-holder .post-content,#{$layoutID} .rt-holder .rt-woo-info p,#{$layoutID} .post-content p {";
|
1760 |
+
|
1761 |
if ( $excerpt_color ) {
|
1762 |
+
$css .= 'color:' . $excerpt_color . ';';
|
1763 |
}
|
1764 |
+
|
1765 |
if ( $excerpt_size ) {
|
1766 |
+
$css .= 'font-size:' . $excerpt_size . 'px;';
|
1767 |
}
|
1768 |
+
|
1769 |
if ( $excerpt_weight ) {
|
1770 |
+
$css .= 'font-weight:' . $excerpt_weight . ';';
|
1771 |
}
|
1772 |
+
|
1773 |
if ( $excerpt_alignment ) {
|
1774 |
+
$css .= 'text-align:' . $excerpt_alignment . ';';
|
1775 |
}
|
1776 |
+
|
1777 |
+
$css .= '}';
|
1778 |
}
|
1779 |
+
|
1780 |
+
// Post meta decoration.
|
1781 |
if ( $meta_data_color || $meta_data_size || $meta_data_weight || $meta_data_alignment ) {
|
1782 |
$css .= "#{$layoutID} .{$layout} .rt-holder .post-meta-user,
|
1783 |
+
#{$layoutID} .{$layout} .rt-meta,
|
1784 |
+
#{$layoutID} .{$layout} .rt-meta a,
|
1785 |
+
#{$layoutID} .{$layout} .rt-holder .post-meta-user .meta-data,
|
1786 |
+
#{$layoutID} .{$layout} .rt-holder .post-meta-user a,
|
1787 |
+
#{$layoutID} .{$layout} .rt-holder .rt-detail .post-meta .rt-tpg-social-share,
|
1788 |
+
#{$layoutID} .rt-post-overlay .post-meta-user span,
|
1789 |
+
#{$layoutID} .rt-post-overlay .post-meta-user,
|
1790 |
+
#{$layoutID} .rt-post-overlay .post-meta-user a,
|
1791 |
+
#{$layoutID} .rt-post-grid .post-meta-user,
|
1792 |
+
#{$layoutID} .rt-post-grid .post-meta-user a,
|
1793 |
+
#{$layoutID} .rt-post-box-media-style .post-meta-user,
|
1794 |
+
#{$layoutID} .rt-post-box-media-style .post-meta-user a,
|
1795 |
+
#{$layoutID} .{$layout} .post-meta-user i,
|
1796 |
+
#{$layoutID} .rt-detail .post-meta-category a,
|
1797 |
+
#{$layoutID} .{$layout} .post-meta-user a
|
1798 |
+
#{$layoutID} .{$layout} .post-meta-user a {";
|
1799 |
+
|
1800 |
if ( $meta_data_color ) {
|
1801 |
+
$css .= 'color:' . $meta_data_color . ';';
|
1802 |
}
|
1803 |
+
|
1804 |
if ( $meta_data_size ) {
|
1805 |
+
$css .= 'font-size:' . $meta_data_size . 'px;';
|
1806 |
}
|
1807 |
+
|
1808 |
if ( $meta_data_weight ) {
|
1809 |
+
$css .= 'font-weight:' . $meta_data_weight . ';';
|
1810 |
}
|
1811 |
+
|
1812 |
if ( $meta_data_alignment ) {
|
1813 |
+
$css .= 'text-align:' . $meta_data_alignment . ';';
|
1814 |
}
|
1815 |
+
|
1816 |
+
$css .= '}';
|
1817 |
}
|
1818 |
+
|
1819 |
+
// Category.
|
1820 |
if ( $catBg ) {
|
1821 |
$css .= "#{$layoutID} .cat-over-image.style2 .categories-links a,
|
1822 |
+
#{$layoutID} .cat-over-image.style3 .categories-links a,
|
1823 |
+
#{$layoutID} .cat-above-title.style2 .categories-links a,
|
1824 |
+
#{$layoutID} .cat-above-title.style3 .categories-links a,
|
1825 |
+
#{$layoutID} .rt-tpg-category > a {
|
1826 |
+
background-color: {$catBg};
|
1827 |
+
}";
|
1828 |
|
1829 |
$css .= "#{$layoutID} .cat-above-title.style3 .categories-links a:after,
|
1830 |
+
.cat-over-image.style3 .categories-links a:after,
|
1831 |
+
#{$layoutID} .rt-tpg-category > a,
|
1832 |
+
#{$layoutID} .rt-tpg-category.style3 > a:after {
|
1833 |
+
border-top-color: {$catBg} ;
|
1834 |
+
}";
|
1835 |
|
1836 |
$css .= "#{$layoutID} .rt-tpg-category:not(style1) i {
|
1837 |
color: {$catBg};
|
1838 |
}";
|
1839 |
}
|
1840 |
+
|
1841 |
if ( $catTextColor ) {
|
1842 |
$css .= "#{$layoutID} .cat-over-image .categories-links a,
|
1843 |
#{$layoutID} .cat-above-title .categories-links a,
|
1844 |
#{$layoutID} .rt-tpg-category.style1 > i,
|
1845 |
#{$layoutID} .rt-tpg-category > a {";
|
1846 |
+
$css .= 'color:' . $catTextColor . ';';
|
1847 |
+
$css .= '}';
|
1848 |
}
|
1849 |
+
|
1850 |
if ( $catBorderRadius ) {
|
1851 |
$css .= "#{$layoutID} .cat-over-image .categories-links a,#{$layoutID} .cat-above-title .categories-links a,#{$layoutID} .rt-tpg-category > a{";
|
1852 |
+
$css .= 'border-radius:' . $catBorderRadius . 'px;';
|
1853 |
+
$css .= '}';
|
1854 |
}
|
1855 |
+
|
1856 |
if ( $catPadding ) {
|
1857 |
$css .= "#{$layoutID} .cat-over-image .categories-links a,#{$layoutID} .cat-above-title .categories-links a,#{$layoutID} .rt-tpg-category > a{";
|
1858 |
+
$css .= 'padding:' . $catPadding . 'px;';
|
1859 |
+
$css .= '}';
|
1860 |
}
|
1861 |
+
|
1862 |
if ( $catMargin ) {
|
1863 |
$css .= "#{$layoutID} .categories-links,#{$layoutID} .rt-tpg-category > a{";
|
1864 |
+
$css .= 'margin:' . $catMargin . 'px;';
|
1865 |
+
$css .= '}';
|
1866 |
}
|
1867 |
+
|
1868 |
if ( $categorySize ) {
|
1869 |
$css .= "#{$layoutID} .categories-links,#{$layoutID} .rt-tpg-category > a {";
|
1870 |
+
$css .= 'font-size:' . $categorySize . 'px;';
|
1871 |
+
$css .= '}';
|
1872 |
}
|
1873 |
|
1874 |
+
$css .= '</style>';
|
1875 |
|
1876 |
return $css;
|
1877 |
}
|
1878 |
|
1879 |
public static function get_meta_keys( $post_type ) {
|
|
|
|
|
1880 |
$meta_keys = self::generate_meta_keys( $post_type );
|
1881 |
|
1882 |
return $meta_keys;
|
1884 |
|
1885 |
public static function generate_meta_keys( $post_type ) {
|
1886 |
$meta_keys = [];
|
1887 |
+
|
1888 |
if ( $post_type ) {
|
1889 |
global $wpdb;
|
1890 |
+
|
1891 |
+
$query = "SELECT DISTINCT($wpdb->postmeta.meta_key)
|
1892 |
+
FROM $wpdb->posts
|
1893 |
+
LEFT JOIN $wpdb->postmeta
|
1894 |
+
ON $wpdb->posts.ID = $wpdb->postmeta.post_id
|
1895 |
+
WHERE $wpdb->posts.post_type = '%s'
|
1896 |
+
AND $wpdb->postmeta.meta_key != ''
|
1897 |
+
AND $wpdb->postmeta.meta_key NOT RegExp '(^[_0-9].+$)'
|
1898 |
+
AND $wpdb->postmeta.meta_key NOT RegExp '(^[0-9]+$)'";
|
1899 |
$meta_keys = $wpdb->get_col( $wpdb->prepare( $query, $post_type ) );
|
|
|
1900 |
}
|
1901 |
|
1902 |
return $meta_keys;
|
1914 |
|
1915 |
public static function is_acf() {
|
1916 |
$plugin = null;
|
1917 |
+
|
1918 |
if ( class_exists( 'acf' ) ) {
|
1919 |
$plugin = 'acf';
|
1920 |
}
|
1923 |
}
|
1924 |
|
1925 |
public static function get_groups_by_post_type( $post_type ) {
|
1926 |
+
$post_type = $post_type ? $post_type : 'post';
|
1927 |
$groups = [];
|
1928 |
$plugin = self::is_acf();
|
1929 |
+
|
1930 |
switch ( $plugin ) {
|
1931 |
case 'acf':
|
1932 |
$groups = self::get_groups_by_post_type_acf( $post_type );
|
1945 |
*/
|
1946 |
public static function get_groups_by_post_type_acf( $post_type ) {
|
1947 |
$groups = [];
|
1948 |
+
$groups_q = get_posts(
|
1949 |
+
[
|
1950 |
+
'post_type' => 'acf-field-group',
|
1951 |
+
'posts_per_page' => - 1,
|
1952 |
+
]
|
1953 |
+
);
|
1954 |
|
1955 |
if ( ! empty( $groups_q ) ) {
|
1956 |
foreach ( $groups_q as $group ) {
|
1957 |
$c = $group->post_content ? unserialize( $group->post_content ) : [];
|
1958 |
$flag = false;
|
1959 |
+
|
1960 |
if ( ! empty( $c['location'] ) ) {
|
1961 |
foreach ( $c['location'] as $rules ) {
|
1962 |
foreach ( $rules as $rule ) {
|
1963 |
+
if ( 'all' === $post_type ) {
|
1964 |
+
if ( ( ! empty( $rule['param'] ) && $rule['param'] == 'post_type' ) && ( ! empty( $rule['operator'] ) && $rule['operator'] == '==' )
|
|
|
1965 |
) {
|
1966 |
$flag = true;
|
1967 |
}
|
1968 |
} else {
|
1969 |
+
if ( ( ! empty( $rule['param'] ) && ( $rule['param'] == 'post_type' || ( $rule['param'] == 'post_category' && 'post' == $post_type ) ) ) && ( ! empty( $rule['operator'] ) && $rule['operator'] == '==' ) && ( ! empty( $rule['value'] ) && ( $rule['value'] == $post_type || ( $rule['param'] == 'post_category' && 'post' == $post_type ) ) )
|
|
|
|
|
1970 |
|
1971 |
) {
|
1972 |
$flag = true;
|
1998 |
|
1999 |
/**
|
2000 |
* Elementor Functionality
|
2001 |
+
* ************************************************
|
2002 |
*/
|
2003 |
|
2004 |
|
2013 |
if ( isset( $data['category'] ) && 'category' == $data['category'] ) {
|
2014 |
return true;
|
2015 |
}
|
2016 |
+
|
2017 |
if ( 'default' == $data['category_position']
|
2018 |
+
&& in_array(
|
2019 |
+
$data['layout'],
|
2020 |
[
|
2021 |
'grid-layout4',
|
2022 |
'grid-layout5',
|
2042 |
'slider-layout9',
|
2043 |
'slider-layout11',
|
2044 |
'slider-layout12',
|
2045 |
+
]
|
2046 |
+
)
|
2047 |
) {
|
2048 |
return false;
|
2049 |
}
|
2061 |
*/
|
2062 |
public static function get_post_link( $pID, $data ) {
|
2063 |
$link_class = $link_start = $link_end = $readmore_link_start = $readmore_link_end = null;
|
2064 |
+
|
2065 |
if ( 'default' == $data['post_link_type'] ) {
|
2066 |
+
$link_class = 'tpg-post-link';
|
2067 |
+
$link_start = $readmore_link_start = sprintf(
|
2068 |
+
'<a data-id="%s" href="%s" class="%s" target="%s">',
|
2069 |
+
absint( $pID ),
|
2070 |
+
esc_url( get_permalink() ),
|
2071 |
+
esc_attr( $link_class ),
|
2072 |
+
esc_attr( $data['link_target'] )
|
2073 |
+
);
|
2074 |
+
$link_end = $readmore_link_end = '</a>';
|
2075 |
} elseif ( 'popup' == $data['post_link_type'] ) {
|
2076 |
+
$link_class = 'tpg-single-popup tpg-post-link';
|
2077 |
+
|
2078 |
if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
2079 |
+
$link_class = 'tpg-post-link';
|
2080 |
}
|
2081 |
+
|
2082 |
+
$link_start = $readmore_link_start = sprintf(
|
2083 |
+
'<a data-id="%s" href="%s" class="%s" target="%s">',
|
2084 |
+
absint( $pID ),
|
2085 |
esc_url( get_permalink() ),
|
2086 |
+
esc_attr( $link_class ),
|
2087 |
+
esc_attr( $data['link_target'] )
|
2088 |
+
);
|
2089 |
+
$link_end = $readmore_link_end = '</a>';
|
2090 |
} elseif ( 'multi_popup' == $data['post_link_type'] ) {
|
2091 |
+
$link_class = 'tpg-multi-popup tpg-post-link';
|
2092 |
+
$link_start = $readmore_link_start = sprintf(
|
2093 |
+
'<a data-id="%s" href="%s" class="%s" target="%s">',
|
2094 |
+
absint( $pID ),
|
2095 |
+
esc_url( get_permalink() ),
|
2096 |
+
esc_attr( $link_class ),
|
2097 |
+
esc_attr( $data['link_target'] )
|
2098 |
+
);
|
2099 |
+
$link_end = $readmore_link_end = '</a>';
|
2100 |
} else {
|
2101 |
+
$link_class = 'tpg-post-link';
|
2102 |
+
$readmore_link_start = sprintf(
|
2103 |
+
'<a data-id="%s" href="%s" class="%s" target="%s">',
|
2104 |
+
absint( $pID ),
|
2105 |
+
esc_url( get_permalink() ),
|
2106 |
+
esc_attr( $link_class ),
|
2107 |
+
esc_attr( $data['link_target'] )
|
2108 |
+
);
|
2109 |
+
$readmore_link_end = '</a>';
|
2110 |
}
|
2111 |
|
2112 |
return [
|
2123 |
* @return string[]|\WP_Post_Type[]
|
2124 |
*/
|
2125 |
public static function get_post_types() {
|
2126 |
+
$post_types = get_post_types(
|
2127 |
+
[
|
2128 |
+
'public' => true,
|
2129 |
+
'show_in_nav_menus' => true,
|
2130 |
+
],
|
2131 |
+
'objects'
|
2132 |
+
);
|
2133 |
$post_types = wp_list_pluck( $post_types, 'label', 'name' );
|
2134 |
|
2135 |
$exclude = [ 'attachment', 'revision', 'nav_menu_item', 'elementor_library', 'tpg_builder' ];
|
2141 |
if ( ! rtTPG()->hasPro() ) {
|
2142 |
$post_types = [
|
2143 |
'post' => $post_types['post'],
|
2144 |
+
'page' => $post_types['page'],
|
2145 |
];
|
2146 |
}
|
2147 |
|
2158 |
*/
|
2159 |
public static function get_post_meta_html( $post_id, $data ) {
|
2160 |
global $post;
|
2161 |
+
|
2162 |
$author_id = $post->post_author;
|
2163 |
$author_name = get_the_author_meta( 'display_name', $post->post_author );
|
2164 |
$author = apply_filters( 'rttpg_author_link', sprintf( '<a href="%s">%s</a>', get_author_posts_url( $author_id ), $author_name ) );
|
2165 |
|
2166 |
$comments_number = get_comments_number( $post_id );
|
2167 |
+
$comment_label = '';
|
2168 |
|
|
|
|
|
2169 |
if ( isset( $data['show_comment_count_label'] ) && $data['show_comment_count_label'] ) {
|
2170 |
$comment_label = $data['comment_count_label_singular'];
|
2171 |
+
|
2172 |
if ( $comments_number > 1 ) {
|
2173 |
$comment_label = $data['comment_count_label_plural'];
|
2174 |
}
|
2177 |
$comments_text = sprintf( '%s (%s)', esc_html( $comment_label ), number_format_i18n( $comments_number ) );
|
2178 |
$date = get_the_date();
|
2179 |
|
2180 |
+
// Category and Tags Management.
|
2181 |
$_cat_id = isset( $data['post_type'] ) ? $data['post_type'] . '_taxonomy' : 'category';
|
2182 |
$_tag_id = isset( $data['post_type'] ) ? $data['post_type'] . '_tags' : 'post_tag';
|
2183 |
$categories = get_the_term_list( $post_id, $data[ $_cat_id ], null, '<span class="rt-separator">,</span>' );
|
2184 |
$tags = get_the_term_list( $post_id, $data[ $_tag_id ], null, '<span class="rt-separator">,</span>' );
|
2185 |
|
2186 |
+
$count_key = self::get_post_view_count_meta_key();
|
2187 |
$get_view_count = get_post_meta( $post_id, $count_key, true );
|
2188 |
|
2189 |
+
$meta_separator = ( $data['meta_separator'] && 'default' !== $data['meta_separator'] ) ? sprintf( "<span class='separator'>%s</span>", $data['meta_separator'] ) : null;
|
|
|
|
|
2190 |
|
2191 |
+
// Author Meta.
|
2192 |
|
2193 |
$post_meta_html = [];
|
2194 |
|
2200 |
$is_author_avatar = 'has-author-avatar';
|
2201 |
}
|
2202 |
?>
|
2203 |
+
<span class='author <?php echo esc_attr( $is_author_avatar ); ?>'>
|
2204 |
+
|
2205 |
+
<?php
|
2206 |
+
if ( '' !== $data['show_author_image'] ) {
|
2207 |
+
echo get_avatar( $author_id, 80 );
|
2208 |
+
} else {
|
2209 |
+
if ( $data['show_meta_icon'] === 'yes' ) {
|
2210 |
+
if ( isset( $data['user_icon']['value'] ) && $data['user_icon']['value'] ) {
|
2211 |
+
\Elementor\Icons_Manager::render_icon( $data['user_icon'], [ 'aria-hidden' => 'true' ] );
|
2212 |
+
} else {
|
2213 |
+
echo "<i class='fa fa-user'></i>";
|
2214 |
+
}
|
2215 |
+
}
|
2216 |
+
}
|
2217 |
+
|
2218 |
+
if ( $data['author_prefix'] ) {
|
2219 |
+
echo "<span class='author-prefix'>" . esc_html( $data['author_prefix'] ) . '</span>';
|
2220 |
+
}
|
2221 |
+
echo wp_kses( $author, self::allowedHtml() );
|
2222 |
+
?>
|
2223 |
+
</span>
|
2224 |
+
<?php
|
2225 |
+
echo wp_kses( $meta_separator, self::allowedHtml() );
|
2226 |
}
|
2227 |
|
2228 |
$post_meta_html['author'] = ob_get_clean();
|
2229 |
|
2230 |
ob_start();
|
2231 |
+
// Category Meta.
|
2232 |
+
|
2233 |
+
$category_condition = ( $categories && 'show' == $data['show_category'] && self::el_ignore_layout( $data ) && in_array( $data['category_position'], [ 'default', 'with_meta' ] ) );
|
2234 |
|
|
|
|
|
|
|
2235 |
if ( ! rtTPG()->hasPro() ) {
|
2236 |
$category_condition = ( $categories && 'show' == $data['show_category'] );
|
2237 |
}
|
2238 |
|
2239 |
+
if ( $category_condition ) {
|
2240 |
+
?>
|
2241 |
+
<span class='categories-links'>
|
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='fa fa-user'></i>";
|
2248 |
+
}
|
2249 |
+
}
|
2250 |
+
echo wp_kses( $categories, self::allowedHtml() );
|
2251 |
+
?>
|
2252 |
</span>
|
2253 |
<?php
|
2254 |
+
echo wp_kses( $meta_separator, self::allowedHtml() );
|
2255 |
}
|
2256 |
$post_meta_html['category'] = ob_get_clean();
|
2257 |
|
2258 |
ob_start();
|
2259 |
+
// Date Meta.
|
2260 |
if ( '' !== $data['show_date'] ) {
|
2261 |
$archive_year = get_the_date( 'Y' );
|
2262 |
$archive_month = get_the_date( 'm' );
|
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='fa fa-user'></i>";
|
2274 |
+
}
|
2275 |
+
}
|
2276 |
+
?>
|
2277 |
+
<a href="<?php echo esc_url( get_day_link( $archive_year, $archive_month, $archive_day ) ); ?>">
|
2278 |
+
<?php echo esc_html( $date ); ?>
|
2279 |
+
</a>
|
2280 |
+
</span>
|
2281 |
<?php
|
2282 |
+
echo wp_kses( $meta_separator, self::allowedHtml() );
|
2283 |
}
|
|
|
2284 |
|
2285 |
+
$post_meta_html['date'] = ob_get_clean();
|
2286 |
|
2287 |
ob_start();
|
2288 |
+
// Tags Meta.
|
2289 |
if ( $tags && 'show' == $data['show_tags'] ) {
|
2290 |
?>
|
2291 |
+
<span class='post-tags-links'>
|
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-user'></i>";
|
2298 |
+
}
|
2299 |
+
}
|
2300 |
+
echo wp_kses( $tags, self::allowedHtml() );
|
2301 |
+
?>
|
2302 |
+
</span>
|
2303 |
<?php
|
2304 |
+
echo wp_kses( $meta_separator, self::allowedHtml() );
|
2305 |
}
|
2306 |
$post_meta_html['tags'] = ob_get_clean();
|
2307 |
|
2308 |
ob_start();
|
2309 |
+
// Comment Meta.
|
2310 |
if ( 'show' == $data['show_comment_count'] ) {
|
2311 |
?>
|
2312 |
+
<span class="comment-count">
|
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='fa fa-user'></i>";
|
2319 |
+
}
|
2320 |
+
}
|
2321 |
+
echo wp_kses( $comments_text, self::allowedHtml() );
|
2322 |
+
?>
|
2323 |
+
</span>
|
2324 |
<?php
|
2325 |
+
echo wp_kses( $meta_separator, self::allowedHtml() );
|
2326 |
}
|
2327 |
|
2328 |
$post_meta_html['comment_count'] = ob_get_clean();
|
2329 |
|
2330 |
ob_start();
|
2331 |
+
// Post Count.
|
2332 |
if ( rtTPG()->hasPro() && 'show' == $data['show_post_count'] && ! empty( $get_view_count ) ) {
|
2333 |
?>
|
2334 |
+
<span class="post-count">
|
2335 |
+
<?php
|
2336 |
+
if ( $data['show_meta_icon'] === 'yes' ) {
|
2337 |
+
if ( isset( $data['post_count_icon']['value'] ) && $data['post_count_icon']['value'] ) {
|
2338 |
+
\Elementor\Icons_Manager::render_icon( $data['post_count_icon'], [ 'aria-hidden' => 'true' ] );
|
2339 |
+
} else {
|
2340 |
+
echo "<i class='fa fa-eye'></i>";
|
2341 |
+
}
|
2342 |
+
}
|
2343 |
+
echo wp_kses( $get_view_count, self::allowedHtml() );
|
2344 |
+
?>
|
2345 |
+
</span>
|
2346 |
<?php
|
2347 |
+
echo wp_kses( $meta_separator, self::allowedHtml() );
|
2348 |
}
|
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 |
foreach ( $meta_orering as $val ) {
|
2355 |
if ( isset( $post_meta_html[ $val['meta_name'] ] ) ) {
|
2356 |
+
echo wp_kses_post( $post_meta_html[ $val['meta_name'] ] );
|
2357 |
}
|
2358 |
}
|
2359 |
}
|
2395 |
|
2396 |
public static function get_el_post_title( $title_tag, $title, $link_start, $link_end, $data ) {
|
2397 |
echo '<div class="entry-title-wrapper">';
|
2398 |
+
|
2399 |
if ( rtTPG()->hasPro() && 'above_title' === $data['category_position'] || ! self::el_ignore_layout( $data ) ) {
|
2400 |
self::get_el_thumb_cat( $data, 'cat-above-title' );
|
2401 |
}
|
2402 |
+
|
2403 |
printf( '<%s class="entry-title">', esc_attr( $title_tag ) );
|
2404 |
+
self::print_html( $link_start );
|
2405 |
+
self::print_html( $title );
|
2406 |
+
self::print_html( $link_end );
|
2407 |
printf( '</%s>', esc_attr( $title_tag ) );
|
2408 |
echo '</div>';
|
2409 |
}
|
2412 |
if ( ! ( 'show' == $data['show_meta'] && 'show' == $data['show_category'] ) ) {
|
2413 |
return;
|
2414 |
}
|
2415 |
+
|
2416 |
$pID = get_the_ID();
|
2417 |
$_cat_id = $data['post_type'] . '_taxonomy';
|
2418 |
$categories = get_the_term_list( $pID, $data[ $_cat_id ], null, '<span class="rt-separator">,</span>' );
|
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 |
+
<div class="tpg-separate-category <?php echo esc_attr( $data['category_style'] . ' ' . $category_position . ' ' . $class ); ?>">
|
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 |
+
</div>
|
2431 |
<?php
|
2432 |
}
|
2433 |
|
2436 |
* Get first image from the content
|
2437 |
*
|
2438 |
* @param $post_id
|
2439 |
+
* @param string $type
|
2440 |
*
|
2441 |
* @return mixed|string
|
2442 |
*/
|
2443 |
public static function get_content_first_image( $post_id, $type = 'markup', $imgClass = '' ) {
|
2444 |
+
if ( $img = preg_match_all(
|
2445 |
+
'/<img.+src=[\'"]([^\'"]+)[\'"].*>/i',
|
2446 |
get_the_content( $post_id ),
|
2447 |
+
$matches
|
2448 |
+
)
|
2449 |
) {
|
2450 |
$imgSrc = $matches[1][0];
|
2451 |
$size = '';
|
2456 |
$info = getimagesize( $imgAbs );
|
2457 |
$size = isset( $info[3] ) ? $info[3] : '';
|
2458 |
}
|
2459 |
+
|
2460 |
$attachment_id = attachment_url_to_postid( $imgSrc );
|
2461 |
$alt_text = null;
|
2462 |
+
|
2463 |
if ( ! empty( $attachment_id ) ) {
|
2464 |
$alt_text = trim( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) );
|
2465 |
}
|
2466 |
+
|
2467 |
$alt = $alt_text ? $alt_text : get_the_title( $post_id );
|
2468 |
|
2469 |
if ( $type == 'markup' ) {
|
2485 |
* @param $data
|
2486 |
* @param $link_start
|
2487 |
* @param $link_end
|
2488 |
+
* @param false $offset_size
|
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 |
|
2505 |
if ( rtTPG()->hasPro() && $data['show_category'] == 'show' && $thumb_cat_condition && 'with_meta' !== $data['category_position'] ) {
|
2506 |
self::get_el_thumb_cat( $data );
|
2507 |
}
|
|
|
2508 |
|
2509 |
+
$img_link = get_the_post_thumbnail_url( $pID, 'full' );
|
2510 |
$img_size_key = 'image';
|
2511 |
|
|
|
2512 |
if ( $offset_size ) {
|
2513 |
$img_size_key = 'image_offset';
|
2514 |
}
|
2515 |
+
|
2516 |
$lazy_load = ( $data['prefix'] == 'slider' && $data['lazy_load'] == 'yes' ) ? true : false;
|
2517 |
$lazy_class = 'rt-img-responsive';
|
2518 |
+
|
2519 |
if ( $lazy_load ) {
|
2520 |
$lazy_class = 'swiper-lazy';
|
2521 |
}
|
2522 |
|
2523 |
+
echo 'yes' === $data['is_thumb_linked'] ? wp_kses( $link_start, self::allowedHtml() ) : null;
|
2524 |
+
|
2525 |
if ( has_post_thumbnail() && 'feature_image' === $data['media_source'] ) {
|
2526 |
$fImgSize = $data['image_size'];
|
2527 |
+
|
2528 |
if ( $offset_size ) {
|
2529 |
echo get_the_post_thumbnail( $pID, $data['image_offset'] );
|
2530 |
} else {
|
2532 |
$attachment_id = get_post_thumbnail_id( $pID );
|
2533 |
$thumb_info = wp_get_attachment_image_src( $attachment_id, $fImgSize );
|
2534 |
$thumb_alt = trim( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) );
|
2535 |
+
if ( $lazy_load ) {
|
2536 |
+
?>
|
2537 |
+
<img data-src="<?php echo esc_url( $thumb_info[0] ); ?>"
|
2538 |
+
src="#none"
|
2539 |
+
class="<?php echo esc_attr( $lazy_class ); ?>"
|
2540 |
+
width="<?php echo esc_attr( $thumb_info[1] ); ?>"
|
2541 |
+
height="<?php echo esc_attr( $thumb_info[2] ); ?>"
|
2542 |
+
alt="<?php echo esc_attr( $thumb_alt ? $thumb_alt : the_title() ); ?>">
|
2543 |
<?php
|
2544 |
+
} else {
|
2545 |
+
?>
|
2546 |
+
<img src="<?php echo esc_url( $thumb_info[0] ); ?>"
|
2547 |
+
class="<?php echo esc_attr( $lazy_class ); ?>"
|
2548 |
+
width="<?php echo esc_attr( $thumb_info[1] ); ?>"
|
2549 |
+
height="<?php echo esc_attr( $thumb_info[2] ); ?>"
|
2550 |
+
alt="<?php echo esc_attr( $thumb_alt ? $thumb_alt : the_title() ); ?>">
|
2551 |
<?php
|
2552 |
}
|
2553 |
?>
|
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' );
|
2565 |
+
|
2566 |
if ( $default_image_dimension[1] <= $data['image_custom_dimension']['width'] || $default_image_dimension[2] <= $data['image_custom_dimension']['height'] ) {
|
2567 |
$customImgSize = [];
|
2568 |
} else {
|
2571 |
$customImgSize[2] = $data['img_crop_style'];
|
2572 |
}
|
2573 |
}
|
2574 |
+
|
2575 |
+
echo wp_kses_post( self::getFeatureImageSrc( $pID, $fImgSize, $mediaSource, $defaultImgId, $customImgSize, $lazy_class ) );
|
2576 |
}
|
2577 |
}
|
2578 |
} elseif ( 'first_image' === $data['media_source'] && self::get_content_first_image( $pID ) ) {
|
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 |
|
2589 |
?>
|
2590 |
<?php if ( $lazy_load ) : ?>
|
2591 |
+
<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div>
|
2592 |
<?php endif; ?>
|
2593 |
|
2594 |
+
<?php echo 'yes' === $data['is_thumb_linked'] ? wp_kses( $link_end, self::allowedHtml() ) : null; ?>
|
2595 |
|
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 |
+
<a class="tpg-zoom"
|
2600 |
+
data-elementor-open-lightbox="yes"
|
2601 |
+
data-elementor-lightbox-slideshow="<?php echo esc_attr( $data['layout'] ); ?>"
|
2602 |
+
title="<?php echo esc_attr( get_the_title() ); ?>"
|
2603 |
+
href="<?php echo esc_url( $img_link ); ?>">
|
2604 |
+
|
2605 |
+
<?php
|
2606 |
+
if ( isset( $data['light_box_icon']['value'] ) && $data['light_box_icon']['value'] ) {
|
2607 |
+
\Elementor\Icons_Manager::render_icon( $data['light_box_icon'], [ 'aria-hidden' => 'true' ] );
|
2608 |
+
} else {
|
2609 |
+
echo "<i class='fa fa-plus'></i>";
|
2610 |
+
}
|
2611 |
+
?>
|
2612 |
+
</a>
|
2613 |
<?php endif; ?>
|
2614 |
+
<div class="overlay grid-hover-content"></div>
|
2615 |
<?php
|
2616 |
}
|
2617 |
|
2625 |
* @return bool
|
2626 |
*/
|
2627 |
public static function tpg_get_acf_data_elementor( $data, $pID, $return_type = true ) {
|
2628 |
+
if ( ! ( rtTPG()->hasPro() && self::is_acf() ) ) {
|
2629 |
return;
|
2630 |
}
|
2631 |
|
2639 |
];
|
2640 |
|
2641 |
if ( ! empty( $cf_group ) ) {
|
2642 |
+
$acf_html = "<div class='acf-custom-field-wrap'>";
|
2643 |
$acf_html .= Functions::get_cf_formatted_fields( $cf_group, $format, $pID );
|
2644 |
+
$acf_html .= '</div>';
|
2645 |
+
|
2646 |
if ( $return_type ) {
|
2647 |
+
self::print_html( $acf_html, true );
|
2648 |
} else {
|
2649 |
return $acf_html;
|
2650 |
}
|
2662 |
*/
|
2663 |
public static function is_filter_enable( $data ) {
|
2664 |
if ( rtTPG()->hasPro()
|
2665 |
+
&& ( $data['show_taxonomy_filter'] == 'show'
|
2666 |
+
|| $data['show_author_filter'] == 'show'
|
2667 |
+
|| $data['show_order_by'] == 'show'
|
2668 |
+
|| $data['show_sort_order'] == 'show'
|
2669 |
+
|| $data['show_search'] == 'show'
|
2670 |
+
|| ( $data['show_pagination'] == 'show' && $data['pagination_type'] != 'pagination' ) )
|
2671 |
) {
|
2672 |
return true;
|
2673 |
}
|
2675 |
return false;
|
2676 |
}
|
2677 |
|
2678 |
+
/**
|
2679 |
+
* Prints HTML.
|
2680 |
+
*
|
2681 |
+
* @param string $html HTML.
|
2682 |
+
* @param bool $allHtml All HTML.
|
2683 |
+
*
|
2684 |
+
* @return mixed
|
2685 |
+
*/
|
2686 |
+
public static function print_html( $html, $allHtml = false ) {
|
2687 |
+
if ( $allHtml ) {
|
2688 |
+
echo stripslashes_deep( $html );
|
2689 |
+
} else {
|
2690 |
+
echo wp_kses_post( stripslashes_deep( $html ) );
|
2691 |
+
}
|
2692 |
+
}
|
2693 |
+
|
2694 |
+
/**
|
2695 |
+
* Allowed HTML for wp_kses.
|
2696 |
+
*
|
2697 |
+
* @param string $level Tag level.
|
2698 |
+
*
|
2699 |
+
* @return mixed
|
2700 |
+
*/
|
2701 |
+
public static function allowedHtml( $level = 'basic' ) {
|
2702 |
+
$allowed_html = [];
|
2703 |
+
|
2704 |
+
switch ( $level ) {
|
2705 |
+
case 'basic':
|
2706 |
+
$allowed_html = [
|
2707 |
+
'b' => [
|
2708 |
+
'class' => [],
|
2709 |
+
'id' => [],
|
2710 |
+
],
|
2711 |
+
'i' => [
|
2712 |
+
'class' => [],
|
2713 |
+
'id' => [],
|
2714 |
+
],
|
2715 |
+
'u' => [
|
2716 |
+
'class' => [],
|
2717 |
+
'id' => [],
|
2718 |
+
],
|
2719 |
+
'br' => [
|
2720 |
+
'class' => [],
|
2721 |
+
'id' => [],
|
2722 |
+
],
|
2723 |
+
'em' => [
|
2724 |
+
'class' => [],
|
2725 |
+
'id' => [],
|
2726 |
+
],
|
2727 |
+
'span' => [
|
2728 |
+
'class' => [],
|
2729 |
+
'id' => [],
|
2730 |
+
],
|
2731 |
+
'strong' => [
|
2732 |
+
'class' => [],
|
2733 |
+
'id' => [],
|
2734 |
+
],
|
2735 |
+
'hr' => [
|
2736 |
+
'class' => [],
|
2737 |
+
'id' => [],
|
2738 |
+
],
|
2739 |
+
'a' => [
|
2740 |
+
'href' => [],
|
2741 |
+
'title' => [],
|
2742 |
+
'class' => [],
|
2743 |
+
'id' => [],
|
2744 |
+
'target' => [],
|
2745 |
+
],
|
2746 |
+
'div' => [
|
2747 |
+
'class' => [],
|
2748 |
+
'id' => [],
|
2749 |
+
],
|
2750 |
+
];
|
2751 |
+
break;
|
2752 |
+
|
2753 |
+
case 'advanced':
|
2754 |
+
$allowed_html = [
|
2755 |
+
'b' => [
|
2756 |
+
'class' => [],
|
2757 |
+
'id' => [],
|
2758 |
+
],
|
2759 |
+
'i' => [
|
2760 |
+
'class' => [],
|
2761 |
+
'id' => [],
|
2762 |
+
],
|
2763 |
+
'u' => [
|
2764 |
+
'class' => [],
|
2765 |
+
'id' => [],
|
2766 |
+
],
|
2767 |
+
'br' => [
|
2768 |
+
'class' => [],
|
2769 |
+
'id' => [],
|
2770 |
+
],
|
2771 |
+
'em' => [
|
2772 |
+
'class' => [],
|
2773 |
+
'id' => [],
|
2774 |
+
],
|
2775 |
+
'span' => [
|
2776 |
+
'class' => [],
|
2777 |
+
'id' => [],
|
2778 |
+
],
|
2779 |
+
'strong' => [
|
2780 |
+
'class' => [],
|
2781 |
+
'id' => [],
|
2782 |
+
],
|
2783 |
+
'hr' => [
|
2784 |
+
'class' => [],
|
2785 |
+
'id' => [],
|
2786 |
+
],
|
2787 |
+
'a' => [
|
2788 |
+
'href' => [],
|
2789 |
+
'title' => [],
|
2790 |
+
'class' => [],
|
2791 |
+
'id' => [],
|
2792 |
+
'data-id' => [],
|
2793 |
+
'target' => [],
|
2794 |
+
],
|
2795 |
+
'input' => [
|
2796 |
+
'type' => [],
|
2797 |
+
'name' => [],
|
2798 |
+
'class' => [],
|
2799 |
+
'value' => [],
|
2800 |
+
],
|
2801 |
+
];
|
2802 |
+
break;
|
2803 |
+
|
2804 |
+
case 'image':
|
2805 |
+
$allowed_html = [
|
2806 |
+
'img' => [
|
2807 |
+
'src' => [],
|
2808 |
+
'data-src' => [],
|
2809 |
+
'alt' => [],
|
2810 |
+
'height' => [],
|
2811 |
+
'width' => [],
|
2812 |
+
'class' => [],
|
2813 |
+
'id' => [],
|
2814 |
+
'style' => [],
|
2815 |
+
'srcset' => [],
|
2816 |
+
'loading' => [],
|
2817 |
+
'sizes' => [],
|
2818 |
+
],
|
2819 |
+
'div' => [
|
2820 |
+
'class' => [],
|
2821 |
+
],
|
2822 |
+
];
|
2823 |
+
break;
|
2824 |
+
|
2825 |
+
case 'anchor':
|
2826 |
+
$allowed_html = [
|
2827 |
+
'a' => [
|
2828 |
+
'href' => [],
|
2829 |
+
'title' => [],
|
2830 |
+
'class' => [],
|
2831 |
+
'id' => [],
|
2832 |
+
'style' => [],
|
2833 |
+
],
|
2834 |
+
];
|
2835 |
+
break;
|
2836 |
+
|
2837 |
+
default:
|
2838 |
+
// code...
|
2839 |
+
break;
|
2840 |
+
}
|
2841 |
+
|
2842 |
+
return $allowed_html;
|
2843 |
+
}
|
2844 |
+
|
2845 |
+
/**
|
2846 |
+
* Definition for wp_kses.
|
2847 |
+
*
|
2848 |
+
* @param string $string String to check.
|
2849 |
+
* @param string $level Tag level.
|
2850 |
+
*
|
2851 |
+
* @return mixed
|
2852 |
+
*/
|
2853 |
+
public static function htmlKses( $string, $level ) {
|
2854 |
+
if ( empty( $string ) ) {
|
2855 |
+
return;
|
2856 |
+
}
|
2857 |
+
|
2858 |
+
return wp_kses( $string, self::allowedHtml( $level ) );
|
2859 |
+
}
|
2860 |
+
}
|
app/Helpers/Install.php
CHANGED
@@ -1,9 +1,20 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
3 |
|
4 |
namespace RT\ThePostGrid\Helpers;
|
5 |
|
|
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
7 |
class Install {
|
8 |
|
9 |
public static function activate() {
|
@@ -17,6 +28,7 @@ class Install {
|
|
17 |
|
18 |
public static function insertDefaultData() {
|
19 |
update_option( rtTPG()->options['installed_version'], RT_THE_POST_GRID_VERSION );
|
|
|
20 |
if ( ! get_option( rtTPG()->options['settings'] ) ) {
|
21 |
update_option( rtTPG()->options['settings'], rtTPG()->defaultSettings );
|
22 |
}
|
@@ -24,9 +36,10 @@ class Install {
|
|
24 |
if ( get_option( 'elementor_experiment-e_optimized_assets_loading' ) ) {
|
25 |
update_option( 'elementor_experiment-e_optimized_assets_loading', 'default' );
|
26 |
}
|
|
|
27 |
if ( get_option( 'elementor_experiment-e_optimized_css_loading' ) ) {
|
28 |
update_option( 'elementor_experiment-e_optimized_css_loading', 'default' );
|
29 |
}
|
30 |
}
|
31 |
|
32 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Install Helper class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Helpers;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
+
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Install Helper class.
|
17 |
+
*/
|
18 |
class Install {
|
19 |
|
20 |
public static function activate() {
|
28 |
|
29 |
public static function insertDefaultData() {
|
30 |
update_option( rtTPG()->options['installed_version'], RT_THE_POST_GRID_VERSION );
|
31 |
+
|
32 |
if ( ! get_option( rtTPG()->options['settings'] ) ) {
|
33 |
update_option( rtTPG()->options['settings'], rtTPG()->defaultSettings );
|
34 |
}
|
36 |
if ( get_option( 'elementor_experiment-e_optimized_assets_loading' ) ) {
|
37 |
update_option( 'elementor_experiment-e_optimized_assets_loading', 'default' );
|
38 |
}
|
39 |
+
|
40 |
if ( get_option( 'elementor_experiment-e_optimized_css_loading' ) ) {
|
41 |
update_option( 'elementor_experiment-e_optimized_css_loading', 'default' );
|
42 |
}
|
43 |
}
|
44 |
|
45 |
+
}
|
app/Helpers/Options.php
CHANGED
@@ -1,17 +1,34 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Helpers;
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
class Options {
|
6 |
|
7 |
public static function rtPostTypes() {
|
8 |
-
$args = apply_filters(
|
9 |
-
|
|
|
|
|
|
|
|
|
10 |
);
|
11 |
|
12 |
$post_types = get_post_types( $args );
|
13 |
|
14 |
-
$exclude = [ 'attachment', 'revision', 'nav_menu_item','elementor_library', 'tpg_builder' ];
|
15 |
|
16 |
foreach ( $exclude as $ex ) {
|
17 |
unset( $post_types[ $ex ] );
|
@@ -20,7 +37,7 @@ class Options {
|
|
20 |
if ( ! rtTPG()->hasPro() ) {
|
21 |
$post_types = [
|
22 |
'post' => $post_types['post'],
|
23 |
-
'page' => $post_types['page']
|
24 |
];
|
25 |
}
|
26 |
|
@@ -30,43 +47,46 @@ class Options {
|
|
30 |
|
31 |
public static function rtPostOrders() {
|
32 |
return [
|
33 |
-
|
34 |
-
|
35 |
];
|
36 |
}
|
37 |
|
38 |
public static function rtTermOperators() {
|
39 |
return [
|
40 |
-
'IN' =>
|
41 |
-
'
|
42 |
-
|
43 |
-
|
44 |
-
'
|
|
|
|
|
|
|
|
|
45 |
];
|
46 |
}
|
47 |
|
48 |
public static function rtTermRelations() {
|
49 |
return [
|
50 |
-
'AND' =>
|
51 |
-
'OR' =>
|
52 |
];
|
53 |
}
|
54 |
|
55 |
public static function rtMetaKeyType() {
|
56 |
return [
|
57 |
-
'meta_value' =>
|
58 |
-
'meta_value_num' =>
|
59 |
-
'meta_value_datetime' =>
|
60 |
];
|
61 |
}
|
62 |
|
63 |
public static function rtPostOrderBy( $isWoCom = false, $metaOrder = false ) {
|
64 |
$orderBy = [
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
"menu_order" => __( "Menu Order", 'the-post-grid' ),
|
70 |
];
|
71 |
|
72 |
return apply_filters( 'rt_tpg_post_orderby', $orderBy, $isWoCom, $metaOrder );
|
@@ -76,22 +96,22 @@ class Options {
|
|
76 |
$settings = get_option( rtTPG()->options['settings'] );
|
77 |
|
78 |
return [
|
79 |
-
|
80 |
-
|
81 |
'type' => 'textarea',
|
82 |
'holderClass' => 'rt-script-wrapper full',
|
83 |
'id' => 'script-before-item-load',
|
84 |
'value' => isset( $settings['script_before_item_load'] ) ? stripslashes( $settings['script_before_item_load'] ) : null,
|
85 |
],
|
86 |
-
|
87 |
-
|
88 |
'type' => 'textarea',
|
89 |
'holderClass' => 'rt-script-wrapper full',
|
90 |
'id' => 'script-after-item-load',
|
91 |
'value' => isset( $settings['script_after_item_load'] ) ? stripslashes( $settings['script_after_item_load'] ) : null,
|
92 |
],
|
93 |
-
|
94 |
-
|
95 |
'type' => 'textarea',
|
96 |
'holderClass' => 'rt-script-wrapper full',
|
97 |
'id' => 'script-loaded',
|
@@ -104,10 +124,10 @@ class Options {
|
|
104 |
$settings = get_option( rtTPG()->options['settings'] );
|
105 |
|
106 |
$other_settings = [
|
107 |
-
'template_author'
|
108 |
'type' => 'select',
|
109 |
'name' => 'template_author',
|
110 |
-
'label' => 'Template Author',
|
111 |
'id' => 'template_author',
|
112 |
'holderClass' => 'pro-field',
|
113 |
'class' => 'select2',
|
@@ -115,10 +135,10 @@ class Options {
|
|
115 |
'options' => Fns::getTPGShortCodeList(),
|
116 |
'value' => isset( $settings['template_author'] ) ? $settings['template_author'] : [],
|
117 |
],
|
118 |
-
'template_category'
|
119 |
'type' => 'select',
|
120 |
'name' => 'template_category',
|
121 |
-
'label' => 'Template Category',
|
122 |
'id' => 'template_category',
|
123 |
'holderClass' => 'pro-field',
|
124 |
'class' => 'select2',
|
@@ -126,10 +146,10 @@ class Options {
|
|
126 |
'options' => Fns::getTPGShortCodeList(),
|
127 |
'value' => isset( $settings['template_category'] ) ? $settings['template_category'] : [],
|
128 |
],
|
129 |
-
'template_search'
|
130 |
'type' => 'select',
|
131 |
'name' => 'template_search',
|
132 |
-
'label' => 'Template Search',
|
133 |
'id' => 'template_search',
|
134 |
'holderClass' => 'pro-field',
|
135 |
'class' => 'select2',
|
@@ -137,10 +157,10 @@ class Options {
|
|
137 |
'options' => Fns::getTPGShortCodeList(),
|
138 |
'value' => isset( $settings['template_search'] ) ? $settings['template_search'] : [],
|
139 |
],
|
140 |
-
'template_tag'
|
141 |
'type' => 'select',
|
142 |
'name' => 'template_tag',
|
143 |
-
'label' => 'Template Tag',
|
144 |
'id' => 'template_tag',
|
145 |
'holderClass' => 'pro-field',
|
146 |
'class' => 'select2',
|
@@ -149,31 +169,31 @@ class Options {
|
|
149 |
'value' => isset( $settings['template_tag'] ) ? $settings['template_tag'] : [],
|
150 |
],
|
151 |
|
152 |
-
'tpg_primary_color_main'
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
],
|
158 |
|
159 |
'tpg_secondary_color_main' => [
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
],
|
165 |
|
166 |
-
'tpg_loader_color'
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
],
|
172 |
|
173 |
-
'template_class'
|
174 |
'type' => 'text',
|
175 |
'name' => 'template_class',
|
176 |
-
'label' => 'Template class',
|
177 |
'holderClass' => 'pro-field',
|
178 |
'id' => 'template_class',
|
179 |
'value' => isset( $settings['template_class'] ) ? $settings['template_class'] : '',
|
@@ -184,19 +204,19 @@ class Options {
|
|
184 |
|
185 |
if ( $plugin ) {
|
186 |
$acf_settings = [
|
187 |
-
'show_acf_details'
|
188 |
'type' => 'switch',
|
189 |
'name' => 'show_acf_details',
|
190 |
-
'label' =>
|
191 |
-
'description' =>
|
192 |
'holderClass' => 'pro-field',
|
193 |
'value' => isset( $settings['show_acf_details'] ) ? $settings['show_acf_details'] : false,
|
194 |
],
|
195 |
|
196 |
-
'cf_group_details'
|
197 |
'type' => 'checkbox',
|
198 |
'name' => 'cf_group_details',
|
199 |
-
'label' =>
|
200 |
'id' => 'cf_group_details',
|
201 |
'holderClass' => 'pro-field',
|
202 |
'alignment' => 'vertical',
|
@@ -208,16 +228,16 @@ class Options {
|
|
208 |
'cf_hide_empty_value_details' => [
|
209 |
'type' => 'switch',
|
210 |
'name' => 'cf_hide_empty_value_details',
|
211 |
-
'label' =>
|
212 |
'value' => isset( $settings['cf_hide_empty_value_details'] ) ? $settings['cf_hide_empty_value_details'] : false,
|
213 |
'holderClass' => 'pro-field',
|
214 |
],
|
215 |
|
216 |
-
'cf_show_only_value_details'
|
217 |
'type' => 'switch',
|
218 |
'name' => 'cf_show_only_value_details',
|
219 |
-
'label' =>
|
220 |
-
'description' =>
|
221 |
'value' => isset( $settings['cf_show_only_value_details'] ) ? $settings['cf_show_only_value_details'] : true,
|
222 |
'holderClass' => 'pro-field',
|
223 |
],
|
@@ -225,7 +245,7 @@ class Options {
|
|
225 |
'cf_hide_group_title_details' => [
|
226 |
'type' => 'switch',
|
227 |
'name' => 'cf_hide_group_title_details',
|
228 |
-
'label' =>
|
229 |
'value' => isset( $settings['cf_hide_group_title_details'] ) ? $settings['cf_hide_group_title_details'] : false,
|
230 |
'holderClass' => 'pro-field',
|
231 |
],
|
@@ -246,42 +266,46 @@ class Options {
|
|
246 |
'type' => 'heading',
|
247 |
'name' => 'tpg_common_settings_heading',
|
248 |
'class' => 'tpg_common_settings_heading',
|
249 |
-
'label' =>
|
250 |
-
'description' =>
|
251 |
],
|
252 |
|
253 |
-
'tpg_block_type'
|
254 |
'type' => 'select',
|
255 |
'name' => 'tpg_block_type',
|
256 |
'label' => 'Resource Load Type',
|
257 |
'id' => 'tpg_block_type',
|
258 |
'class' => 'select2',
|
259 |
'options' => [
|
260 |
-
'default' =>
|
261 |
-
'elementor' =>
|
262 |
-
'shortcode' =>
|
263 |
],
|
264 |
-
'description' =>
|
265 |
'value' => isset( $settings['tpg_block_type'] ) ? $settings['tpg_block_type'] : 'default',
|
266 |
],
|
267 |
-
'tpg_load_script'
|
268 |
'type' => 'switch',
|
269 |
'name' => 'tpg_load_script',
|
270 |
-
'label' =>
|
271 |
-
'description' =>
|
|
|
|
|
|
|
|
|
272 |
'value' => isset( $settings['tpg_load_script'] ) ? $settings['tpg_load_script'] : false,
|
273 |
],
|
274 |
-
'tpg_enable_preloader'
|
275 |
'type' => 'switch',
|
276 |
'name' => 'tpg_enable_preloader',
|
277 |
-
'label' =>
|
278 |
'value' => isset( $settings['tpg_enable_preloader'] ) ? $settings['tpg_enable_preloader'] : false,
|
279 |
],
|
280 |
-
'tpg_skip_fa'
|
281 |
'type' => 'switch',
|
282 |
'name' => 'tpg_skip_fa',
|
283 |
-
'label' =>
|
284 |
-
'description' =>
|
285 |
'value' => isset( $settings['tpg_skip_fa'] ) ? $settings['tpg_skip_fa'] : false,
|
286 |
],
|
287 |
];
|
@@ -292,23 +316,22 @@ class Options {
|
|
292 |
public static function rtTPGLicenceField() {
|
293 |
$settings = get_option( rtTPG()->options['settings'] );
|
294 |
$status = ! empty( $settings['license_status'] ) && $settings['license_status'] === 'valid' ? true : false;
|
295 |
-
$license_status = ! empty( $settings['license_key'] ) ? sprintf(
|
|
|
296 |
$status
|
297 |
-
? "<input type='submit' class='button-secondary rt-licensing-btn danger' name='license_deactivate' value='" .
|
298 |
-
|
299 |
-
: "<input type='submit' class='button-secondary rt-licensing-btn button-primary' name='license_activate' value='" . __( "Activate License", "the-post-grid" )
|
300 |
-
. "'/>"
|
301 |
) : ' ';
|
302 |
|
303 |
return [
|
304 |
-
|
305 |
-
'type'
|
306 |
-
'name'
|
307 |
-
'attr'
|
308 |
-
'label'
|
309 |
-
'
|
310 |
-
'id'
|
311 |
-
'value'
|
312 |
],
|
313 |
];
|
314 |
}
|
@@ -317,15 +340,15 @@ class Options {
|
|
317 |
$settings = get_option( rtTPG()->options['settings'] );
|
318 |
|
319 |
return [
|
320 |
-
|
321 |
'type' => 'checkbox',
|
322 |
'name' => 'social_share_items',
|
323 |
-
'label' => 'Social share items',
|
324 |
'id' => 'social_share_items',
|
325 |
'holderClass' => 'pro-field',
|
326 |
'alignment' => 'vertical',
|
327 |
'multiple' => true,
|
328 |
-
'options' =>
|
329 |
'value' => isset( $settings['social_share_items'] ) ? $settings['social_share_items'] : [],
|
330 |
],
|
331 |
];
|
@@ -333,53 +356,53 @@ class Options {
|
|
333 |
|
334 |
public static function socialShareItemList() {
|
335 |
return [
|
336 |
-
'facebook' => 'Facebook',
|
337 |
-
'twitter' => 'Twitter',
|
338 |
-
'linkedin' => 'LinkedIn',
|
339 |
-
'pinterest' => 'Pinterest',
|
340 |
-
'reddit' => 'Reddit',
|
341 |
-
'email' => 'Email',
|
342 |
];
|
343 |
}
|
344 |
|
345 |
public static function templateOverrideItemList() {
|
346 |
return [
|
347 |
-
'category-archive' =>
|
348 |
-
'tag-archive' =>
|
349 |
-
'author-archive' =>
|
350 |
-
'search' =>
|
351 |
];
|
352 |
}
|
353 |
|
354 |
public static function rtTPGCommonFilterFields() {
|
355 |
return [
|
356 |
'post__in' => [
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
],
|
363 |
'post__not_in' => [
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
],
|
370 |
'limit' => [
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
],
|
377 |
'offset' => [
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
],
|
384 |
];
|
385 |
}
|
@@ -387,205 +410,209 @@ class Options {
|
|
387 |
public static function rtTPGPostType() {
|
388 |
return [
|
389 |
'tpg_post_type' => [
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
],
|
396 |
];
|
397 |
}
|
398 |
|
399 |
public static function rtTPAdvanceFilters() {
|
400 |
-
$fields = apply_filters(
|
|
|
401 |
[
|
402 |
-
'tpg_taxonomy' =>
|
403 |
-
'order' =>
|
404 |
-
'author' =>
|
405 |
-
'tpg_post_status' =>
|
406 |
-
's' =>
|
407 |
-
]
|
|
|
408 |
|
409 |
return [
|
410 |
'post_filter' => [
|
411 |
-
'type' =>
|
412 |
-
'name' =>
|
413 |
-
'label' =>
|
414 |
-
|
415 |
-
|
416 |
'default' => [ 'tpg_taxonomy', 'order' ],
|
417 |
-
|
418 |
],
|
419 |
];
|
420 |
}
|
421 |
|
422 |
public static function rtTPGPostStatus() {
|
423 |
return [
|
424 |
-
'publish' => 'Publish',
|
425 |
-
'pending' => 'Pending',
|
426 |
-
'draft' => 'Draft',
|
427 |
-
'auto-draft' => 'Auto draft',
|
428 |
-
'future' => 'Future',
|
429 |
-
'private' => 'Private',
|
430 |
-
'inherit' => 'Inherit',
|
431 |
-
'trash' => 'Trash',
|
432 |
];
|
433 |
}
|
434 |
|
435 |
public static function owl_property() {
|
436 |
return [
|
437 |
-
'auto_play' => 'Auto Play',
|
438 |
-
'loop' => 'Loop',
|
439 |
-
'nav_button' => 'Nav Button',
|
440 |
-
'pagination' => 'Pagination',
|
441 |
-
'stop_hover' => 'Stop Hover',
|
442 |
-
'auto_height' => 'Auto Height',
|
443 |
-
'lazy_load' => 'Lazy Load',
|
444 |
-
'rtl' => 'Right to left (RTL)',
|
445 |
];
|
446 |
}
|
447 |
|
448 |
public static function rtTPGLayoutSettingFields() {
|
449 |
$options = [
|
450 |
'layout_type' => [
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
],
|
456 |
'layout' => [
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
],
|
463 |
'tgp_filter' => [
|
464 |
-
|
465 |
-
|
466 |
-
'holderClass' =>
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
],
|
471 |
'tgp_filter_taxonomy' => [
|
472 |
-
|
473 |
-
|
474 |
-
'holderClass' =>
|
475 |
-
|
476 |
-
|
477 |
],
|
478 |
'tgp_filter_taxonomy_hierarchical' => [
|
479 |
-
|
480 |
-
|
481 |
-
'holderClass' =>
|
482 |
-
|
483 |
],
|
484 |
'tgp_filter_type' => [
|
485 |
-
|
486 |
-
|
487 |
-
'holderClass' =>
|
488 |
-
|
489 |
-
|
490 |
],
|
491 |
'tgp_default_filter' => [
|
492 |
-
|
493 |
-
|
494 |
-
'holderClass' =>
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
],
|
499 |
'tpg_hide_all_button' => [
|
500 |
-
|
501 |
-
|
502 |
-
'holderClass' =>
|
503 |
-
|
504 |
],
|
505 |
'tpg_post_count' => [
|
506 |
-
|
507 |
-
|
508 |
-
'holderClass' =>
|
509 |
-
|
510 |
],
|
511 |
'isotope_filter' => [
|
512 |
-
|
513 |
-
|
514 |
-
'holderClass' =>
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
],
|
519 |
'isotope_default_filter' => [
|
520 |
-
|
521 |
-
|
522 |
-
'holderClass' =>
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
|
|
|
|
529 |
],
|
530 |
'tpg_show_all_text' => [
|
531 |
-
|
532 |
-
'holderClass' =>
|
533 |
-
|
534 |
-
|
535 |
],
|
536 |
'isotope_filter_dropdown' => [
|
537 |
-
|
538 |
-
|
539 |
-
'holderClass' =>
|
540 |
],
|
541 |
'isotope_filter_show_all' => [
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
'holderClass' =>
|
546 |
-
|
547 |
],
|
548 |
'isotope_filter_count' => [
|
549 |
-
|
550 |
-
|
551 |
-
'holderClass' =>
|
552 |
-
|
553 |
],
|
554 |
'isotope_filter_url' => [
|
555 |
-
|
556 |
-
|
557 |
-
'holderClass' =>
|
558 |
],
|
559 |
'isotope_search_filter' => [
|
560 |
-
|
561 |
-
|
562 |
-
'holderClass' =>
|
563 |
-
|
564 |
-
|
565 |
],
|
566 |
'carousel_property' => [
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
'holderClass' =>
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
],
|
576 |
'tpg_carousel_speed' => [
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
'default' => 250,
|
581 |
-
|
582 |
],
|
583 |
'tpg_carousel_autoplay_timeout' => [
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
'default' => 5000,
|
588 |
-
|
589 |
],
|
590 |
];
|
591 |
|
@@ -596,30 +623,30 @@ class Options {
|
|
596 |
$options = [
|
597 |
'column' => [
|
598 |
'type' => 'select',
|
599 |
-
'label' =>
|
600 |
'class' => 'rt-select2',
|
601 |
-
'holderClass' =>
|
602 |
'default' => 3,
|
603 |
'options' => self::scColumns(),
|
604 |
-
|
605 |
],
|
606 |
'tpg_tab_column' => [
|
607 |
'type' => 'select',
|
608 |
-
'label' =>
|
609 |
'class' => 'rt-select2',
|
610 |
-
'holderClass' =>
|
611 |
'default' => 2,
|
612 |
'options' => self::scColumns(),
|
613 |
-
|
614 |
],
|
615 |
'tpg_mobile_column' => [
|
616 |
'type' => 'select',
|
617 |
-
'label' =>
|
618 |
'class' => 'rt-select2',
|
619 |
-
'holderClass' =>
|
620 |
'default' => 1,
|
621 |
'options' => self::scColumns(),
|
622 |
-
|
623 |
],
|
624 |
];
|
625 |
|
@@ -629,74 +656,75 @@ class Options {
|
|
629 |
public static function layoutMiscSettings() {
|
630 |
$options = [
|
631 |
'pagination' => [
|
632 |
-
|
633 |
-
|
634 |
-
'holderClass' =>
|
635 |
-
|
636 |
-
|
637 |
-
|
|
|
638 |
],
|
639 |
'posts_per_page' => [
|
640 |
-
|
641 |
-
|
642 |
-
'holderClass' =>
|
643 |
-
|
644 |
-
|
645 |
],
|
646 |
'posts_loading_type' => [
|
647 |
-
|
648 |
-
|
649 |
-
'holderClass' =>
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
],
|
654 |
|
655 |
-
'load_more_text'
|
656 |
'type' => 'text',
|
657 |
'name' => 'load_more_text',
|
658 |
-
'label' => 'Load More Text',
|
659 |
'holderClass' => 'pagination-load-more-label tpg-hidden pro-field',
|
660 |
'id' => 'template_class',
|
661 |
'value' => isset( $settings['load_more_text'] ) ? $settings['load_more_text'] : '',
|
662 |
],
|
663 |
|
664 |
'link_to_detail_page' => [
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
],
|
670 |
'detail_page_link_type' => [
|
671 |
-
|
672 |
-
|
673 |
-
'holderClass' =>
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
'new_page' =>
|
678 |
-
'popup' =>
|
679 |
],
|
680 |
],
|
681 |
'popup_type' => [
|
682 |
-
|
683 |
-
|
684 |
-
'holderClass' =>
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
'single' =>
|
689 |
-
'multi' =>
|
690 |
],
|
691 |
],
|
692 |
'link_target' => [
|
693 |
-
|
694 |
-
|
695 |
-
'holderClass' =>
|
696 |
-
|
697 |
-
|
698 |
-
'' => 'Same Window',
|
699 |
-
'_blank' => 'New Window',
|
700 |
],
|
701 |
],
|
702 |
];
|
@@ -707,11 +735,11 @@ class Options {
|
|
707 |
public static function stickySettings() {
|
708 |
$options = [
|
709 |
'ignore_sticky_posts' => [
|
710 |
-
|
711 |
-
|
712 |
-
'holderClass' =>
|
713 |
-
|
714 |
-
|
715 |
],
|
716 |
];
|
717 |
|
@@ -720,34 +748,34 @@ class Options {
|
|
720 |
|
721 |
public static function scMarginOpt() {
|
722 |
return [
|
723 |
-
'default' =>
|
724 |
-
'no' =>
|
725 |
];
|
726 |
}
|
727 |
|
728 |
function scGridType() {
|
729 |
return [
|
730 |
-
'even' =>
|
731 |
-
'masonry' =>
|
732 |
];
|
733 |
}
|
734 |
|
735 |
public static function getTitleTags() {
|
736 |
return [
|
737 |
-
'h2' =>
|
738 |
-
'h3' =>
|
739 |
-
'h4' =>
|
740 |
];
|
741 |
}
|
742 |
|
743 |
public static function getHeadingTags() {
|
744 |
return [
|
745 |
-
'h1' =>
|
746 |
-
'h2' =>
|
747 |
-
'h3' =>
|
748 |
-
'h4' =>
|
749 |
-
'h5' =>
|
750 |
-
'h6' =>
|
751 |
];
|
752 |
}
|
753 |
|
@@ -755,54 +783,54 @@ class Options {
|
|
755 |
$settings = get_option( rtTPG()->options['settings'] );
|
756 |
|
757 |
$fields = [
|
758 |
-
|
759 |
'type' => 'checkbox',
|
760 |
-
'label' => 'Field Selection',
|
761 |
'id' => 'popup-fields',
|
762 |
'holderClass' => 'pro-field',
|
763 |
'alignment' => 'vertical',
|
764 |
'multiple' => true,
|
765 |
-
'options' =>
|
766 |
-
'default' => array_keys(
|
767 |
'value' => isset( $settings['popup_fields'] ) ? $settings['popup_fields'] : [],
|
768 |
],
|
769 |
];
|
770 |
$cf = Fns::is_acf();
|
771 |
if ( $cf ) {
|
772 |
$plist = self::getCFPluginList();
|
773 |
-
$pName = ! empty( $plist[ $cf ] ) ? $plist[ $cf ] :
|
774 |
$fields['cf_group'] = [
|
775 |
-
|
776 |
-
|
777 |
-
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
-
|
782 |
-
|
783 |
-
|
784 |
];
|
785 |
$fields['cf_hide_empty_value'] = [
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
];
|
792 |
$fields['cf_show_only_value'] = [
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
];
|
800 |
$fields['cf_hide_group_title'] = [
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
];
|
807 |
}
|
808 |
|
@@ -812,19 +840,23 @@ class Options {
|
|
812 |
public static function detailAvailableFields() {
|
813 |
$fields = self::rtTPGItemFields();
|
814 |
$inserted = [
|
815 |
-
'content' =>
|
816 |
-
'feature_img' =>
|
817 |
];
|
|
|
818 |
unset( $fields['heading'] );
|
819 |
unset( $fields['excerpt'] );
|
820 |
unset( $fields['read_more'] );
|
821 |
unset( $fields['comment_count'] );
|
|
|
822 |
$offset = array_search( 'title', array_keys( $fields ) ) + 1;
|
823 |
-
$newFields = array_slice( $fields, 0, $offset, true ) + $inserted + array_slice(
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
|
|
|
|
828 |
|
829 |
return $newFields;
|
830 |
}
|
@@ -841,30 +873,30 @@ class Options {
|
|
841 |
'default' => 'h2',
|
842 |
],
|
843 |
'tpg_heading_style' => [
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
'style1' => esc_html__(
|
850 |
-
'style2' => esc_html__(
|
851 |
-
'style3' => esc_html__(
|
852 |
],
|
853 |
],
|
854 |
'tpg_heading_alignment' => [
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
'left' => esc_html__(
|
861 |
-
'right' => esc_html__(
|
862 |
-
'center' => esc_html__(
|
863 |
],
|
864 |
],
|
865 |
'tpg_heading_link' => [
|
866 |
-
|
867 |
-
|
868 |
],
|
869 |
];
|
870 |
|
@@ -874,36 +906,36 @@ class Options {
|
|
874 |
public static function rtTPGSCCategorySettings() {
|
875 |
$fields = [
|
876 |
'tpg_category_position' => [
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
'above_title' => esc_html__(
|
884 |
-
'top_left' => esc_html__(
|
885 |
-
'top_right' => esc_html__(
|
886 |
-
'bottom_left' => esc_html__(
|
887 |
-
'bottom_right' => esc_html__(
|
888 |
-
'image_center' => esc_html__(
|
889 |
],
|
890 |
],
|
891 |
'tpg_category_style' => [
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
'style1' => esc_html__(
|
899 |
-
'style2' => esc_html__(
|
900 |
-
'style3' => esc_html__(
|
901 |
],
|
902 |
],
|
903 |
'tpg_category_icon' => [
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
],
|
908 |
];
|
909 |
|
@@ -913,17 +945,19 @@ class Options {
|
|
913 |
public static function rtTPGSCTitleSettings() {
|
914 |
$fields = [
|
915 |
'tpg_title_position' => [
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
'above' => esc_html__(
|
923 |
-
'below' => esc_html__(
|
924 |
],
|
925 |
-
|
926 |
-
'
|
|
|
|
|
927 |
],
|
928 |
'title_tag' => [
|
929 |
'type' => 'select',
|
@@ -935,16 +969,16 @@ class Options {
|
|
935 |
'default' => 'h3',
|
936 |
],
|
937 |
'tpg_title_limit' => [
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
],
|
942 |
'tpg_title_limit_type' => [
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
],
|
949 |
];
|
950 |
|
@@ -954,33 +988,33 @@ class Options {
|
|
954 |
public static function rtTPGSCMetaSettings() {
|
955 |
$fields = [
|
956 |
'tpg_meta_position' => [
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
'above_title' => esc_html__(
|
964 |
-
'above_excerpt' => esc_html__(
|
965 |
-
'below_excerpt' => esc_html__(
|
966 |
],
|
967 |
],
|
968 |
'tpg_meta_icon' => [
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
],
|
973 |
'tpg_meta_separator' => [
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
-
|
979 |
-
'dot' => esc_html__(
|
980 |
-
's_slash' => esc_html__(
|
981 |
-
'd_slash' => esc_html__(
|
982 |
-
'hypen' => esc_html__(
|
983 |
-
'v_pipe' => esc_html__(
|
984 |
],
|
985 |
],
|
986 |
];
|
@@ -991,66 +1025,66 @@ class Options {
|
|
991 |
public static function rtTPGSCImageSettings() {
|
992 |
$fields = [
|
993 |
'feature_image' => [
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
],
|
999 |
'featured_image_size' => [
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
1003 |
-
'holderClass' =>
|
1004 |
-
|
1005 |
],
|
1006 |
'custom_image_size' => [
|
1007 |
-
|
1008 |
-
|
1009 |
-
'holderClass' =>
|
1010 |
-
|
1011 |
],
|
1012 |
'media_source' => [
|
1013 |
-
|
1014 |
-
|
1015 |
-
|
1016 |
-
|
1017 |
-
'holderClass' =>
|
1018 |
-
|
1019 |
],
|
1020 |
'tgp_layout2_image_column' => [
|
1021 |
'type' => 'select',
|
1022 |
'label' => esc_html__( 'Image column', 'the-post-grid' ),
|
1023 |
'class' => 'rt-select2',
|
1024 |
-
'holderClass' =>
|
1025 |
'default' => 4,
|
1026 |
'options' => self::scColumns(),
|
1027 |
-
|
1028 |
],
|
1029 |
'tpg_image_type' => [
|
1030 |
-
|
1031 |
-
|
1032 |
-
|
1033 |
-
'holderClass' =>
|
1034 |
-
|
1035 |
-
|
1036 |
],
|
1037 |
'tpg_image_animation' => [
|
1038 |
-
|
1039 |
-
|
1040 |
-
|
1041 |
-
|
1042 |
-
|
1043 |
'img_zoom_in' => esc_html__( 'Zoom in', 'the-post-grid' ),
|
1044 |
'img_zoom_out' => esc_html__( 'Zoom out', 'the-post-grid' ),
|
1045 |
'img_no_effect' => esc_html__( 'None', 'the-post-grid' ),
|
1046 |
],
|
1047 |
],
|
1048 |
'tpg_image_border_radius' => [
|
1049 |
-
|
1050 |
-
|
1051 |
-
'holderClass' =>
|
1052 |
-
|
1053 |
-
|
1054 |
],
|
1055 |
];
|
1056 |
|
@@ -1060,22 +1094,22 @@ class Options {
|
|
1060 |
public static function rtTPGSCExcerptSettings() {
|
1061 |
$fields = [
|
1062 |
'excerpt_limit' => [
|
1063 |
-
|
1064 |
-
|
1065 |
-
|
1066 |
-
|
1067 |
],
|
1068 |
'tgp_excerpt_type' => [
|
1069 |
-
|
1070 |
-
|
1071 |
-
|
1072 |
-
|
1073 |
-
|
1074 |
],
|
1075 |
'tgp_excerpt_more_text' => [
|
1076 |
-
|
1077 |
-
|
1078 |
-
|
1079 |
],
|
1080 |
];
|
1081 |
|
@@ -1085,25 +1119,25 @@ class Options {
|
|
1085 |
public static function rtTPGSCButtonSettings() {
|
1086 |
$fields = [
|
1087 |
'tpg_read_more_button_border_radius' => [
|
1088 |
-
|
1089 |
-
|
1090 |
-
|
1091 |
-
|
1092 |
],
|
1093 |
'tpg_read_more_button_alignment' => [
|
1094 |
-
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
'left' => esc_html__(
|
1100 |
-
'right' => esc_html__(
|
1101 |
-
'center' => esc_html__(
|
1102 |
],
|
1103 |
],
|
1104 |
'tgp_read_more_text' => [
|
1105 |
-
|
1106 |
-
|
1107 |
],
|
1108 |
];
|
1109 |
|
@@ -1113,16 +1147,16 @@ class Options {
|
|
1113 |
public static function rtTPGStyleFields() {
|
1114 |
$fields = [
|
1115 |
'parent_class' => [
|
1116 |
-
|
1117 |
-
|
1118 |
-
|
1119 |
-
|
1120 |
],
|
1121 |
'primary_color' => [
|
1122 |
-
|
1123 |
-
|
1124 |
-
|
1125 |
-
|
1126 |
],
|
1127 |
];
|
1128 |
|
@@ -1133,31 +1167,31 @@ class Options {
|
|
1133 |
$fields = [
|
1134 |
|
1135 |
'button_bg_color' => [
|
1136 |
-
|
1137 |
-
|
1138 |
-
|
1139 |
-
|
1140 |
],
|
1141 |
'button_hover_bg_color' => [
|
1142 |
-
|
1143 |
-
|
1144 |
-
|
1145 |
-
|
1146 |
],
|
1147 |
'button_active_bg_color' => [
|
1148 |
-
|
1149 |
-
|
1150 |
-
|
1151 |
],
|
1152 |
'button_text_bg_color' => [
|
1153 |
-
|
1154 |
-
|
1155 |
-
|
1156 |
],
|
1157 |
'button_hover_text_color' => [
|
1158 |
-
|
1159 |
-
|
1160 |
-
|
1161 |
],
|
1162 |
];
|
1163 |
|
@@ -1167,37 +1201,37 @@ class Options {
|
|
1167 |
public static function rtTPGStyleHeading() {
|
1168 |
$fields = [
|
1169 |
'tpg_heading_bg' => [
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
],
|
1174 |
'tpg_heading_color' => [
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
],
|
1179 |
'tpg_heading_border_color' => [
|
1180 |
-
|
1181 |
-
|
1182 |
-
|
1183 |
],
|
1184 |
'tpg_heading_border_size' => [
|
1185 |
-
|
1186 |
-
|
1187 |
-
|
1188 |
-
|
1189 |
],
|
1190 |
'tpg_heading_margin' => [
|
1191 |
-
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
1195 |
],
|
1196 |
'tpg_heading_padding' => [
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
],
|
1202 |
];
|
1203 |
|
@@ -1207,21 +1241,21 @@ class Options {
|
|
1207 |
public static function rtTPGStyleFullArea() {
|
1208 |
$fields = [
|
1209 |
'tpg_full_area_bg' => [
|
1210 |
-
|
1211 |
-
|
1212 |
-
|
1213 |
],
|
1214 |
'tpg_full_area_margin' => [
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
],
|
1220 |
'tpg_full_area_padding' => [
|
1221 |
-
|
1222 |
-
|
1223 |
-
|
1224 |
-
|
1225 |
],
|
1226 |
];
|
1227 |
|
@@ -1231,42 +1265,42 @@ class Options {
|
|
1231 |
public static function rtTPGStyleContentWrap() {
|
1232 |
$fields = [
|
1233 |
'tpg_content_wrap_bg' => [
|
1234 |
-
|
1235 |
-
|
1236 |
-
|
1237 |
],
|
1238 |
'tpg_content_wrap_shadow' => [
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
],
|
1243 |
'tpg_content_wrap_border_color' => [
|
1244 |
-
|
1245 |
-
|
1246 |
-
|
1247 |
],
|
1248 |
'tpg_content_wrap_border' => [
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
],
|
1254 |
'tpg_content_wrap_border_radius' => [
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
],
|
1259 |
'tpg_box_padding' => [
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
],
|
1265 |
'tpg_content_padding' => [
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
],
|
1271 |
];
|
1272 |
|
@@ -1276,39 +1310,39 @@ class Options {
|
|
1276 |
public static function rtTPGStyleCategory() {
|
1277 |
$fields = [
|
1278 |
'tpg_category_bg' => [
|
1279 |
-
|
1280 |
-
|
1281 |
-
|
1282 |
],
|
1283 |
'tpg_category_color' => [
|
1284 |
-
|
1285 |
-
|
1286 |
-
|
1287 |
],
|
1288 |
'tpg_category_border_radius' => [
|
1289 |
-
|
1290 |
-
|
1291 |
-
|
1292 |
-
|
1293 |
],
|
1294 |
'tpg_category_margin' => [
|
1295 |
-
|
1296 |
-
|
1297 |
-
|
1298 |
-
|
1299 |
],
|
1300 |
'tpg_category_padding' => [
|
1301 |
-
|
1302 |
-
|
1303 |
-
|
1304 |
-
|
1305 |
],
|
1306 |
'rt_tpg_category_font_size' => [
|
1307 |
-
|
1308 |
-
|
1309 |
-
|
1310 |
-
|
1311 |
-
|
1312 |
],
|
1313 |
];
|
1314 |
|
@@ -1323,14 +1357,14 @@ class Options {
|
|
1323 |
|
1324 |
$fields = [
|
1325 |
'item_fields' => [
|
1326 |
-
|
1327 |
-
|
1328 |
-
|
1329 |
-
|
1330 |
-
|
1331 |
-
|
1332 |
-
|
1333 |
-
|
1334 |
],
|
1335 |
];
|
1336 |
if ( $cf = Fns::is_acf() ) {
|
@@ -1338,34 +1372,34 @@ class Options {
|
|
1338 |
$post_type = get_post_meta( $post->ID, 'tpg_post_type', true );
|
1339 |
$plist = self::getCFPluginList();
|
1340 |
$fields['cf_group'] = [
|
1341 |
-
|
1342 |
-
|
1343 |
-
|
1344 |
-
|
1345 |
-
|
1346 |
-
|
1347 |
-
|
1348 |
-
|
1349 |
];
|
1350 |
$fields['cf_hide_empty_value'] = [
|
1351 |
-
|
1352 |
-
|
1353 |
-
|
1354 |
-
|
1355 |
-
|
1356 |
];
|
1357 |
$fields['cf_show_only_value'] = [
|
1358 |
-
|
1359 |
-
|
1360 |
-
|
1361 |
-
|
1362 |
-
|
1363 |
];
|
1364 |
$fields['cf_hide_group_title'] = [
|
1365 |
-
|
1366 |
-
|
1367 |
-
|
1368 |
-
|
1369 |
];
|
1370 |
}
|
1371 |
|
@@ -1375,31 +1409,31 @@ class Options {
|
|
1375 |
|
1376 |
public static function getCFPluginList() {
|
1377 |
return [
|
1378 |
-
'acf' =>
|
1379 |
];
|
1380 |
}
|
1381 |
|
1382 |
public static function rtMediaSource() {
|
1383 |
return [
|
1384 |
-
|
1385 |
-
|
1386 |
];
|
1387 |
}
|
1388 |
|
1389 |
public static function get_image_types() {
|
1390 |
return [
|
1391 |
-
'normal' =>
|
1392 |
-
'circle' =>
|
1393 |
];
|
1394 |
}
|
1395 |
|
1396 |
public static function get_limit_type( $content = null ) {
|
1397 |
$types = [
|
1398 |
-
'character' =>
|
1399 |
-
'word' =>
|
1400 |
];
|
1401 |
if ( $content === 'content' ) {
|
1402 |
-
$types['full'] =
|
1403 |
}
|
1404 |
|
1405 |
return apply_filters( 'tpg_limit_type', $types, $content );
|
@@ -1407,55 +1441,55 @@ class Options {
|
|
1407 |
|
1408 |
public static function scColumns() {
|
1409 |
return [
|
1410 |
-
1 =>
|
1411 |
-
2 =>
|
1412 |
-
3 =>
|
1413 |
-
4 =>
|
1414 |
-
5 =>
|
1415 |
-
6 =>
|
1416 |
];
|
1417 |
}
|
1418 |
|
1419 |
public static function tgp_filter_list() {
|
1420 |
return [
|
1421 |
-
'_taxonomy_filter' =>
|
1422 |
-
'_author_filter' =>
|
1423 |
-
'_order_by' =>
|
1424 |
-
'_sort_order' =>
|
1425 |
-
'_search' =>
|
1426 |
];
|
1427 |
}
|
1428 |
|
1429 |
public static function overflowOpacity() {
|
1430 |
return [
|
1431 |
-
1 => '10%',
|
1432 |
-
2 => '20%',
|
1433 |
-
3 => '30%',
|
1434 |
-
4 => '40%',
|
1435 |
-
5 => '50%',
|
1436 |
-
6 => '60%',
|
1437 |
-
7 => '70%',
|
1438 |
-
8 => '80%',
|
1439 |
-
9 => '90%',
|
1440 |
];
|
1441 |
}
|
1442 |
|
1443 |
public static function rtTPGLayoutType() {
|
1444 |
$layoutType = [
|
1445 |
'grid' => [
|
1446 |
-
'title' =>
|
1447 |
'img' => rtTPG()->get_assets_uri( 'images/grid.png' ),
|
1448 |
],
|
1449 |
'grid_hover' => [
|
1450 |
-
'title' =>
|
1451 |
'img' => rtTPG()->get_assets_uri( 'images/grid_hover.png' ),
|
1452 |
],
|
1453 |
'list' => [
|
1454 |
-
'title' =>
|
1455 |
'img' => rtTPG()->get_assets_uri( 'images/list.png' ),
|
1456 |
],
|
1457 |
'isotope' => [
|
1458 |
-
'title' =>
|
1459 |
'img' => rtTPG()->get_assets_uri( 'images/isotope.png' ),
|
1460 |
],
|
1461 |
];
|
@@ -1466,49 +1500,49 @@ class Options {
|
|
1466 |
public static function rtTPGLayouts() {
|
1467 |
$layouts = [
|
1468 |
'layout1' => [
|
1469 |
-
'title' =>
|
1470 |
'layout' => 'grid',
|
1471 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/',
|
1472 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid1.png' ),
|
1473 |
],
|
1474 |
'layout12' => [
|
1475 |
-
'title' => esc_html__(
|
1476 |
'layout' => 'grid',
|
1477 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/grid-layout-2/',
|
1478 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid10.png' ),
|
1479 |
],
|
1480 |
'layout5' => [
|
1481 |
-
'title' =>
|
1482 |
'layout' => 'grid_hover',
|
1483 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-1/',
|
1484 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid3.png' ),
|
1485 |
],
|
1486 |
'layout6' => [
|
1487 |
-
'title' => esc_html__(
|
1488 |
'layout' => 'grid_hover',
|
1489 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-2/',
|
1490 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid4.png' ),
|
1491 |
],
|
1492 |
'layout7' => [
|
1493 |
-
'title' => esc_html__(
|
1494 |
'layout' => 'grid_hover',
|
1495 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-3/',
|
1496 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid5.png' ),
|
1497 |
],
|
1498 |
'layout2' => [
|
1499 |
-
'title' =>
|
1500 |
'layout' => 'list',
|
1501 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/list-layout-1/',
|
1502 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/list1.png' ),
|
1503 |
],
|
1504 |
'layout3' => [
|
1505 |
-
'title' =>
|
1506 |
'layout' => 'list',
|
1507 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/list-layout-rounded-image/',
|
1508 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/list2.png' ),
|
1509 |
],
|
1510 |
'isotope1' => [
|
1511 |
-
'title' =>
|
1512 |
'layout' => 'isotope',
|
1513 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/layout-4-filter/',
|
1514 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/isotope1.png' ),
|
@@ -1520,48 +1554,52 @@ class Options {
|
|
1520 |
|
1521 |
public static function rtTPGItemFields() {
|
1522 |
$items = [
|
1523 |
-
'heading' =>
|
1524 |
-
'title' =>
|
1525 |
-
'excerpt' =>
|
1526 |
-
'read_more' =>
|
1527 |
-
'post_date' =>
|
1528 |
-
'author' =>
|
1529 |
-
'categories' =>
|
1530 |
-
'tags' =>
|
1531 |
-
'comment_count' =>
|
1532 |
];
|
1533 |
|
1534 |
return apply_filters( 'tpg_field_selection_items', $items );
|
1535 |
}
|
1536 |
|
1537 |
public static function postLoadingType() {
|
1538 |
-
return apply_filters(
|
|
|
1539 |
[
|
1540 |
-
'pagination' =>
|
1541 |
-
]
|
|
|
1542 |
}
|
1543 |
|
1544 |
public static function scGridOpt() {
|
1545 |
return [
|
1546 |
-
'even' =>
|
1547 |
-
'masonry' =>
|
1548 |
];
|
1549 |
}
|
1550 |
|
1551 |
public static function extraStyle() {
|
1552 |
-
return apply_filters(
|
|
|
1553 |
[
|
1554 |
-
'title' =>
|
1555 |
-
'title_hover' =>
|
1556 |
-
'excerpt' =>
|
1557 |
-
'meta_data' =>
|
1558 |
-
]
|
|
|
1559 |
}
|
1560 |
|
1561 |
public static function scFontSize() {
|
1562 |
$num = [];
|
1563 |
for ( $i = 10; $i <= 50; $i ++ ) {
|
1564 |
-
$num[ $i ] = $i .
|
1565 |
}
|
1566 |
|
1567 |
return $num;
|
@@ -1569,86 +1607,84 @@ class Options {
|
|
1569 |
|
1570 |
public static function scAlignment() {
|
1571 |
return [
|
1572 |
-
'left' =>
|
1573 |
-
'right' =>
|
1574 |
-
'center' =>
|
1575 |
-
'justify' =>
|
1576 |
];
|
1577 |
}
|
1578 |
|
1579 |
public static function scReadMoreButtonPositionList() {
|
1580 |
return [
|
1581 |
-
'left' =>
|
1582 |
-
'right' =>
|
1583 |
-
'center' =>
|
1584 |
];
|
1585 |
}
|
1586 |
|
1587 |
|
1588 |
public static function scTextWeight() {
|
1589 |
return [
|
1590 |
-
'normal' =>
|
1591 |
-
'bold' =>
|
1592 |
-
'bolder' =>
|
1593 |
-
'lighter' =>
|
1594 |
-
'inherit' =>
|
1595 |
-
'initial' =>
|
1596 |
-
'unset' =>
|
1597 |
-
100 => '100',
|
1598 |
-
200 => '200',
|
1599 |
-
300 => '300',
|
1600 |
-
400 => '400',
|
1601 |
-
500 => '500',
|
1602 |
-
600 => '600',
|
1603 |
-
700 => '700',
|
1604 |
-
800 => '800',
|
1605 |
-
900 => '900',
|
1606 |
];
|
1607 |
}
|
1608 |
|
1609 |
public static function imageCropType() {
|
1610 |
return [
|
1611 |
-
'soft' =>
|
1612 |
-
'hard' =>
|
1613 |
];
|
1614 |
}
|
1615 |
|
1616 |
public static function rt_filter_type() {
|
1617 |
return [
|
1618 |
-
'dropdown' =>
|
1619 |
-
'button' =>
|
1620 |
];
|
1621 |
}
|
1622 |
|
1623 |
public static function get_pro_feature_list() {
|
1624 |
return '<ol>
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
. '</a>';
|
1652 |
}
|
1653 |
-
|
1654 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Options Helper class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Helpers;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Options Helper class.
|
17 |
+
*/
|
18 |
class Options {
|
19 |
|
20 |
public static function rtPostTypes() {
|
21 |
+
$args = apply_filters(
|
22 |
+
'tpg_get_post_type',
|
23 |
+
[
|
24 |
+
'public' => true,
|
25 |
+
'show_in_nav_menus' => true,
|
26 |
+
]
|
27 |
);
|
28 |
|
29 |
$post_types = get_post_types( $args );
|
30 |
|
31 |
+
$exclude = [ 'attachment', 'revision', 'nav_menu_item', 'elementor_library', 'tpg_builder' ];
|
32 |
|
33 |
foreach ( $exclude as $ex ) {
|
34 |
unset( $post_types[ $ex ] );
|
37 |
if ( ! rtTPG()->hasPro() ) {
|
38 |
$post_types = [
|
39 |
'post' => $post_types['post'],
|
40 |
+
'page' => $post_types['page'],
|
41 |
];
|
42 |
}
|
43 |
|
47 |
|
48 |
public static function rtPostOrders() {
|
49 |
return [
|
50 |
+
'ASC' => esc_html__( 'Ascending', 'the-post-grid' ),
|
51 |
+
'DESC' => esc_html__( 'Descending', 'the-post-grid' ),
|
52 |
];
|
53 |
}
|
54 |
|
55 |
public static function rtTermOperators() {
|
56 |
return [
|
57 |
+
'IN' => esc_html__(
|
58 |
+
'IN — show posts which associate with one or more of selected terms',
|
59 |
+
'the-post-grid'
|
60 |
+
),
|
61 |
+
'NOT IN' => esc_html__(
|
62 |
+
'NOT IN — show posts which do not associate with any of selected terms',
|
63 |
+
'the-post-grid'
|
64 |
+
),
|
65 |
+
'AND' => esc_html__( 'AND — show posts which associate with all of selected terms', 'the-post-grid' ),
|
66 |
];
|
67 |
}
|
68 |
|
69 |
public static function rtTermRelations() {
|
70 |
return [
|
71 |
+
'AND' => esc_html__( 'AND — show posts which match all settings', 'the-post-grid' ),
|
72 |
+
'OR' => esc_html__( 'OR — show posts which match one or more settings', 'the-post-grid' ),
|
73 |
];
|
74 |
}
|
75 |
|
76 |
public static function rtMetaKeyType() {
|
77 |
return [
|
78 |
+
'meta_value' => esc_html__( 'Meta value', 'the-post-grid' ),
|
79 |
+
'meta_value_num' => esc_html__( 'Meta value number', 'the-post-grid' ),
|
80 |
+
'meta_value_datetime' => esc_html__( 'Meta value datetime', 'the-post-grid' ),
|
81 |
];
|
82 |
}
|
83 |
|
84 |
public static function rtPostOrderBy( $isWoCom = false, $metaOrder = false ) {
|
85 |
$orderBy = [
|
86 |
+
'title' => esc_html__( 'Title', 'the-post-grid' ),
|
87 |
+
'date' => esc_html__( 'Created date', 'the-post-grid' ),
|
88 |
+
'modified' => esc_html__( 'Modified date', 'the-post-grid' ),
|
89 |
+
'menu_order' => esc_html__( 'Menu Order', 'the-post-grid' ),
|
|
|
90 |
];
|
91 |
|
92 |
return apply_filters( 'rt_tpg_post_orderby', $orderBy, $isWoCom, $metaOrder );
|
96 |
$settings = get_option( rtTPG()->options['settings'] );
|
97 |
|
98 |
return [
|
99 |
+
'script_before_item_load' => [
|
100 |
+
'label' => esc_html__( 'Script before item load', 'the-post-grid' ),
|
101 |
'type' => 'textarea',
|
102 |
'holderClass' => 'rt-script-wrapper full',
|
103 |
'id' => 'script-before-item-load',
|
104 |
'value' => isset( $settings['script_before_item_load'] ) ? stripslashes( $settings['script_before_item_load'] ) : null,
|
105 |
],
|
106 |
+
'script_after_item_load' => [
|
107 |
+
'label' => esc_html__( 'Script After item load', 'the-post-grid' ),
|
108 |
'type' => 'textarea',
|
109 |
'holderClass' => 'rt-script-wrapper full',
|
110 |
'id' => 'script-after-item-load',
|
111 |
'value' => isset( $settings['script_after_item_load'] ) ? stripslashes( $settings['script_after_item_load'] ) : null,
|
112 |
],
|
113 |
+
'script_loaded' => [
|
114 |
+
'label' => esc_html__( 'After Loaded script', 'the-post-grid' ),
|
115 |
'type' => 'textarea',
|
116 |
'holderClass' => 'rt-script-wrapper full',
|
117 |
'id' => 'script-loaded',
|
124 |
$settings = get_option( rtTPG()->options['settings'] );
|
125 |
|
126 |
$other_settings = [
|
127 |
+
'template_author' => [
|
128 |
'type' => 'select',
|
129 |
'name' => 'template_author',
|
130 |
+
'label' => esc_html__( 'Template Author', 'the-post-grid' ),
|
131 |
'id' => 'template_author',
|
132 |
'holderClass' => 'pro-field',
|
133 |
'class' => 'select2',
|
135 |
'options' => Fns::getTPGShortCodeList(),
|
136 |
'value' => isset( $settings['template_author'] ) ? $settings['template_author'] : [],
|
137 |
],
|
138 |
+
'template_category' => [
|
139 |
'type' => 'select',
|
140 |
'name' => 'template_category',
|
141 |
+
'label' => esc_html__( 'Template Category', 'the-post-grid' ),
|
142 |
'id' => 'template_category',
|
143 |
'holderClass' => 'pro-field',
|
144 |
'class' => 'select2',
|
146 |
'options' => Fns::getTPGShortCodeList(),
|
147 |
'value' => isset( $settings['template_category'] ) ? $settings['template_category'] : [],
|
148 |
],
|
149 |
+
'template_search' => [
|
150 |
'type' => 'select',
|
151 |
'name' => 'template_search',
|
152 |
+
'label' => esc_html__( 'Template Search', 'the-post-grid' ),
|
153 |
'id' => 'template_search',
|
154 |
'holderClass' => 'pro-field',
|
155 |
'class' => 'select2',
|
157 |
'options' => Fns::getTPGShortCodeList(),
|
158 |
'value' => isset( $settings['template_search'] ) ? $settings['template_search'] : [],
|
159 |
],
|
160 |
+
'template_tag' => [
|
161 |
'type' => 'select',
|
162 |
'name' => 'template_tag',
|
163 |
+
'label' => esc_html__( 'Template Tag', 'the-post-grid' ),
|
164 |
'id' => 'template_tag',
|
165 |
'holderClass' => 'pro-field',
|
166 |
'class' => 'select2',
|
169 |
'value' => isset( $settings['template_tag'] ) ? $settings['template_tag'] : [],
|
170 |
],
|
171 |
|
172 |
+
'tpg_primary_color_main' => [
|
173 |
+
'type' => 'text',
|
174 |
+
'label' => esc_html__( 'Primary Color', 'the-post-grid' ),
|
175 |
+
'class' => 'rt-color',
|
176 |
+
'default' => isset( $settings['tpg_primary_color_main'] ) ? $settings['tpg_primary_color_main'] : '#0d6efd',
|
177 |
],
|
178 |
|
179 |
'tpg_secondary_color_main' => [
|
180 |
+
'type' => 'text',
|
181 |
+
'label' => esc_html__( 'Secondary Color', 'the-post-grid' ),
|
182 |
+
'class' => 'rt-color',
|
183 |
+
'default' => isset( $settings['tpg_secondary_color_main'] ) ? $settings['tpg_secondary_color_main'] : '#0654c4',
|
184 |
],
|
185 |
|
186 |
+
'tpg_loader_color' => [
|
187 |
+
'type' => 'text',
|
188 |
+
'label' => esc_html__( 'Preloader Color', 'the-post-grid' ),
|
189 |
+
'class' => 'rt-color',
|
190 |
+
'default' => isset( $settings['tpg_loader_color'] ) ? $settings['tpg_loader_color'] : '#0367bf',
|
191 |
],
|
192 |
|
193 |
+
'template_class' => [
|
194 |
'type' => 'text',
|
195 |
'name' => 'template_class',
|
196 |
+
'label' => esc_html__( 'Template class', 'the-post-grid' ),
|
197 |
'holderClass' => 'pro-field',
|
198 |
'id' => 'template_class',
|
199 |
'value' => isset( $settings['template_class'] ) ? $settings['template_class'] : '',
|
204 |
|
205 |
if ( $plugin ) {
|
206 |
$acf_settings = [
|
207 |
+
'show_acf_details' => [
|
208 |
'type' => 'switch',
|
209 |
'name' => 'show_acf_details',
|
210 |
+
'label' => esc_html__( 'Enable Advanced Custom Field (ACF) for Single page', 'the-post-grid' ),
|
211 |
+
'description' => esc_html__( 'You may enable advanced custom field (ACF) on details page', 'the-post-grid' ),
|
212 |
'holderClass' => 'pro-field',
|
213 |
'value' => isset( $settings['show_acf_details'] ) ? $settings['show_acf_details'] : false,
|
214 |
],
|
215 |
|
216 |
+
'cf_group_details' => [
|
217 |
'type' => 'checkbox',
|
218 |
'name' => 'cf_group_details',
|
219 |
+
'label' => esc_html__( 'Choose ACF Group', 'the-post-grid' ),
|
220 |
'id' => 'cf_group_details',
|
221 |
'holderClass' => 'pro-field',
|
222 |
'alignment' => 'vertical',
|
228 |
'cf_hide_empty_value_details' => [
|
229 |
'type' => 'switch',
|
230 |
'name' => 'cf_hide_empty_value_details',
|
231 |
+
'label' => esc_html__( 'Hide field with empty value', 'the-post-grid' ),
|
232 |
'value' => isset( $settings['cf_hide_empty_value_details'] ) ? $settings['cf_hide_empty_value_details'] : false,
|
233 |
'holderClass' => 'pro-field',
|
234 |
],
|
235 |
|
236 |
+
'cf_show_only_value_details' => [
|
237 |
'type' => 'switch',
|
238 |
'name' => 'cf_show_only_value_details',
|
239 |
+
'label' => esc_html__( 'Show Title', 'the-post-grid' ),
|
240 |
+
'description' => esc_html__( 'By default both name & value of field is shown', 'the-post-grid' ),
|
241 |
'value' => isset( $settings['cf_show_only_value_details'] ) ? $settings['cf_show_only_value_details'] : true,
|
242 |
'holderClass' => 'pro-field',
|
243 |
],
|
245 |
'cf_hide_group_title_details' => [
|
246 |
'type' => 'switch',
|
247 |
'name' => 'cf_hide_group_title_details',
|
248 |
+
'label' => esc_html__( 'Show group title', 'the-post-grid' ),
|
249 |
'value' => isset( $settings['cf_hide_group_title_details'] ) ? $settings['cf_hide_group_title_details'] : false,
|
250 |
'holderClass' => 'pro-field',
|
251 |
],
|
266 |
'type' => 'heading',
|
267 |
'name' => 'tpg_common_settings_heading',
|
268 |
'class' => 'tpg_common_settings_heading',
|
269 |
+
'label' => esc_html__( 'Improve Performance', 'the-post-grid' ),
|
270 |
+
'description' => esc_html__( 'Please choose a Resource Load Type first. Otherwise, all CSS & JS for shortcode and elementor will load on your site which can create a bad performance issues.', 'the-post-grid' ),
|
271 |
],
|
272 |
|
273 |
+
'tpg_block_type' => [
|
274 |
'type' => 'select',
|
275 |
'name' => 'tpg_block_type',
|
276 |
'label' => 'Resource Load Type',
|
277 |
'id' => 'tpg_block_type',
|
278 |
'class' => 'select2',
|
279 |
'options' => [
|
280 |
+
'default' => esc_html__( 'Default (Both Elementor and Shortcode)', 'the-post-grid' ),
|
281 |
+
'elementor' => esc_html__( 'Elementor', 'the-post-grid' ),
|
282 |
+
'shortcode' => esc_html__( 'Shortcode', 'the-post-grid' ),
|
283 |
],
|
284 |
+
'description' => esc_html__( 'Please check which type of block you want to use. If you use Default then all styles and scripts for both will load on your site. But if you use one then just this style and script will load on your site.', 'the-post-grid' ),
|
285 |
'value' => isset( $settings['tpg_block_type'] ) ? $settings['tpg_block_type'] : 'default',
|
286 |
],
|
287 |
+
'tpg_load_script' => [
|
288 |
'type' => 'switch',
|
289 |
'name' => 'tpg_load_script',
|
290 |
+
'label' => esc_html__( 'Load Script dependent on block', 'the-post-grid' ),
|
291 |
+
'description' => sprintf(
|
292 |
+
'%s<b>%s</b>',
|
293 |
+
esc_html__( 'Check, if you want to load script when ShortCode or Elementor block is used on a page. ', 'the-post-grid' ),
|
294 |
+
esc_html__( 'If you enable this then you must have to enable Preloader from below.', 'the-post-grid' )
|
295 |
+
),
|
296 |
'value' => isset( $settings['tpg_load_script'] ) ? $settings['tpg_load_script'] : false,
|
297 |
],
|
298 |
+
'tpg_enable_preloader' => [
|
299 |
'type' => 'switch',
|
300 |
'name' => 'tpg_enable_preloader',
|
301 |
+
'label' => esc_html__( 'Enable Pre-loader', 'the-post-grid' ),
|
302 |
'value' => isset( $settings['tpg_enable_preloader'] ) ? $settings['tpg_enable_preloader'] : false,
|
303 |
],
|
304 |
+
'tpg_skip_fa' => [
|
305 |
'type' => 'switch',
|
306 |
'name' => 'tpg_skip_fa',
|
307 |
+
'label' => esc_html__( 'Disable Font Awesome Script', 'the-post-grid' ),
|
308 |
+
'description' => esc_html__( "If Font Awesome 5 exist with theme, don't need to load twice.", 'the-post-grid' ),
|
309 |
'value' => isset( $settings['tpg_skip_fa'] ) ? $settings['tpg_skip_fa'] : false,
|
310 |
],
|
311 |
];
|
316 |
public static function rtTPGLicenceField() {
|
317 |
$settings = get_option( rtTPG()->options['settings'] );
|
318 |
$status = ! empty( $settings['license_status'] ) && $settings['license_status'] === 'valid' ? true : false;
|
319 |
+
$license_status = ! empty( $settings['license_key'] ) ? sprintf(
|
320 |
+
"<span class='license-status'>%s</span>",
|
321 |
$status
|
322 |
+
? "<input type='submit' class='button-secondary rt-licensing-btn danger' name='license_deactivate' value='" . esc_html__( 'Deactivate License', 'the-post-grid' ) . "'/>"
|
323 |
+
: "<input type='submit' class='button-secondary rt-licensing-btn button-primary' name='license_activate' value='" . esc_html__( 'Activate License', 'the-post-grid' ) . "'/>"
|
|
|
|
|
324 |
) : ' ';
|
325 |
|
326 |
return [
|
327 |
+
'license_key' => [
|
328 |
+
'type' => 'text',
|
329 |
+
'name' => 'license_key',
|
330 |
+
'attr' => 'style="min-width:300px;"',
|
331 |
+
'label' => esc_html__( 'Enter your license key', 'the-post-grid' ),
|
332 |
+
'description_adv' => Fns::htmlKses( $license_status, 'advanced' ),
|
333 |
+
'id' => 'license_key',
|
334 |
+
'value' => isset( $settings['license_key'] ) ? $settings['license_key'] : '',
|
335 |
],
|
336 |
];
|
337 |
}
|
340 |
$settings = get_option( rtTPG()->options['settings'] );
|
341 |
|
342 |
return [
|
343 |
+
'social_share_items' => [
|
344 |
'type' => 'checkbox',
|
345 |
'name' => 'social_share_items',
|
346 |
+
'label' => esc_html__( 'Social share items', 'the-post-grid' ),
|
347 |
'id' => 'social_share_items',
|
348 |
'holderClass' => 'pro-field',
|
349 |
'alignment' => 'vertical',
|
350 |
'multiple' => true,
|
351 |
+
'options' => self::socialShareItemList(),
|
352 |
'value' => isset( $settings['social_share_items'] ) ? $settings['social_share_items'] : [],
|
353 |
],
|
354 |
];
|
356 |
|
357 |
public static function socialShareItemList() {
|
358 |
return [
|
359 |
+
'facebook' => esc_html__( 'Facebook', 'the-post-grid' ),
|
360 |
+
'twitter' => esc_html__( 'Twitter', 'the-post-grid' ),
|
361 |
+
'linkedin' => esc_html__( 'LinkedIn', 'the-post-grid' ),
|
362 |
+
'pinterest' => esc_html__( 'Pinterest', 'the-post-grid' ),
|
363 |
+
'reddit' => esc_html__( 'Reddit', 'the-post-grid' ),
|
364 |
+
'email' => esc_html__( 'Email', 'the-post-grid' ),
|
365 |
];
|
366 |
}
|
367 |
|
368 |
public static function templateOverrideItemList() {
|
369 |
return [
|
370 |
+
'category-archive' => esc_html__( 'Category archive', 'the-post-grid' ),
|
371 |
+
'tag-archive' => esc_html__( 'Tag archive', 'the-post-grid' ),
|
372 |
+
'author-archive' => esc_html__( 'Author archive', 'the-post-grid' ),
|
373 |
+
'search' => esc_html__( 'Search page', 'the-post-grid' ),
|
374 |
];
|
375 |
}
|
376 |
|
377 |
public static function rtTPGCommonFilterFields() {
|
378 |
return [
|
379 |
'post__in' => [
|
380 |
+
'name' => 'post__in',
|
381 |
+
'label' => esc_html__( 'Include only', 'the-post-grid' ),
|
382 |
+
'type' => 'text',
|
383 |
+
'class' => 'full',
|
384 |
+
'description' => esc_html__( 'List of post IDs to show (comma-separated values, for example: 1,2,3)', 'the-post-grid' ),
|
385 |
],
|
386 |
'post__not_in' => [
|
387 |
+
'name' => 'post__not_in',
|
388 |
+
'label' => esc_html__( 'Exclude', 'the-post-grid' ),
|
389 |
+
'type' => 'text',
|
390 |
+
'class' => 'full',
|
391 |
+
'description' => esc_html__( 'List of post IDs to hide (comma-separated values, for example: 1,2,3)', 'the-post-grid' ),
|
392 |
],
|
393 |
'limit' => [
|
394 |
+
'name' => 'limit',
|
395 |
+
'label' => esc_html__( 'Limit', 'the-post-grid' ),
|
396 |
+
'type' => 'number',
|
397 |
+
'class' => 'full',
|
398 |
+
'description' => esc_html__( 'The number of posts to show. Set empty to show all found posts.', 'the-post-grid' ),
|
399 |
],
|
400 |
'offset' => [
|
401 |
+
'name' => 'offset',
|
402 |
+
'label' => esc_html__( 'Offset', 'the-post-grid' ),
|
403 |
+
'type' => 'number',
|
404 |
+
'class' => 'full',
|
405 |
+
'description' => esc_html__( 'The number of posts to skip from start', 'the-post-grid' ),
|
406 |
],
|
407 |
];
|
408 |
}
|
410 |
public static function rtTPGPostType() {
|
411 |
return [
|
412 |
'tpg_post_type' => [
|
413 |
+
'label' => esc_html__( 'Post Type', 'the-post-grid' ),
|
414 |
+
'type' => 'select',
|
415 |
+
'id' => 'rt-sc-post-type',
|
416 |
+
'class' => '-rt-select2',
|
417 |
+
'options' => self::rtPostTypes(),
|
418 |
],
|
419 |
];
|
420 |
}
|
421 |
|
422 |
public static function rtTPAdvanceFilters() {
|
423 |
+
$fields = apply_filters(
|
424 |
+
'rt_tpg_advanced_filters',
|
425 |
[
|
426 |
+
'tpg_taxonomy' => esc_html__( 'Taxonomy', 'the-post-grid' ),
|
427 |
+
'order' => esc_html__( 'Order', 'the-post-grid' ),
|
428 |
+
'author' => esc_html__( 'Author', 'the-post-grid' ),
|
429 |
+
'tpg_post_status' => esc_html__( 'Status', 'the-post-grid' ),
|
430 |
+
's' => esc_html__( 'Search', 'the-post-grid' ),
|
431 |
+
]
|
432 |
+
);
|
433 |
|
434 |
return [
|
435 |
'post_filter' => [
|
436 |
+
'type' => 'checkboxFilter',
|
437 |
+
'name' => 'post_filter',
|
438 |
+
'label' => esc_html__( 'Advanced Filters', 'the-post-grid' ),
|
439 |
+
'alignment' => 'vertical',
|
440 |
+
'multiple' => true,
|
441 |
'default' => [ 'tpg_taxonomy', 'order' ],
|
442 |
+
'options' => $fields,
|
443 |
],
|
444 |
];
|
445 |
}
|
446 |
|
447 |
public static function rtTPGPostStatus() {
|
448 |
return [
|
449 |
+
'publish' => esc_html__( 'Publish', 'the-post-grid' ),
|
450 |
+
'pending' => esc_html__( 'Pending', 'the-post-grid' ),
|
451 |
+
'draft' => esc_html__( 'Draft', 'the-post-grid' ),
|
452 |
+
'auto-draft' => esc_html__( 'Auto draft', 'the-post-grid' ),
|
453 |
+
'future' => esc_html__( 'Future', 'the-post-grid' ),
|
454 |
+
'private' => esc_html__( 'Private', 'the-post-grid' ),
|
455 |
+
'inherit' => esc_html__( 'Inherit', 'the-post-grid' ),
|
456 |
+
'trash' => esc_html__( 'Trash', 'the-post-grid' ),
|
457 |
];
|
458 |
}
|
459 |
|
460 |
public static function owl_property() {
|
461 |
return [
|
462 |
+
'auto_play' => esc_html__( 'Auto Play', 'the-post-grid' ),
|
463 |
+
'loop' => esc_html__( 'Loop', 'the-post-grid' ),
|
464 |
+
'nav_button' => esc_html__( 'Nav Button', 'the-post-grid' ),
|
465 |
+
'pagination' => esc_html__( 'Pagination', 'the-post-grid' ),
|
466 |
+
'stop_hover' => esc_html__( 'Stop Hover', 'the-post-grid' ),
|
467 |
+
'auto_height' => esc_html__( 'Auto Height', 'the-post-grid' ),
|
468 |
+
'lazy_load' => esc_html__( 'Lazy Load', 'the-post-grid' ),
|
469 |
+
'rtl' => esc_html__( 'Right to left (RTL)', 'the-post-grid' ),
|
470 |
];
|
471 |
}
|
472 |
|
473 |
public static function rtTPGLayoutSettingFields() {
|
474 |
$options = [
|
475 |
'layout_type' => [
|
476 |
+
'type' => 'radio-image',
|
477 |
+
'label' => esc_html__( 'Layout Type', 'the-post-grid' ),
|
478 |
+
'id' => 'rt-tpg-sc-layout-type',
|
479 |
+
'options' => self::rtTPGLayoutType(),
|
480 |
],
|
481 |
'layout' => [
|
482 |
+
'type' => 'radio-image',
|
483 |
+
'label' => esc_html__( 'Layout', 'the-post-grid' ),
|
484 |
+
'id' => 'rt-tpg-sc-layout',
|
485 |
+
'class' => 'rt-select2',
|
486 |
+
'options' => self::rtTPGLayouts(),
|
487 |
],
|
488 |
'tgp_filter' => [
|
489 |
+
'type' => 'checkbox',
|
490 |
+
'label' => esc_html__( 'Filter', 'the-post-grid' ),
|
491 |
+
'holderClass' => 'sc-tpg-grid-filter tpg-hidden pro-field',
|
492 |
+
'multiple' => true,
|
493 |
+
'alignment' => 'vertical',
|
494 |
+
'options' => self::tgp_filter_list(),
|
495 |
],
|
496 |
'tgp_filter_taxonomy' => [
|
497 |
+
'type' => 'select',
|
498 |
+
'label' => esc_html__( 'Taxonomy Filter', 'the-post-grid' ),
|
499 |
+
'holderClass' => 'sc-tpg-grid-filter sc-tpg-filter tpg-hidden',
|
500 |
+
'class' => 'rt-select2',
|
501 |
+
'options' => Fns::rt_get_taxonomy_for_filter(),
|
502 |
],
|
503 |
'tgp_filter_taxonomy_hierarchical' => [
|
504 |
+
'type' => 'switch',
|
505 |
+
'label' => esc_html__( 'Display as sub category', 'the-post-grid' ),
|
506 |
+
'holderClass' => 'sc-tpg-grid-filter sc-tpg-filter tpg-hidden',
|
507 |
+
'option' => 'Active',
|
508 |
],
|
509 |
'tgp_filter_type' => [
|
510 |
+
'type' => 'select',
|
511 |
+
'label' => esc_html__( 'Taxonomy filter type', 'the-post-grid' ),
|
512 |
+
'holderClass' => 'sc-tpg-grid-filter sc-tpg-filter tpg-hidden',
|
513 |
+
'class' => 'rt-select2',
|
514 |
+
'options' => self::rt_filter_type(),
|
515 |
],
|
516 |
'tgp_default_filter' => [
|
517 |
+
'type' => 'select',
|
518 |
+
'label' => esc_html__( 'Selected filter term (Selected item)', 'the-post-grid' ),
|
519 |
+
'holderClass' => 'sc-tpg-grid-filter sc-tpg-filter tpg-hidden',
|
520 |
+
'class' => 'rt-select2',
|
521 |
+
'attr' => "data-selected='" . get_post_meta( get_the_ID(), 'tgp_default_filter', true ) . "'",
|
522 |
+
'options' => [ '' => esc_html__( 'Show All', 'the-post-grid' ) ],
|
523 |
],
|
524 |
'tpg_hide_all_button' => [
|
525 |
+
'type' => 'switch',
|
526 |
+
'label' => esc_html__( 'Hide All (Show all) button', 'the-post-grid' ),
|
527 |
+
'holderClass' => 'sc-tpg-grid-filter sc-tpg-filter tpg-hidden',
|
528 |
+
'option' => 'Hide',
|
529 |
],
|
530 |
'tpg_post_count' => [
|
531 |
+
'type' => 'switch',
|
532 |
+
'label' => esc_html__( 'Show post count', 'the-post-grid' ),
|
533 |
+
'holderClass' => 'sc-tpg-grid-filter sc-tpg-filter tpg-hidden',
|
534 |
+
'option' => 'Enable',
|
535 |
],
|
536 |
'isotope_filter' => [
|
537 |
+
'type' => 'select',
|
538 |
+
'label' => esc_html__( 'Isotope Filter', 'the-post-grid' ),
|
539 |
+
'holderClass' => 'isotope-item sc-isotope-filter tpg-hidden',
|
540 |
+
'id' => 'rt-tpg-sc-isotope-filter',
|
541 |
+
'class' => 'rt-select2',
|
542 |
+
'options' => Fns::rt_get_taxonomy_for_filter(),
|
543 |
],
|
544 |
'isotope_default_filter' => [
|
545 |
+
'type' => 'select',
|
546 |
+
'label' => esc_html__( 'Isotope filter (Selected item)', 'the-post-grid' ),
|
547 |
+
'holderClass' => 'isotope-item sc-isotope-default-filter tpg-hidden pro-field',
|
548 |
+
'id' => 'rt-tpg-sc-isotope-default-filter',
|
549 |
+
'class' => 'rt-select2',
|
550 |
+
'attr' => "data-selected='" . get_post_meta(
|
551 |
+
get_the_ID(),
|
552 |
+
'isotope_default_filter',
|
553 |
+
true
|
554 |
+
) . "'",
|
555 |
+
'options' => [ '' => esc_html__( 'Show all', 'the-post-grid' ) ],
|
556 |
],
|
557 |
'tpg_show_all_text' => [
|
558 |
+
'type' => 'text',
|
559 |
+
'holderClass' => 'isotope-item sc-isotope-filter tpg-hidden',
|
560 |
+
'label' => esc_html__( 'Show all text', 'the-post-grid' ),
|
561 |
+
'default' => esc_html__( 'Show all', 'the-post-grid' ),
|
562 |
],
|
563 |
'isotope_filter_dropdown' => [
|
564 |
+
'type' => 'switch',
|
565 |
+
'label' => esc_html__( 'Isotope dropdown filter', 'the-post-grid' ),
|
566 |
+
'holderClass' => 'isotope-item sc-isotope-filter sc-isotope-filter-dropdown tpg-hidden pro-field',
|
567 |
],
|
568 |
'isotope_filter_show_all' => [
|
569 |
+
'type' => 'switch',
|
570 |
+
'name' => 'isotope_filter_show_all',
|
571 |
+
'label' => esc_html__( 'Isotope filter (Show All item)', 'the-post-grid' ),
|
572 |
+
'holderClass' => 'isotope-item sc-isotope-filter-show-all tpg-hidden pro-field',
|
573 |
+
'id' => 'rt-tpg-sc-isotope-filter-show-all',
|
574 |
],
|
575 |
'isotope_filter_count' => [
|
576 |
+
'type' => 'switch',
|
577 |
+
'label' => esc_html__( 'Isotope filter count number', 'the-post-grid' ),
|
578 |
+
'holderClass' => 'isotope-item sc-isotope-filter tpg-hidden pro-field',
|
579 |
+
'option' => 'Enable',
|
580 |
],
|
581 |
'isotope_filter_url' => [
|
582 |
+
'type' => 'switch',
|
583 |
+
'label' => esc_html__( 'Isotope filter URL', 'the-post-grid' ),
|
584 |
+
'holderClass' => 'isotope-item sc-isotope-filter tpg-hidden pro-field',
|
585 |
],
|
586 |
'isotope_search_filter' => [
|
587 |
+
'type' => 'switch',
|
588 |
+
'label' => esc_html__( 'Isotope search filter', 'the-post-grid' ),
|
589 |
+
'holderClass' => 'isotope-item sc-isotope-search-filter tpg-hidden pro-field',
|
590 |
+
'id' => 'rt-tpg-sc-isotope-search-filter',
|
591 |
+
'option' => 'Enable',
|
592 |
],
|
593 |
'carousel_property' => [
|
594 |
+
'type' => 'checkbox',
|
595 |
+
'label' => esc_html__( 'Carousel property', 'the-post-grid' ),
|
596 |
+
'multiple' => true,
|
597 |
+
'alignment' => 'vertical',
|
598 |
+
'holderClass' => 'carousel-item carousel-property tpg-hidden',
|
599 |
+
'id' => 'carousel-property',
|
600 |
+
'default' => [ 'pagination' ],
|
601 |
+
'options' => self::owl_property(),
|
602 |
],
|
603 |
'tpg_carousel_speed' => [
|
604 |
+
'label' => esc_html__( 'Speed', 'the-post-grid' ),
|
605 |
+
'holderClass' => 'tpg-hidden carousel-item',
|
606 |
+
'type' => 'number',
|
607 |
'default' => 250,
|
608 |
+
'description' => esc_html__( 'Auto play Speed in milliseconds', 'the-post-grid' ),
|
609 |
],
|
610 |
'tpg_carousel_autoplay_timeout' => [
|
611 |
+
'label' => esc_html__( 'Autoplay timeout', 'the-post-grid' ),
|
612 |
+
'holderClass' => 'tpg-hidden carousel-item tpg-carousel-auto-play-timeout',
|
613 |
+
'type' => 'number',
|
614 |
'default' => 5000,
|
615 |
+
'description' => esc_html__( 'Autoplay interval timeout', 'the-post-grid' ),
|
616 |
],
|
617 |
];
|
618 |
|
623 |
$options = [
|
624 |
'column' => [
|
625 |
'type' => 'select',
|
626 |
+
'label' => esc_html__( 'Desktop', 'the-post-grid' ),
|
627 |
'class' => 'rt-select2',
|
628 |
+
'holderClass' => 'offset-column-wrap rt-3-column',
|
629 |
'default' => 3,
|
630 |
'options' => self::scColumns(),
|
631 |
+
'description' => esc_html__( 'Desktop > 991px', 'the-post-grid' ),
|
632 |
],
|
633 |
'tpg_tab_column' => [
|
634 |
'type' => 'select',
|
635 |
+
'label' => esc_html__( 'Tab', 'the-post-grid' ),
|
636 |
'class' => 'rt-select2',
|
637 |
+
'holderClass' => 'offset-column-wrap rt-3-column',
|
638 |
'default' => 2,
|
639 |
'options' => self::scColumns(),
|
640 |
+
'description' => esc_html__( 'Tab < 992px', 'the-post-grid' ),
|
641 |
],
|
642 |
'tpg_mobile_column' => [
|
643 |
'type' => 'select',
|
644 |
+
'label' => esc_html__( 'Mobile', 'the-post-grid' ),
|
645 |
'class' => 'rt-select2',
|
646 |
+
'holderClass' => 'offset-column-wrap rt-3-column',
|
647 |
'default' => 1,
|
648 |
'options' => self::scColumns(),
|
649 |
+
'description' => esc_html__( 'Mobile < 768px', 'the-post-grid' ),
|
650 |
],
|
651 |
];
|
652 |
|
656 |
public static function layoutMiscSettings() {
|
657 |
$options = [
|
658 |
'pagination' => [
|
659 |
+
'type' => 'switch',
|
660 |
+
'label' => esc_html__( 'Pagination', 'the-post-grid' ),
|
661 |
+
'holderClass' => 'pagination',
|
662 |
+
'id' => 'rt-tpg-pagination',
|
663 |
+
'description' => esc_html__( 'Pagination not allow in Grid Hover layout', 'the-post-grid' ),
|
664 |
+
'option' => 'Enable',
|
665 |
+
'default' => 1,
|
666 |
],
|
667 |
'posts_per_page' => [
|
668 |
+
'type' => 'number',
|
669 |
+
'label' => esc_html__( 'Display per page', 'the-post-grid' ),
|
670 |
+
'holderClass' => 'pagination-item posts-per-page tpg-hidden',
|
671 |
+
'default' => 9,
|
672 |
+
'description' => esc_html__( 'If value of Limit setting is not blank (empty), this value should be smaller than Limit value.', 'the-post-grid' ),
|
673 |
],
|
674 |
'posts_loading_type' => [
|
675 |
+
'type' => 'radio',
|
676 |
+
'label' => esc_html__( 'Pagination Type', 'the-post-grid' ),
|
677 |
+
'holderClass' => 'pagination-item posts-loading-type tpg-hidden pro-field',
|
678 |
+
'alignment' => 'vertical',
|
679 |
+
'default' => 'pagination',
|
680 |
+
'options' => self::postLoadingType(),
|
681 |
],
|
682 |
|
683 |
+
'load_more_text' => [
|
684 |
'type' => 'text',
|
685 |
'name' => 'load_more_text',
|
686 |
+
'label' => esc_html__( 'Load More Text', 'the-post-grid' ),
|
687 |
'holderClass' => 'pagination-load-more-label tpg-hidden pro-field',
|
688 |
'id' => 'template_class',
|
689 |
'value' => isset( $settings['load_more_text'] ) ? $settings['load_more_text'] : '',
|
690 |
],
|
691 |
|
692 |
'link_to_detail_page' => [
|
693 |
+
'type' => 'switch',
|
694 |
+
'label' => esc_html__( 'Link To Detail Page', 'the-post-grid' ),
|
695 |
+
'alignment' => 'vertical',
|
696 |
+
'default' => true,
|
697 |
],
|
698 |
'detail_page_link_type' => [
|
699 |
+
'type' => 'radio',
|
700 |
+
'label' => esc_html__( 'Detail page link type', 'the-post-grid' ),
|
701 |
+
'holderClass' => 'detail-page-link-type tpg-hidden pro-field',
|
702 |
+
'alignment' => 'vertical',
|
703 |
+
'default' => 'new_page',
|
704 |
+
'options' => [
|
705 |
+
'new_page' => esc_html__( 'New Page', 'the-post-grid' ),
|
706 |
+
'popup' => esc_html__( 'PopUp', 'the-post-grid' ),
|
707 |
],
|
708 |
],
|
709 |
'popup_type' => [
|
710 |
+
'type' => 'radio',
|
711 |
+
'label' => esc_html__( 'PopUp Type', 'the-post-grid' ),
|
712 |
+
'holderClass' => 'popup-type tpg-hidden pro-field',
|
713 |
+
'alignment' => 'vertical',
|
714 |
+
'default' => 'single',
|
715 |
+
'options' => [
|
716 |
+
'single' => esc_html__( 'Single PopUp', 'the-post-grid' ),
|
717 |
+
'multi' => esc_html__( 'Multi PopUp', 'the-post-grid' ),
|
718 |
],
|
719 |
],
|
720 |
'link_target' => [
|
721 |
+
'type' => 'radio',
|
722 |
+
'label' => esc_html__( 'Link Target', 'the-post-grid' ),
|
723 |
+
'holderClass' => 'tpg-link-target tpg-hidden',
|
724 |
+
'alignment' => 'vertical',
|
725 |
+
'options' => [
|
726 |
+
'' => esc_html__( 'Same Window', 'the-post-grid' ),
|
727 |
+
'_blank' => esc_html__( 'New Window', 'the-post-grid' ),
|
728 |
],
|
729 |
],
|
730 |
];
|
735 |
public static function stickySettings() {
|
736 |
$options = [
|
737 |
'ignore_sticky_posts' => [
|
738 |
+
'type' => 'switch',
|
739 |
+
'label' => esc_html__( 'Show sticky posts at the top', 'the-post-grid' ),
|
740 |
+
'holderClass' => 'pro-field',
|
741 |
+
'alignment' => 'vertical',
|
742 |
+
'default' => false,
|
743 |
],
|
744 |
];
|
745 |
|
748 |
|
749 |
public static function scMarginOpt() {
|
750 |
return [
|
751 |
+
'default' => esc_html__( 'Bootstrap default', 'the-post-grid' ),
|
752 |
+
'no' => esc_html__( 'No Margin', 'the-post-grid' ),
|
753 |
];
|
754 |
}
|
755 |
|
756 |
function scGridType() {
|
757 |
return [
|
758 |
+
'even' => esc_html__( 'Even Grid', 'the-post-grid' ),
|
759 |
+
'masonry' => esc_html__( 'Masonry', 'the-post-grid' ),
|
760 |
];
|
761 |
}
|
762 |
|
763 |
public static function getTitleTags() {
|
764 |
return [
|
765 |
+
'h2' => esc_html__( 'H2', 'the-post-grid' ),
|
766 |
+
'h3' => esc_html__( 'H3', 'the-post-grid' ),
|
767 |
+
'h4' => esc_html__( 'H4', 'the-post-grid' ),
|
768 |
];
|
769 |
}
|
770 |
|
771 |
public static function getHeadingTags() {
|
772 |
return [
|
773 |
+
'h1' => esc_html__( 'H1', 'the-post-grid' ),
|
774 |
+
'h2' => esc_html__( 'H2', 'the-post-grid' ),
|
775 |
+
'h3' => esc_html__( 'H3', 'the-post-grid' ),
|
776 |
+
'h4' => esc_html__( 'H4', 'the-post-grid' ),
|
777 |
+
'h5' => esc_html__( 'H5', 'the-post-grid' ),
|
778 |
+
'h6' => esc_html__( 'H6', 'the-post-grid' ),
|
779 |
];
|
780 |
}
|
781 |
|
783 |
$settings = get_option( rtTPG()->options['settings'] );
|
784 |
|
785 |
$fields = [
|
786 |
+
'popup_fields' => [
|
787 |
'type' => 'checkbox',
|
788 |
+
'label' => esc_html__( 'Field Selection', 'the-post-grid' ),
|
789 |
'id' => 'popup-fields',
|
790 |
'holderClass' => 'pro-field',
|
791 |
'alignment' => 'vertical',
|
792 |
'multiple' => true,
|
793 |
+
'options' => self::detailAvailableFields(),
|
794 |
+
'default' => array_keys( self::detailAvailableFields() ),
|
795 |
'value' => isset( $settings['popup_fields'] ) ? $settings['popup_fields'] : [],
|
796 |
],
|
797 |
];
|
798 |
$cf = Fns::is_acf();
|
799 |
if ( $cf ) {
|
800 |
$plist = self::getCFPluginList();
|
801 |
+
$pName = ! empty( $plist[ $cf ] ) ? $plist[ $cf ] : ' - ';
|
802 |
$fields['cf_group'] = [
|
803 |
+
'type' => 'checkbox',
|
804 |
+
'name' => 'cf_group',
|
805 |
+
'holderClass' => 'tpg-hidden cfs-fields cf-group pro-field',
|
806 |
+
'label' => 'Custom Field group ' . " ({$pName})",
|
807 |
+
'multiple' => true,
|
808 |
+
'alignment' => 'vertical',
|
809 |
+
'id' => 'cf_group',
|
810 |
+
'options' => Fns::get_groups_by_post_type( 'all' ),
|
811 |
+
'value' => isset( $settings['cf_group'] ) ? $settings['cf_group'] : [],
|
812 |
];
|
813 |
$fields['cf_hide_empty_value'] = [
|
814 |
+
'type' => 'checkbox',
|
815 |
+
'name' => 'cf_hide_empty_value',
|
816 |
+
'holderClass' => 'tpg-hidden cfs-fields pro-field',
|
817 |
+
'label' => esc_html__( 'Hide field with empty value', 'the-post-grid' ),
|
818 |
+
'value' => ! empty( $settings['cf_hide_empty_value'] ) ? 1 : 0,
|
819 |
];
|
820 |
$fields['cf_show_only_value'] = [
|
821 |
+
'type' => 'checkbox',
|
822 |
+
'name' => 'cf_show_only_value',
|
823 |
+
'holderClass' => 'tpg-hidden cfs-fields pro-field',
|
824 |
+
'label' => esc_html__( 'Show only value of field', 'the-post-grid' ),
|
825 |
+
'description' => esc_html__( 'By default both name & value of field is shown', 'the-post-grid' ),
|
826 |
+
'value' => ! empty( $settings['cf_show_only_value'] ) ? 1 : 0,
|
827 |
];
|
828 |
$fields['cf_hide_group_title'] = [
|
829 |
+
'type' => 'checkbox',
|
830 |
+
'name' => 'cf_hide_group_title',
|
831 |
+
'holderClass' => 'tpg-hidden cfs-fields pro-field',
|
832 |
+
'label' => esc_html__( 'Hide group title', 'the-post-grid' ),
|
833 |
+
'value' => ! empty( $settings['cf_hide_group_title'] ) ? 1 : 0,
|
834 |
];
|
835 |
}
|
836 |
|
840 |
public static function detailAvailableFields() {
|
841 |
$fields = self::rtTPGItemFields();
|
842 |
$inserted = [
|
843 |
+
'content' => esc_html__( 'Content', 'the-post-grid' ),
|
844 |
+
'feature_img' => esc_html__( 'Feature Image', 'the-post-grid' ),
|
845 |
];
|
846 |
+
|
847 |
unset( $fields['heading'] );
|
848 |
unset( $fields['excerpt'] );
|
849 |
unset( $fields['read_more'] );
|
850 |
unset( $fields['comment_count'] );
|
851 |
+
|
852 |
$offset = array_search( 'title', array_keys( $fields ) ) + 1;
|
853 |
+
$newFields = array_slice( $fields, 0, $offset, true ) + $inserted + array_slice(
|
854 |
+
$fields,
|
855 |
+
$offset,
|
856 |
+
null,
|
857 |
+
true
|
858 |
+
);
|
859 |
+
$newFields['social_share'] = 'Social Share';
|
860 |
|
861 |
return $newFields;
|
862 |
}
|
873 |
'default' => 'h2',
|
874 |
],
|
875 |
'tpg_heading_style' => [
|
876 |
+
'type' => 'select',
|
877 |
+
'class' => 'rt-select2',
|
878 |
+
'label' => esc_html__( 'Style', 'the-post-grid' ),
|
879 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
880 |
+
'options' => [
|
881 |
+
'style1' => esc_html__( 'Style 1', 'the-post-grid' ),
|
882 |
+
'style2' => esc_html__( 'Style 2', 'the-post-grid' ),
|
883 |
+
'style3' => esc_html__( 'Style 3', 'the-post-grid' ),
|
884 |
],
|
885 |
],
|
886 |
'tpg_heading_alignment' => [
|
887 |
+
'type' => 'select',
|
888 |
+
'class' => 'rt-select2',
|
889 |
+
'label' => esc_html__( 'Alignment', 'the-post-grid' ),
|
890 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
891 |
+
'options' => [
|
892 |
+
'left' => esc_html__( 'Left', 'the-post-grid' ),
|
893 |
+
'right' => esc_html__( 'Right', 'the-post-grid' ),
|
894 |
+
'center' => esc_html__( 'Center', 'the-post-grid' ),
|
895 |
],
|
896 |
],
|
897 |
'tpg_heading_link' => [
|
898 |
+
'type' => 'url',
|
899 |
+
'label' => esc_html__( 'Link', 'the-post-grid' ),
|
900 |
],
|
901 |
];
|
902 |
|
906 |
public static function rtTPGSCCategorySettings() {
|
907 |
$fields = [
|
908 |
'tpg_category_position' => [
|
909 |
+
'type' => 'select',
|
910 |
+
'class' => 'rt-select2',
|
911 |
+
'holderClass' => 'pro-field',
|
912 |
+
'label' => esc_html__( 'Position', 'the-post-grid' ),
|
913 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
914 |
+
'options' => [
|
915 |
+
'above_title' => esc_html__( 'Above Title', 'the-post-grid' ),
|
916 |
+
'top_left' => esc_html__( 'Over image (Top Left)', 'the-post-grid' ),
|
917 |
+
'top_right' => esc_html__( 'Over image (Top Right)', 'the-post-grid' ),
|
918 |
+
'bottom_left' => esc_html__( 'Over image (Bottom Left)', 'the-post-grid' ),
|
919 |
+
'bottom_right' => esc_html__( 'Over image (Bottom Right)', 'the-post-grid' ),
|
920 |
+
'image_center' => esc_html__( 'Over image (Center)', 'the-post-grid' ),
|
921 |
],
|
922 |
],
|
923 |
'tpg_category_style' => [
|
924 |
+
'type' => 'select',
|
925 |
+
'class' => 'rt-select2',
|
926 |
+
'holderClass' => 'pro-field',
|
927 |
+
'label' => esc_html__( 'Style', 'the-post-grid' ),
|
928 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
929 |
+
'options' => [
|
930 |
+
'style1' => esc_html__( 'Style 1', 'the-post-grid' ),
|
931 |
+
'style2' => esc_html__( 'Style 2', 'the-post-grid' ),
|
932 |
+
'style3' => esc_html__( 'Style 3', 'the-post-grid' ),
|
933 |
],
|
934 |
],
|
935 |
'tpg_category_icon' => [
|
936 |
+
'type' => 'switch',
|
937 |
+
'label' => esc_html__( 'Icon', 'the-post-grid' ),
|
938 |
+
'default' => true,
|
939 |
],
|
940 |
];
|
941 |
|
945 |
public static function rtTPGSCTitleSettings() {
|
946 |
$fields = [
|
947 |
'tpg_title_position' => [
|
948 |
+
'type' => 'select',
|
949 |
+
'label' => esc_html__( 'Title Position (Above or Below image)', 'the-post-grid' ),
|
950 |
+
'class' => 'rt-select2 ',
|
951 |
+
'holderClass' => 'pro-field',
|
952 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
953 |
+
'options' => [
|
954 |
+
'above' => esc_html__( 'Above image', 'the-post-grid' ),
|
955 |
+
'below' => esc_html__( 'Below image', 'the-post-grid' ),
|
956 |
],
|
957 |
+
'description' => __(
|
958 |
+
"<span style='color:#ff0000'>Only Layout 1, Layout 12, Layout 14, Isotope1, Isotope8, Isotope10, Carousel Layout 1, Carousel Layout 8, Carousel Layout 10</span>",
|
959 |
+
'the-post-grid'
|
960 |
+
),
|
961 |
],
|
962 |
'title_tag' => [
|
963 |
'type' => 'select',
|
969 |
'default' => 'h3',
|
970 |
],
|
971 |
'tpg_title_limit' => [
|
972 |
+
'type' => 'number',
|
973 |
+
'label' => esc_html__( 'Title limit', 'the-post-grid' ),
|
974 |
+
'description' => esc_html__( 'Title limit only integer number is allowed, Leave it blank for full title.', 'the-post-grid' ),
|
975 |
],
|
976 |
'tpg_title_limit_type' => [
|
977 |
+
'type' => 'radio',
|
978 |
+
'label' => esc_html__( 'Title limit type', 'the-post-grid' ),
|
979 |
+
'alignment' => 'vertical',
|
980 |
+
'default' => 'character',
|
981 |
+
'options' => self::get_limit_type(),
|
982 |
],
|
983 |
];
|
984 |
|
988 |
public static function rtTPGSCMetaSettings() {
|
989 |
$fields = [
|
990 |
'tpg_meta_position' => [
|
991 |
+
'type' => 'select',
|
992 |
+
'label' => esc_html__( 'Position', 'the-post-grid' ),
|
993 |
+
'class' => 'rt-select2 ',
|
994 |
+
'holderClass' => 'pro-field',
|
995 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
996 |
+
'options' => [
|
997 |
+
'above_title' => esc_html__( 'Above Title', 'the-post-grid' ),
|
998 |
+
'above_excerpt' => esc_html__( 'Above excerpt', 'the-post-grid' ),
|
999 |
+
'below_excerpt' => esc_html__( 'Below excerpt', 'the-post-grid' ),
|
1000 |
],
|
1001 |
],
|
1002 |
'tpg_meta_icon' => [
|
1003 |
+
'type' => 'switch',
|
1004 |
+
'label' => esc_html__( 'Icon', 'the-post-grid' ),
|
1005 |
+
'default' => true,
|
1006 |
],
|
1007 |
'tpg_meta_separator' => [
|
1008 |
+
'type' => 'select',
|
1009 |
+
'class' => 'rt-select2',
|
1010 |
+
'label' => esc_html__( 'Separator', 'the-post-grid' ),
|
1011 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
1012 |
+
'options' => [
|
1013 |
+
'dot' => esc_html__( 'Dot ( . )', 'the-post-grid' ),
|
1014 |
+
's_slash' => esc_html__( 'Single Slash ( / )', 'the-post-grid' ),
|
1015 |
+
'd_slash' => esc_html__( 'Double Slash ( // )', 'the-post-grid' ),
|
1016 |
+
'hypen' => esc_html__( 'Hypen ( - )', 'the-post-grid' ),
|
1017 |
+
'v_pipe' => esc_html__( 'Vertical Pipe ( | )', 'the-post-grid' ),
|
1018 |
],
|
1019 |
],
|
1020 |
];
|
1025 |
public static function rtTPGSCImageSettings() {
|
1026 |
$fields = [
|
1027 |
'feature_image' => [
|
1028 |
+
'type' => 'switch',
|
1029 |
+
'label' => esc_html__( 'Hide Feature Image', 'the-post-grid' ),
|
1030 |
+
'id' => 'rt-tpg-feature-image',
|
1031 |
+
'default' => false,
|
1032 |
],
|
1033 |
'featured_image_size' => [
|
1034 |
+
'type' => 'select',
|
1035 |
+
'label' => esc_html__( 'Feature Image Size', 'the-post-grid' ),
|
1036 |
+
'class' => 'rt-select2',
|
1037 |
+
'holderClass' => 'rt-feature-image-option tpg-hidden',
|
1038 |
+
'options' => Fns::get_image_sizes(),
|
1039 |
],
|
1040 |
'custom_image_size' => [
|
1041 |
+
'type' => 'image_size',
|
1042 |
+
'label' => esc_html__( 'Custom Image Size', 'the-post-grid' ),
|
1043 |
+
'holderClass' => 'rt-sc-custom-image-size-holder tpg-hidden',
|
1044 |
+
'multiple' => true,
|
1045 |
],
|
1046 |
'media_source' => [
|
1047 |
+
'type' => 'radio',
|
1048 |
+
'label' => esc_html__( 'Media Source', 'the-post-grid' ),
|
1049 |
+
'default' => 'feature_image',
|
1050 |
+
'alignment' => 'vertical',
|
1051 |
+
'holderClass' => 'rt-feature-image-option tpg-hidden',
|
1052 |
+
'options' => self::rtMediaSource(),
|
1053 |
],
|
1054 |
'tgp_layout2_image_column' => [
|
1055 |
'type' => 'select',
|
1056 |
'label' => esc_html__( 'Image column', 'the-post-grid' ),
|
1057 |
'class' => 'rt-select2',
|
1058 |
+
'holderClass' => 'holder-layout2-image-column tpg-hidden',
|
1059 |
'default' => 4,
|
1060 |
'options' => self::scColumns(),
|
1061 |
+
'description' => 'Content column will calculate automatically',
|
1062 |
],
|
1063 |
'tpg_image_type' => [
|
1064 |
+
'type' => 'radio',
|
1065 |
+
'label' => esc_html__( 'Type', 'the-post-grid' ),
|
1066 |
+
'alignment' => 'vertical',
|
1067 |
+
'holderClass' => 'rt-feature-image-option tpg-hidden pro-field',
|
1068 |
+
'default' => 'normal',
|
1069 |
+
'options' => self::get_image_types(),
|
1070 |
],
|
1071 |
'tpg_image_animation' => [
|
1072 |
+
'type' => 'select',
|
1073 |
+
'label' => esc_html__( 'Hover Animation', 'the-post-grid' ),
|
1074 |
+
'class' => 'rt-select2',
|
1075 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
1076 |
+
'options' => [
|
1077 |
'img_zoom_in' => esc_html__( 'Zoom in', 'the-post-grid' ),
|
1078 |
'img_zoom_out' => esc_html__( 'Zoom out', 'the-post-grid' ),
|
1079 |
'img_no_effect' => esc_html__( 'None', 'the-post-grid' ),
|
1080 |
],
|
1081 |
],
|
1082 |
'tpg_image_border_radius' => [
|
1083 |
+
'type' => 'number',
|
1084 |
+
'class' => 'small-text',
|
1085 |
+
'holderClass' => 'pro-field',
|
1086 |
+
'label' => esc_html__( 'Border radius', 'the-post-grid' ),
|
1087 |
+
'description' => esc_html__( 'Leave it blank for default', 'the-post-grid' ),
|
1088 |
],
|
1089 |
];
|
1090 |
|
1094 |
public static function rtTPGSCExcerptSettings() {
|
1095 |
$fields = [
|
1096 |
'excerpt_limit' => [
|
1097 |
+
'type' => 'number',
|
1098 |
+
'label' => esc_html__( 'Excerpt limit', 'the-post-grid' ),
|
1099 |
+
'default' => 15,
|
1100 |
+
'description' => esc_html__( 'Excerpt limit only integer number is allowed, Leave it blank for full excerpt.', 'the-post-grid' ),
|
1101 |
],
|
1102 |
'tgp_excerpt_type' => [
|
1103 |
+
'type' => 'radio',
|
1104 |
+
'label' => esc_html__( 'Excerpt Type', 'the-post-grid' ),
|
1105 |
+
'alignment' => 'vertical',
|
1106 |
+
'default' => 'word',
|
1107 |
+
'options' => self::get_limit_type( 'content' ),
|
1108 |
],
|
1109 |
'tgp_excerpt_more_text' => [
|
1110 |
+
'type' => 'text',
|
1111 |
+
'label' => esc_html__( 'Excerpt more text', 'the-post-grid' ),
|
1112 |
+
'default' => '...',
|
1113 |
],
|
1114 |
];
|
1115 |
|
1119 |
public static function rtTPGSCButtonSettings() {
|
1120 |
$fields = [
|
1121 |
'tpg_read_more_button_border_radius' => [
|
1122 |
+
'type' => 'number',
|
1123 |
+
'class' => 'small-text',
|
1124 |
+
'label' => esc_html__( 'Border radius', 'the-post-grid' ),
|
1125 |
+
'description' => esc_html__( 'Leave it blank for default', 'the-post-grid' ),
|
1126 |
],
|
1127 |
'tpg_read_more_button_alignment' => [
|
1128 |
+
'type' => 'select',
|
1129 |
+
'class' => 'rt-select2',
|
1130 |
+
'label' => esc_html__( 'Alignment', 'the-post-grid' ),
|
1131 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
1132 |
+
'options' => [
|
1133 |
+
'left' => esc_html__( 'Left', 'the-post-grid' ),
|
1134 |
+
'right' => esc_html__( 'Right', 'the-post-grid' ),
|
1135 |
+
'center' => esc_html__( 'Center', 'the-post-grid' ),
|
1136 |
],
|
1137 |
],
|
1138 |
'tgp_read_more_text' => [
|
1139 |
+
'type' => 'text',
|
1140 |
+
'label' => esc_html__( 'Text', 'the-post-grid' ),
|
1141 |
],
|
1142 |
];
|
1143 |
|
1147 |
public static function rtTPGStyleFields() {
|
1148 |
$fields = [
|
1149 |
'parent_class' => [
|
1150 |
+
'type' => 'text',
|
1151 |
+
'label' => esc_html__( 'Parent class', 'the-post-grid' ),
|
1152 |
+
'class' => 'medium-text',
|
1153 |
+
'description' => esc_html__( 'Parent class for adding custom css', 'the-post-grid' ),
|
1154 |
],
|
1155 |
'primary_color' => [
|
1156 |
+
'type' => 'text',
|
1157 |
+
'label' => esc_html__( 'Primary Color', 'the-post-grid' ),
|
1158 |
+
'class' => 'rt-color',
|
1159 |
+
'default' => '#0367bf',
|
1160 |
],
|
1161 |
];
|
1162 |
|
1167 |
$fields = [
|
1168 |
|
1169 |
'button_bg_color' => [
|
1170 |
+
'type' => 'text',
|
1171 |
+
'name' => 'button_bg_color',
|
1172 |
+
'label' => esc_html__( 'Background', 'the-post-grid' ),
|
1173 |
+
'class' => 'rt-color',
|
1174 |
],
|
1175 |
'button_hover_bg_color' => [
|
1176 |
+
'type' => 'text',
|
1177 |
+
'name' => 'button_hover_bg_color',
|
1178 |
+
'label' => esc_html__( 'Hover Background', 'the-post-grid' ),
|
1179 |
+
'class' => 'rt-color',
|
1180 |
],
|
1181 |
'button_active_bg_color' => [
|
1182 |
+
'type' => 'text',
|
1183 |
+
'label' => esc_html__( 'Active Background (Isotop)', 'the-post-grid' ),
|
1184 |
+
'class' => 'rt-color',
|
1185 |
],
|
1186 |
'button_text_bg_color' => [
|
1187 |
+
'type' => 'text',
|
1188 |
+
'label' => esc_html__( 'Text', 'the-post-grid' ),
|
1189 |
+
'class' => 'rt-color',
|
1190 |
],
|
1191 |
'button_hover_text_color' => [
|
1192 |
+
'type' => 'text',
|
1193 |
+
'label' => esc_html__( 'Text Hover', 'the-post-grid' ),
|
1194 |
+
'class' => 'rt-color',
|
1195 |
],
|
1196 |
];
|
1197 |
|
1201 |
public static function rtTPGStyleHeading() {
|
1202 |
$fields = [
|
1203 |
'tpg_heading_bg' => [
|
1204 |
+
'type' => 'text',
|
1205 |
+
'class' => 'rt-color',
|
1206 |
+
'label' => esc_html__( 'Background Color', 'the-post-grid' ),
|
1207 |
],
|
1208 |
'tpg_heading_color' => [
|
1209 |
+
'type' => 'text',
|
1210 |
+
'class' => 'rt-color',
|
1211 |
+
'label' => esc_html__( 'Text Color', 'the-post-grid' ),
|
1212 |
],
|
1213 |
'tpg_heading_border_color' => [
|
1214 |
+
'type' => 'text',
|
1215 |
+
'class' => 'rt-color',
|
1216 |
+
'label' => esc_html__( 'Border Color', 'the-post-grid' ),
|
1217 |
],
|
1218 |
'tpg_heading_border_size' => [
|
1219 |
+
'type' => 'number',
|
1220 |
+
'class' => 'small-text',
|
1221 |
+
'label' => esc_html__( 'Border Size', 'the-post-grid' ),
|
1222 |
+
'description' => esc_html__( 'Leave it blank for default', 'the-post-grid' ),
|
1223 |
],
|
1224 |
'tpg_heading_margin' => [
|
1225 |
+
'type' => 'text',
|
1226 |
+
'class' => 'medium-text tpg-spacing-field',
|
1227 |
+
'label' => esc_html__( 'Margin', 'the-post-grid' ),
|
1228 |
+
'description' => esc_html__( 'Multiple value allowed separated by comma 12,0,5,10', 'the-post-grid' ),
|
1229 |
],
|
1230 |
'tpg_heading_padding' => [
|
1231 |
+
'type' => 'text',
|
1232 |
+
'class' => 'medium-text tpg-spacing-field',
|
1233 |
+
'label' => esc_html__( 'Padding', 'the-post-grid' ),
|
1234 |
+
'description' => esc_html__( 'Leave it blank for default, multiple value allowed separated by comma 12,0,5,10', 'the-post-grid' ),
|
1235 |
],
|
1236 |
];
|
1237 |
|
1241 |
public static function rtTPGStyleFullArea() {
|
1242 |
$fields = [
|
1243 |
'tpg_full_area_bg' => [
|
1244 |
+
'type' => 'text',
|
1245 |
+
'class' => 'rt-color',
|
1246 |
+
'label' => esc_html__( 'Background', 'the-post-grid' ),
|
1247 |
],
|
1248 |
'tpg_full_area_margin' => [
|
1249 |
+
'type' => 'text',
|
1250 |
+
'class' => 'medium-text',
|
1251 |
+
'label' => esc_html__( 'Margin', 'the-post-grid' ),
|
1252 |
+
'description' => esc_html__( 'Multiple value allowed separated by comma 12,0,5,10', 'the-post-grid' ),
|
1253 |
],
|
1254 |
'tpg_full_area_padding' => [
|
1255 |
+
'type' => 'text',
|
1256 |
+
'class' => 'medium-text',
|
1257 |
+
'label' => esc_html__( 'Padding', 'the-post-grid' ),
|
1258 |
+
'description' => esc_html__( 'Multiple value allowed separated by comma 12,0,5,10', 'the-post-grid' ),
|
1259 |
],
|
1260 |
];
|
1261 |
|
1265 |
public static function rtTPGStyleContentWrap() {
|
1266 |
$fields = [
|
1267 |
'tpg_content_wrap_bg' => [
|
1268 |
+
'type' => 'text',
|
1269 |
+
'class' => 'rt-color',
|
1270 |
+
'label' => esc_html__( 'Background Color', 'the-post-grid' ),
|
1271 |
],
|
1272 |
'tpg_content_wrap_shadow' => [
|
1273 |
+
'type' => 'text',
|
1274 |
+
'class' => 'rt-color',
|
1275 |
+
'label' => esc_html__( 'Box Shadow Color', 'the-post-grid' ),
|
1276 |
],
|
1277 |
'tpg_content_wrap_border_color' => [
|
1278 |
+
'type' => 'text',
|
1279 |
+
'class' => 'rt-color',
|
1280 |
+
'label' => esc_html__( 'Border Color', 'the-post-grid' ),
|
1281 |
],
|
1282 |
'tpg_content_wrap_border' => [
|
1283 |
+
'type' => 'number',
|
1284 |
+
'class' => 'small-text',
|
1285 |
+
'label' => esc_html__( 'Border Width', 'the-post-grid' ),
|
1286 |
+
'description' => esc_html__( 'Leave it blank for default', 'the-post-grid' ),
|
1287 |
],
|
1288 |
'tpg_content_wrap_border_radius' => [
|
1289 |
+
'type' => 'number',
|
1290 |
+
'class' => 'small-text',
|
1291 |
+
'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
|
1292 |
],
|
1293 |
'tpg_box_padding' => [
|
1294 |
+
'type' => 'text',
|
1295 |
+
'class' => 'medium-text',
|
1296 |
+
'label' => esc_html__( 'Box Padding', 'the-post-grid' ),
|
1297 |
+
'description' => esc_html__( 'Multiple value allowed separated by comma 12,0,5,10', 'the-post-grid' ),
|
1298 |
],
|
1299 |
'tpg_content_padding' => [
|
1300 |
+
'type' => 'text',
|
1301 |
+
'class' => 'medium-text',
|
1302 |
+
'label' => esc_html__( 'Content Padding', 'the-post-grid' ),
|
1303 |
+
'description' => esc_html__( 'Multiple value allowed separated by comma 12,0,5,10', 'the-post-grid' ),
|
1304 |
],
|
1305 |
];
|
1306 |
|
1310 |
public static function rtTPGStyleCategory() {
|
1311 |
$fields = [
|
1312 |
'tpg_category_bg' => [
|
1313 |
+
'type' => 'text',
|
1314 |
+
'class' => 'rt-color',
|
1315 |
+
'label' => esc_html__( 'Background Color', 'the-post-grid' ),
|
1316 |
],
|
1317 |
'tpg_category_color' => [
|
1318 |
+
'type' => 'text',
|
1319 |
+
'class' => 'rt-color',
|
1320 |
+
'label' => esc_html__( 'Text Color', 'the-post-grid' ),
|
1321 |
],
|
1322 |
'tpg_category_border_radius' => [
|
1323 |
+
'type' => 'number',
|
1324 |
+
'class' => 'small-text',
|
1325 |
+
'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
|
1326 |
+
'description' => esc_html__( 'Leave it blank for default', 'the-post-grid' ),
|
1327 |
],
|
1328 |
'tpg_category_margin' => [
|
1329 |
+
'type' => 'text',
|
1330 |
+
'class' => 'medium-text tpg-spacing-field',
|
1331 |
+
'label' => esc_html__( 'Margin', 'the-post-grid' ),
|
1332 |
+
'description' => esc_html__( 'Multiple value allowed separated by comma 12,0,5,10', 'the-post-grid' ),
|
1333 |
],
|
1334 |
'tpg_category_padding' => [
|
1335 |
+
'type' => 'text',
|
1336 |
+
'class' => 'medium-text tpg-spacing-field',
|
1337 |
+
'label' => esc_html__( 'Padding', 'the-post-grid' ),
|
1338 |
+
'description' => esc_html__( 'Multiple value allowed separated by comma 12,0,5,10', 'the-post-grid' ),
|
1339 |
],
|
1340 |
'rt_tpg_category_font_size' => [
|
1341 |
+
'type' => 'select',
|
1342 |
+
'class' => 'rt-select2',
|
1343 |
+
'label' => esc_html__( 'Font Size', 'the-post-grid' ),
|
1344 |
+
'blank' => esc_html__( 'Default', 'the-post-grid' ),
|
1345 |
+
'options' => self::scFontSize(),
|
1346 |
],
|
1347 |
];
|
1348 |
|
1357 |
|
1358 |
$fields = [
|
1359 |
'item_fields' => [
|
1360 |
+
'type' => 'checkbox',
|
1361 |
+
'name' => 'item_fields',
|
1362 |
+
'label' => esc_html__( 'Field selection', 'the-post-grid' ),
|
1363 |
+
'id' => 'item-fields',
|
1364 |
+
'multiple' => true,
|
1365 |
+
'alignment' => 'vertical',
|
1366 |
+
'default' => array_keys( $itemField ),
|
1367 |
+
'options' => $itemField,
|
1368 |
],
|
1369 |
];
|
1370 |
if ( $cf = Fns::is_acf() ) {
|
1372 |
$post_type = get_post_meta( $post->ID, 'tpg_post_type', true );
|
1373 |
$plist = self::getCFPluginList();
|
1374 |
$fields['cf_group'] = [
|
1375 |
+
'type' => 'checkbox',
|
1376 |
+
'name' => 'cf_group',
|
1377 |
+
'holderClass' => 'tpg-hidden cf-fields cf-group',
|
1378 |
+
'label' => 'Custom Field group ' . " ({$plist[$cf]})",
|
1379 |
+
'multiple' => true,
|
1380 |
+
'alignment' => 'vertical',
|
1381 |
+
'id' => 'cf_group',
|
1382 |
+
'options' => Fns::get_groups_by_post_type( $post_type, $cf ),
|
1383 |
];
|
1384 |
$fields['cf_hide_empty_value'] = [
|
1385 |
+
'type' => 'checkbox',
|
1386 |
+
'name' => 'cf_hide_empty_value',
|
1387 |
+
'holderClass' => 'tpg-hidden cf-fields',
|
1388 |
+
'label' => esc_html__( 'Hide field with empty value', 'the-post-grid' ),
|
1389 |
+
'default' => 1,
|
1390 |
];
|
1391 |
$fields['cf_show_only_value'] = [
|
1392 |
+
'type' => 'checkbox',
|
1393 |
+
'name' => 'cf_show_only_value',
|
1394 |
+
'holderClass' => 'tpg-hidden cf-fields',
|
1395 |
+
'label' => esc_html__( 'Show only value of field', 'the-post-grid' ),
|
1396 |
+
'description' => esc_html__( 'By default both name & value of field is shown', 'the-post-grid' ),
|
1397 |
];
|
1398 |
$fields['cf_hide_group_title'] = [
|
1399 |
+
'type' => 'checkbox',
|
1400 |
+
'name' => 'cf_hide_group_title',
|
1401 |
+
'holderClass' => 'tpg-hidden cf-fields',
|
1402 |
+
'label' => esc_html__( 'Hide group title', 'the-post-grid' ),
|
1403 |
];
|
1404 |
}
|
1405 |
|
1409 |
|
1410 |
public static function getCFPluginList() {
|
1411 |
return [
|
1412 |
+
'acf' => esc_html__( 'Advanced Custom Field', 'the-post-grid' ),
|
1413 |
];
|
1414 |
}
|
1415 |
|
1416 |
public static function rtMediaSource() {
|
1417 |
return [
|
1418 |
+
'feature_image' => esc_html__( 'Feature Image', 'the-post-grid' ),
|
1419 |
+
'first_image' => esc_html__( 'First Image from content', 'the-post-grid' ),
|
1420 |
];
|
1421 |
}
|
1422 |
|
1423 |
public static function get_image_types() {
|
1424 |
return [
|
1425 |
+
'normal' => esc_html__( 'Normal', 'the-post-grid' ),
|
1426 |
+
'circle' => esc_html__( 'Circle', 'the-post-grid' ),
|
1427 |
];
|
1428 |
}
|
1429 |
|
1430 |
public static function get_limit_type( $content = null ) {
|
1431 |
$types = [
|
1432 |
+
'character' => esc_html__( 'Character', 'the-post-grid' ),
|
1433 |
+
'word' => esc_html__( 'Word', 'the-post-grid' ),
|
1434 |
];
|
1435 |
if ( $content === 'content' ) {
|
1436 |
+
$types['full'] = esc_html__( 'Full Content', 'the-post-grid' );
|
1437 |
}
|
1438 |
|
1439 |
return apply_filters( 'tpg_limit_type', $types, $content );
|
1441 |
|
1442 |
public static function scColumns() {
|
1443 |
return [
|
1444 |
+
1 => esc_html__( 'Column 1', 'the-post-grid' ),
|
1445 |
+
2 => esc_html__( 'Column 2', 'the-post-grid' ),
|
1446 |
+
3 => esc_html__( 'Column 3', 'the-post-grid' ),
|
1447 |
+
4 => esc_html__( 'Column 4', 'the-post-grid' ),
|
1448 |
+
5 => esc_html__( 'Column 5', 'the-post-grid' ),
|
1449 |
+
6 => esc_html__( 'Column 6', 'the-post-grid' ),
|
1450 |
];
|
1451 |
}
|
1452 |
|
1453 |
public static function tgp_filter_list() {
|
1454 |
return [
|
1455 |
+
'_taxonomy_filter' => esc_html__( 'Taxonomy filter', 'the-post-grid' ),
|
1456 |
+
'_author_filter' => esc_html__( 'Author filter', 'the-post-grid' ),
|
1457 |
+
'_order_by' => esc_html__( 'Order - Sort retrieved posts by parameter', 'the-post-grid' ),
|
1458 |
+
'_sort_order' => esc_html__( 'Sort Order - Designates the ascending or descending order of the "orderby" parameter', 'the-post-grid' ),
|
1459 |
+
'_search' => esc_html__( 'Search filter', 'the-post-grid' ),
|
1460 |
];
|
1461 |
}
|
1462 |
|
1463 |
public static function overflowOpacity() {
|
1464 |
return [
|
1465 |
+
1 => esc_html__( '10%', 'the-post-grid' ),
|
1466 |
+
2 => esc_html__( '20%', 'the-post-grid' ),
|
1467 |
+
3 => esc_html__( '30%', 'the-post-grid' ),
|
1468 |
+
4 => esc_html__( '40%', 'the-post-grid' ),
|
1469 |
+
5 => esc_html__( '50%', 'the-post-grid' ),
|
1470 |
+
6 => esc_html__( '60%', 'the-post-grid' ),
|
1471 |
+
7 => esc_html__( '70%', 'the-post-grid' ),
|
1472 |
+
8 => esc_html__( '80%', 'the-post-grid' ),
|
1473 |
+
9 => esc_html__( '90%', 'the-post-grid' ),
|
1474 |
];
|
1475 |
}
|
1476 |
|
1477 |
public static function rtTPGLayoutType() {
|
1478 |
$layoutType = [
|
1479 |
'grid' => [
|
1480 |
+
'title' => esc_html__( 'Grid', 'the-post-grid' ),
|
1481 |
'img' => rtTPG()->get_assets_uri( 'images/grid.png' ),
|
1482 |
],
|
1483 |
'grid_hover' => [
|
1484 |
+
'title' => esc_html__( 'Grid Hover', 'the-post-grid' ),
|
1485 |
'img' => rtTPG()->get_assets_uri( 'images/grid_hover.png' ),
|
1486 |
],
|
1487 |
'list' => [
|
1488 |
+
'title' => esc_html__( 'List', 'the-post-grid' ),
|
1489 |
'img' => rtTPG()->get_assets_uri( 'images/list.png' ),
|
1490 |
],
|
1491 |
'isotope' => [
|
1492 |
+
'title' => esc_html__( 'Isotope', 'the-post-grid' ),
|
1493 |
'img' => rtTPG()->get_assets_uri( 'images/isotope.png' ),
|
1494 |
],
|
1495 |
];
|
1500 |
public static function rtTPGLayouts() {
|
1501 |
$layouts = [
|
1502 |
'layout1' => [
|
1503 |
+
'title' => esc_html__( 'Grid Layout 1', 'the-post-grid' ),
|
1504 |
'layout' => 'grid',
|
1505 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/',
|
1506 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid1.png' ),
|
1507 |
],
|
1508 |
'layout12' => [
|
1509 |
+
'title' => esc_html__( 'Grid Layout 2', 'the-post-grid' ),
|
1510 |
'layout' => 'grid',
|
1511 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/grid-layout-2/',
|
1512 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid10.png' ),
|
1513 |
],
|
1514 |
'layout5' => [
|
1515 |
+
'title' => esc_html__( 'Grid Hover 1', 'the-post-grid' ),
|
1516 |
'layout' => 'grid_hover',
|
1517 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-1/',
|
1518 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid3.png' ),
|
1519 |
],
|
1520 |
'layout6' => [
|
1521 |
+
'title' => esc_html__( 'Grid Hover 2', 'the-post-grid' ),
|
1522 |
'layout' => 'grid_hover',
|
1523 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-2/',
|
1524 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid4.png' ),
|
1525 |
],
|
1526 |
'layout7' => [
|
1527 |
+
'title' => esc_html__( 'Grid Hover 3', 'the-post-grid' ),
|
1528 |
'layout' => 'grid_hover',
|
1529 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/hover-layout-3/',
|
1530 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/grid5.png' ),
|
1531 |
],
|
1532 |
'layout2' => [
|
1533 |
+
'title' => esc_html__( 'List Layout 1', 'the-post-grid' ),
|
1534 |
'layout' => 'list',
|
1535 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/list-layout-1/',
|
1536 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/list1.png' ),
|
1537 |
],
|
1538 |
'layout3' => [
|
1539 |
+
'title' => esc_html__( 'List Layout 2', 'the-post-grid' ),
|
1540 |
'layout' => 'list',
|
1541 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/list-layout-rounded-image/',
|
1542 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/list2.png' ),
|
1543 |
],
|
1544 |
'isotope1' => [
|
1545 |
+
'title' => esc_html__( 'Isotope Layout 1', 'the-post-grid' ),
|
1546 |
'layout' => 'isotope',
|
1547 |
'layout_link' => 'https://www.radiustheme.com/demo/plugins/the-post-grid/layout-4-filter/',
|
1548 |
'img' => rtTPG()->get_assets_uri( 'images/layouts/isotope1.png' ),
|
1554 |
|
1555 |
public static function rtTPGItemFields() {
|
1556 |
$items = [
|
1557 |
+
'heading' => esc_html__( 'ShortCode Heading', 'the-post-grid' ),
|
1558 |
+
'title' => esc_html__( 'Title', 'the-post-grid' ),
|
1559 |
+
'excerpt' => esc_html__( 'Excerpt', 'the-post-grid' ),
|
1560 |
+
'read_more' => esc_html__( 'Read More', 'the-post-grid' ),
|
1561 |
+
'post_date' => esc_html__( 'Post Date', 'the-post-grid' ),
|
1562 |
+
'author' => esc_html__( 'Author', 'the-post-grid' ),
|
1563 |
+
'categories' => esc_html__( 'Categories', 'the-post-grid' ),
|
1564 |
+
'tags' => esc_html__( 'Tags', 'the-post-grid' ),
|
1565 |
+
'comment_count' => esc_html__( 'Comment count', 'the-post-grid' ),
|
1566 |
];
|
1567 |
|
1568 |
return apply_filters( 'tpg_field_selection_items', $items );
|
1569 |
}
|
1570 |
|
1571 |
public static function postLoadingType() {
|
1572 |
+
return apply_filters(
|
1573 |
+
'rttpg_pagination_type',
|
1574 |
[
|
1575 |
+
'pagination' => esc_html__( 'Pagination', 'the-post-grid' ),
|
1576 |
+
]
|
1577 |
+
);
|
1578 |
}
|
1579 |
|
1580 |
public static function scGridOpt() {
|
1581 |
return [
|
1582 |
+
'even' => esc_html__( 'Even', 'the-post-grid' ),
|
1583 |
+
'masonry' => esc_html__( 'Masonry', 'the-post-grid' ),
|
1584 |
];
|
1585 |
}
|
1586 |
|
1587 |
public static function extraStyle() {
|
1588 |
+
return apply_filters(
|
1589 |
+
'tpg_extra_style',
|
1590 |
[
|
1591 |
+
'title' => esc_html__( 'Title', 'the-post-grid' ),
|
1592 |
+
'title_hover' => esc_html__( 'Title hover', 'the-post-grid' ),
|
1593 |
+
'excerpt' => esc_html__( 'Excerpt', 'the-post-grid' ),
|
1594 |
+
'meta_data' => esc_html__( 'Meta Data', 'the-post-grid' ),
|
1595 |
+
]
|
1596 |
+
);
|
1597 |
}
|
1598 |
|
1599 |
public static function scFontSize() {
|
1600 |
$num = [];
|
1601 |
for ( $i = 10; $i <= 50; $i ++ ) {
|
1602 |
+
$num[ $i ] = $i . 'px';
|
1603 |
}
|
1604 |
|
1605 |
return $num;
|
1607 |
|
1608 |
public static function scAlignment() {
|
1609 |
return [
|
1610 |
+
'left' => esc_html__( 'Left', 'the-post-grid' ),
|
1611 |
+
'right' => esc_html__( 'Right', 'the-post-grid' ),
|
1612 |
+
'center' => esc_html__( 'Center', 'the-post-grid' ),
|
1613 |
+
'justify' => esc_html__( 'Justify', 'the-post-grid' ),
|
1614 |
];
|
1615 |
}
|
1616 |
|
1617 |
public static function scReadMoreButtonPositionList() {
|
1618 |
return [
|
1619 |
+
'left' => esc_html__( 'Left', 'the-post-grid' ),
|
1620 |
+
'right' => esc_html__( 'Right', 'the-post-grid' ),
|
1621 |
+
'center' => esc_html__( 'Center', 'the-post-grid' ),
|
1622 |
];
|
1623 |
}
|
1624 |
|
1625 |
|
1626 |
public static function scTextWeight() {
|
1627 |
return [
|
1628 |
+
'normal' => esc_html__( 'Normal', 'the-post-grid' ),
|
1629 |
+
'bold' => esc_html__( 'Bold', 'the-post-grid' ),
|
1630 |
+
'bolder' => esc_html__( 'Bolder', 'the-post-grid' ),
|
1631 |
+
'lighter' => esc_html__( 'Lighter', 'the-post-grid' ),
|
1632 |
+
'inherit' => esc_html__( 'Inherit', 'the-post-grid' ),
|
1633 |
+
'initial' => esc_html__( 'Initial', 'the-post-grid' ),
|
1634 |
+
'unset' => esc_html__( 'Unset', 'the-post-grid' ),
|
1635 |
+
100 => esc_html__( '100', 'the-post-grid' ),
|
1636 |
+
200 => esc_html__( '200', 'the-post-grid' ),
|
1637 |
+
300 => esc_html__( '300', 'the-post-grid' ),
|
1638 |
+
400 => esc_html__( '400', 'the-post-grid' ),
|
1639 |
+
500 => esc_html__( '500', 'the-post-grid' ),
|
1640 |
+
600 => esc_html__( '600', 'the-post-grid' ),
|
1641 |
+
700 => esc_html__( '700', 'the-post-grid' ),
|
1642 |
+
800 => esc_html__( '800', 'the-post-grid' ),
|
1643 |
+
900 => esc_html__( '900', 'the-post-grid' ),
|
1644 |
];
|
1645 |
}
|
1646 |
|
1647 |
public static function imageCropType() {
|
1648 |
return [
|
1649 |
+
'soft' => esc_html__( 'Soft Crop', 'the-post-grid' ),
|
1650 |
+
'hard' => esc_html__( 'Hard Crop', 'the-post-grid' ),
|
1651 |
];
|
1652 |
}
|
1653 |
|
1654 |
public static function rt_filter_type() {
|
1655 |
return [
|
1656 |
+
'dropdown' => esc_html__( 'Dropdown', 'the-post-grid' ),
|
1657 |
+
'button' => esc_html__( 'Button', 'the-post-grid' ),
|
1658 |
];
|
1659 |
}
|
1660 |
|
1661 |
public static function get_pro_feature_list() {
|
1662 |
return '<ol>
|
1663 |
+
<li>Fully responsive and mobile friendly.</li>
|
1664 |
+
<li>62 Different Layouts</li>
|
1665 |
+
<li>45 Elementor Layouts</li>
|
1666 |
+
<li>Creative Slider layouts</li>
|
1667 |
+
<li>Archive page builder for Elementor</li>
|
1668 |
+
<li>Even and Masonry Grid.</li>
|
1669 |
+
<li>WooCommerce supported.</li>
|
1670 |
+
<li>EDD supported for shortcode.</li>
|
1671 |
+
<li>Custom Post Type Supported</li>
|
1672 |
+
<li>Display posts by any Taxonomy like category(s), tag(s), author(s), keyword(s)</li>
|
1673 |
+
<li>Order by Id, Title, Created date, Modified date and Menu order.</li>
|
1674 |
+
<li>Display image size (thumbnail, medium, large, full)</li>
|
1675 |
+
<li>Ajax front-end filter by category(s), tag(s), author(s), keyword(s)</li>
|
1676 |
+
<li>Isotope filter for any taxonomy ie. categories, tags...</li>
|
1677 |
+
<li>Query Post with Relation.</li>
|
1678 |
+
<li>Fields Selection.</li>
|
1679 |
+
<li>All Text and Color control.</li>
|
1680 |
+
<li>Meta Position Control.</li>
|
1681 |
+
<li>Category Position Control.</li>
|
1682 |
+
<li>Content Wrapper Style Control.</li>
|
1683 |
+
<li>Enable/Disable Pagination.</li>
|
1684 |
+
<li>AJAX Pagination (Load more and Load on Scrolling)</li>
|
1685 |
+
<li>Advanced Custom Field support</li>
|
1686 |
+
<li>Post View Count</li>
|
1687 |
+
</ol>
|
1688 |
+
<a href="' . esc_url( rtTpg()->proLink() ) . '" class="rt-admin-btn" target="_blank">' . esc_html__( 'Get Pro Version', 'the-post-grid' ) . '</a>';
|
|
|
1689 |
}
|
1690 |
+
}
|
|
app/Models/Field.php
CHANGED
@@ -1,9 +1,23 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
namespace RT\ThePostGrid\Models;
|
3 |
|
4 |
use RT\ThePostGrid\Helpers\Fns;
|
5 |
use RT\ThePostGrid\Helpers\Options;
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
class Field {
|
8 |
private $type;
|
9 |
private $name;
|
@@ -14,6 +28,7 @@ class Field {
|
|
14 |
private $class;
|
15 |
private $holderClass;
|
16 |
private $description;
|
|
|
17 |
private $options;
|
18 |
private $option;
|
19 |
private $optionLabel;
|
@@ -39,17 +54,18 @@ class Field {
|
|
39 |
|
40 |
if ( ! $this->value ) {
|
41 |
$post_id = get_the_ID();
|
42 |
-
|
|
|
43 |
$this->value = $this->default;
|
44 |
} else {
|
45 |
if ( $this->multiple ) {
|
46 |
-
if (metadata_exists('post', $post_id, $this->name)) {
|
47 |
$this->value = get_post_meta( $post_id, $this->name );
|
48 |
} else {
|
49 |
$this->value = $this->default;
|
50 |
}
|
51 |
} else {
|
52 |
-
if (metadata_exists('post', $post_id, $this->name)) {
|
53 |
$this->value = get_post_meta( $post_id, $this->name, true );
|
54 |
} else {
|
55 |
$this->value = $this->default;
|
@@ -58,43 +74,49 @@ class Field {
|
|
58 |
}
|
59 |
}
|
60 |
|
61 |
-
$this->label
|
62 |
-
$this->class
|
63 |
-
$this->holderClass
|
64 |
-
$this->placeholder
|
65 |
-
$this->description
|
66 |
-
$this->
|
67 |
-
$this->
|
68 |
-
$this->
|
69 |
-
$this->
|
70 |
-
$this->
|
71 |
-
$this->
|
|
|
72 |
|
73 |
}
|
74 |
|
75 |
-
public function Field( $key, $attr =
|
76 |
$this->setArgument( $key, $attr );
|
77 |
-
$holderId = $this->name .
|
78 |
|
79 |
-
if (!rtTPG()->hasPro()) {
|
80 |
$class = $this->holderClass;
|
81 |
} else {
|
82 |
-
$class = str_replace('pro-field', '', $this->holderClass);
|
83 |
}
|
84 |
-
$html = null;
|
85 |
-
$html .= "<div class='field-holder {$class}' id='{$holderId}'>";
|
86 |
|
87 |
-
$
|
|
|
|
|
|
|
88 |
|
89 |
if ( $this->label ) {
|
90 |
$html .= "<div class='field-label'>";
|
91 |
-
$html .=
|
92 |
-
|
93 |
-
|
|
|
94 |
}
|
95 |
-
|
|
|
96 |
}
|
|
|
97 |
$html .= "<div class='field'>";
|
|
|
98 |
switch ( $this->type ) {
|
99 |
case 'text':
|
100 |
$html .= $this->text();
|
@@ -152,492 +174,514 @@ class Field {
|
|
152 |
$html .= $this->imageSize();
|
153 |
break;
|
154 |
}
|
|
|
155 |
if ( $this->description ) {
|
156 |
-
$html .=
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
-
|
159 |
-
$html .=
|
|
|
160 |
|
161 |
return $html;
|
162 |
}
|
163 |
|
164 |
private function text() {
|
165 |
-
$holderClass = explode(' ', $this->holderClass);
|
166 |
-
|
167 |
-
$h
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
|
|
176 |
|
177 |
return $h;
|
178 |
}
|
179 |
|
180 |
private function script() {
|
181 |
-
$type =
|
182 |
-
|
183 |
-
|
|
|
184 |
}
|
185 |
-
|
186 |
-
$h
|
|
|
187 |
$h .= '<div class="rt-script-container">';
|
188 |
-
$h .= "<div name='
|
189 |
$h .= '</div>';
|
190 |
$h .= '</div>';
|
191 |
|
192 |
-
$h .=
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
$h .= '</div>';
|
199 |
|
200 |
return $h;
|
201 |
}
|
202 |
|
203 |
private function url() {
|
204 |
-
$h
|
205 |
-
$h .=
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
|
215 |
return $h;
|
216 |
}
|
217 |
|
218 |
private function number() {
|
219 |
-
$holderClass = explode(' ', $this->holderClass);
|
220 |
-
|
221 |
-
$h
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
|
|
230 |
|
231 |
return $h;
|
232 |
}
|
233 |
|
234 |
private function select() {
|
235 |
-
$holderClass = explode(' ', $this->holderClass);
|
236 |
-
$atts
|
237 |
-
$h
|
|
|
238 |
if ( $this->multiple ) {
|
239 |
$this->attr = " style='min-width:160px;'";
|
240 |
-
$this->name = $this->name .
|
241 |
$this->attr = $this->attr . " multiple='multiple'";
|
242 |
-
$this->value = ( is_array( $this->value ) && ! empty( $this->value ) ? $this->value :
|
243 |
} else {
|
244 |
-
$this->value =
|
245 |
}
|
246 |
|
247 |
-
$h .=
|
|
|
248 |
if ( $this->blank ) {
|
249 |
-
$h .=
|
250 |
}
|
|
|
251 |
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
252 |
foreach ( $this->options as $key => $value ) {
|
253 |
-
$slt = ( in_array( $key, $this->value ) ?
|
254 |
-
$h
|
255 |
}
|
256 |
}
|
257 |
-
|
|
|
258 |
|
259 |
return $h;
|
260 |
}
|
261 |
|
262 |
private function textArea() {
|
263 |
-
$holderClass = explode(' ', $this->holderClass);
|
264 |
-
|
265 |
-
$h
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
|
|
272 |
|
273 |
return $h;
|
274 |
}
|
275 |
|
276 |
private function image() {
|
277 |
-
$holderClass = explode(' ', $this->holderClass);
|
|
|
278 |
$h = null;
|
279 |
-
$h .= "<div class='rt-image-holder'>";
|
280 |
-
$h .= "<input type='hidden' name='{$this->name}' value='{$this->value}' id='{$this->id}' class='hidden-image-id' />";
|
281 |
$img = null;
|
282 |
-
|
|
|
|
|
|
|
|
|
283 |
if ( $id = absint( $this->value ) ) {
|
284 |
$aImg = wp_get_attachment_image_src( $id, 'thumbnail' );
|
285 |
-
$img =
|
286 |
$c = null;
|
287 |
}
|
288 |
|
289 |
-
$h .=
|
290 |
|
291 |
-
$h .=
|
292 |
|
293 |
return $h;
|
294 |
}
|
295 |
|
296 |
private function imageSize() {
|
297 |
-
$width
|
298 |
-
$height
|
299 |
-
$cropV
|
300 |
-
|
301 |
-
$h
|
302 |
-
$h
|
303 |
-
$h
|
304 |
-
$h
|
305 |
-
$h
|
306 |
-
$h
|
307 |
-
$h
|
308 |
-
$h
|
309 |
-
$h
|
310 |
-
$h
|
311 |
-
$h
|
312 |
-
$h
|
|
|
|
|
313 |
$cropList = Options::imageCropType();
|
|
|
314 |
foreach ( $cropList as $crop => $cropLabel ) {
|
315 |
-
$cSl = ( $crop == $cropV ?
|
316 |
-
$h
|
317 |
}
|
318 |
-
|
319 |
-
$h .=
|
320 |
-
$h .=
|
|
|
321 |
|
322 |
return $h;
|
323 |
}
|
324 |
|
325 |
private function checkbox() {
|
326 |
-
$holderClass
|
327 |
-
$this->alignment .= (in_array('pro-field', $holderClass)) && !rtTPG()->hasPro() ? ' disabled' : '';
|
328 |
-
$h
|
|
|
329 |
if ( $this->multiple ) {
|
330 |
-
$this->name = $this->name .
|
331 |
-
$this->value = ( is_array( $this->value ) && ! empty( $this->value ) ? $this->value :
|
332 |
}
|
|
|
333 |
if ( $this->multiple ) {
|
334 |
-
$h .=
|
|
|
335 |
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
336 |
foreach ( $this->options as $key => $value ) {
|
337 |
-
$checked = ( in_array( $key, $this->value ) ?
|
338 |
|
339 |
-
$h
|
340 |
-
<input type='checkbox' id='{$this->id}-{$key}' {$checked} name='{$this->name}' value='{$key}'>{$value}
|
341 |
-
</label>";
|
342 |
}
|
343 |
}
|
344 |
-
|
|
|
345 |
} else {
|
346 |
-
$checked = ( $this->value ?
|
347 |
-
$h
|
348 |
}
|
349 |
|
350 |
return $h;
|
351 |
}
|
352 |
|
353 |
private function switchField() {
|
354 |
-
$h
|
355 |
-
$checked = $this->value ?
|
356 |
-
$h
|
357 |
|
358 |
return $h;
|
359 |
}
|
360 |
|
361 |
private function checkboxFilter() {
|
362 |
-
|
363 |
global $post;
|
364 |
|
365 |
-
$pt
|
366 |
-
$advFilters
|
367 |
-
|
368 |
-
$
|
369 |
|
370 |
-
$h = null;
|
371 |
if ( $this->multiple ) {
|
372 |
-
$this->name = $this->name .
|
373 |
-
$this->value = ( is_array( $this->value ) && ! empty( $this->value ) ? $this->value :
|
374 |
}
|
|
|
375 |
if ( $this->multiple ) {
|
376 |
-
$h .=
|
|
|
377 |
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
378 |
foreach ( $this->options as $key => $value ) {
|
379 |
-
$checked = ( in_array( $key, $this->value ) ?
|
380 |
|
381 |
$h .= '<div class="checkbox-filter-field">';
|
|
|
382 |
|
383 |
-
$
|
384 |
-
<input type='checkbox' id='{$this->id}-{$key}' {$checked} name='{$this->name}' value='{$key}'>{$value}
|
385 |
-
</label>";
|
386 |
-
|
387 |
-
//foreach($advFilters['post_filter']['options'] as $key => $filter){
|
388 |
-
|
389 |
-
if($key == 'tpg_taxonomy'){
|
390 |
$h .= "<div class='rt-tpg-filter taxonomy tpg_taxonomy tpg-hidden'>";
|
391 |
|
392 |
-
if(isset($pt) && $pt){
|
393 |
-
$taxonomies
|
394 |
-
$taxA
|
395 |
-
$post_filter = get_post_meta($post->ID, 'post_filter');
|
396 |
|
397 |
$h .= "<div class='taxonomy-field'>";
|
398 |
-
|
|
|
399 |
$h .= Fns::rtFieldGenerator(
|
400 |
-
|
401 |
-
'tpg_taxonomy' =>
|
402 |
-
'type'
|
403 |
-
'label'
|
404 |
-
'id'
|
405 |
-
|
406 |
-
'options'
|
407 |
-
|
408 |
-
|
409 |
);
|
410 |
-
}else{
|
411 |
-
$h .= '<div class="field-holder">No Taxonomy found</div>';
|
412 |
}
|
413 |
-
|
|
|
414 |
$h .= "<div class='rt-tpg-filter-item term-filter-item tpg-hidden'>";
|
415 |
$h .= '<div class="field-holder">';
|
416 |
$h .= '<div class="field-label">Terms</div>';
|
417 |
$h .= '<div class="field term-filter-holder">';
|
418 |
-
if(is_array($taxA) && !empty($taxA)){
|
419 |
-
foreach($taxA as $tax){
|
420 |
|
421 |
-
|
|
|
|
|
|
|
422 |
$h .= Fns::rtFieldGenerator(
|
423 |
-
|
424 |
-
'term_'
|
425 |
-
'type'
|
426 |
-
'label'
|
427 |
-
'class'
|
428 |
'holderClass' => "term-filter-item {$tax}",
|
429 |
-
'value'
|
430 |
-
|
431 |
-
'options'
|
432 |
-
|
433 |
-
|
434 |
);
|
435 |
$h .= Fns::rtFieldGenerator(
|
436 |
-
|
437 |
-
'term_operator_'
|
438 |
-
'type'
|
439 |
-
'label'
|
440 |
-
'class'
|
441 |
'holderClass' => "term-filter-item-operator {$tax}",
|
442 |
-
'value'
|
443 |
-
'options' => Options::rtTermOperators()
|
444 |
-
|
445 |
-
|
446 |
);
|
447 |
-
$h .=
|
448 |
}
|
449 |
}
|
450 |
-
|
451 |
-
$h .=
|
|
|
452 |
|
453 |
$h .= Fns::rtFieldGenerator(
|
454 |
-
|
455 |
-
'taxonomy_relation' =>
|
456 |
-
'type'
|
457 |
-
'label'
|
458 |
-
'class'
|
459 |
-
'holderClass' =>
|
460 |
-
'value'
|
461 |
-
'options'
|
462 |
-
|
463 |
-
|
464 |
);
|
465 |
|
466 |
-
$h .=
|
467 |
-
}else{
|
468 |
-
|
469 |
$h .= "<div class='taxonomy-field'>";
|
470 |
-
$h .=
|
471 |
$h .= "<div class='rt-tpg-filter-item'>";
|
472 |
$h .= '<div class="field-holder">';
|
473 |
$h .= '<div class="field-label">Terms</div>';
|
474 |
$h .= '<div class="field term-filter-holder">';
|
475 |
-
$h .=
|
476 |
-
$h .=
|
477 |
-
$h .=
|
478 |
$h .= Fns::rtFieldGenerator(
|
479 |
-
|
480 |
-
'taxonomy_relation' =>
|
481 |
-
'type'
|
482 |
-
'label'
|
483 |
-
'class'
|
484 |
-
'holderClass' =>
|
485 |
-
'default'
|
486 |
-
'options'
|
487 |
-
|
488 |
-
|
489 |
);
|
490 |
}
|
491 |
-
|
492 |
-
|
493 |
-
|
|
|
494 |
$h .= "<div class='rt-tpg-filter-item'>";
|
495 |
-
$h .="<div class='field-holder'>";
|
496 |
-
$h .="<div class='field'>";
|
497 |
$h .= Fns::rtFieldGenerator(
|
498 |
-
|
499 |
-
'order_by' =>
|
500 |
-
'type'
|
501 |
-
'label'
|
502 |
-
'class'
|
503 |
-
'value'
|
504 |
-
'options'
|
505 |
-
'description' =>
|
506 |
-
|
507 |
-
|
508 |
);
|
509 |
$h .= Fns::rtFieldGenerator(
|
510 |
-
|
511 |
-
'tpg_meta_key' =>
|
512 |
-
'type'
|
513 |
-
'label'
|
514 |
-
'class'
|
515 |
'holderClass' => 'tpg-hidden',
|
516 |
-
'value'
|
517 |
-
|
518 |
-
|
519 |
);
|
520 |
$h .= Fns::rtFieldGenerator(
|
521 |
-
|
522 |
-
'order' =>
|
523 |
-
'type'
|
524 |
-
'label'
|
525 |
-
'class'
|
526 |
'alignment' => 'vertical',
|
527 |
-
'default'
|
528 |
-
'value'
|
529 |
-
'options'
|
530 |
-
|
531 |
-
|
532 |
);
|
533 |
-
$h .=
|
534 |
-
$h .=
|
535 |
-
$h .=
|
536 |
-
$h .=
|
537 |
-
}
|
538 |
-
$h .=
|
539 |
$h .= "<div class='rt-tpg-filter-item'>";
|
540 |
$h .= Fns::rtFieldGenerator(
|
541 |
-
|
542 |
-
$key =>
|
543 |
-
'type'
|
544 |
-
'label'
|
545 |
-
'class'
|
546 |
-
'value'
|
547 |
-
|
548 |
-
'options'
|
549 |
-
|
550 |
-
|
551 |
);
|
552 |
-
$h .=
|
553 |
-
$h .=
|
554 |
-
}
|
555 |
-
$h .=
|
556 |
$h .= "<div class='rt-tpg-filter-item'>";
|
557 |
$h .= Fns::rtFieldGenerator(
|
558 |
-
|
559 |
-
$key =>
|
560 |
-
'type'
|
561 |
-
'label'
|
562 |
-
'class'
|
563 |
-
'default'
|
564 |
-
'value'
|
565 |
-
|
566 |
-
'options'
|
567 |
-
|
568 |
-
|
569 |
);
|
570 |
-
$h .=
|
571 |
-
$h .=
|
572 |
-
}
|
573 |
-
$h .=
|
574 |
$h .= "<div class='rt-tpg-filter-item'>";
|
575 |
$h .= Fns::rtFieldGenerator(
|
576 |
-
|
577 |
-
$key =>
|
578 |
-
'type'
|
579 |
-
'label' => 'Keyword',
|
580 |
'class' => 'filter-item full',
|
581 |
-
'value' => get_post_meta($post->ID, $key, true)
|
582 |
-
|
583 |
-
|
584 |
);
|
585 |
-
$h .=
|
586 |
-
$h .=
|
587 |
-
}
|
588 |
-
$range_start = get_post_meta($post->ID, 'date_range_start', true);
|
589 |
-
$range_end
|
590 |
$range_value = [
|
591 |
'start' => $range_start,
|
592 |
-
'end'
|
593 |
];
|
594 |
-
$h
|
595 |
-
$h
|
596 |
-
$h
|
597 |
-
|
598 |
-
$key=>
|
599 |
-
'type'
|
600 |
-
'label'
|
601 |
-
'class'
|
602 |
-
'value'
|
603 |
'description' => "Date format should be 'yyyy-mm-dd'",
|
604 |
-
|
605 |
-
|
606 |
);
|
607 |
-
$h
|
608 |
-
$h
|
609 |
}
|
610 |
-
//}
|
611 |
|
612 |
$h .= '</div>';
|
613 |
}
|
614 |
}
|
615 |
-
$h .=
|
616 |
} else {
|
617 |
-
$checked = ( $this->value ?
|
618 |
-
$h
|
619 |
}
|
620 |
|
621 |
return $h;
|
622 |
}
|
623 |
|
624 |
private function radioField() {
|
625 |
-
$holderClass
|
626 |
-
$this->alignment .= (in_array('pro-field', $holderClass)) && !rtTPG()->hasPro() ? ' disabled' : '';
|
627 |
-
$h
|
628 |
-
|
|
|
|
|
629 |
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
630 |
foreach ( $this->options as $key => $value ) {
|
631 |
-
$checked = ( $key == $this->value ?
|
632 |
-
|
633 |
-
|
634 |
-
}*/
|
635 |
-
$h .= "<label for='{$this->name}-{$key}'>
|
636 |
-
<input type='radio' id='{$this->id}-{$key}' {$checked} name='{$this->name}' value='{$key}'>{$value}
|
637 |
-
</label>";
|
638 |
}
|
639 |
}
|
640 |
-
|
|
|
641 |
|
642 |
return $h;
|
643 |
}
|
@@ -648,71 +692,71 @@ class Field {
|
|
648 |
* @return String
|
649 |
*/
|
650 |
private function radioImage() {
|
651 |
-
$h
|
652 |
$id = 'rttpg-' . $this->name;
|
653 |
|
654 |
-
$h
|
655 |
$selected_value = $this->value;
|
656 |
|
657 |
-
if ( is_array($this->options) && !empty($this->options) ) {
|
658 |
-
foreach ($this->options as $key => $value) {
|
659 |
-
$checked
|
660 |
-
$title
|
661 |
-
$link
|
662 |
-
$linkHtml = empty($link) ? esc_html($title) : '<a href="'.esc_url($link).'" target="_blank">'.esc_html($title).'</a>';
|
663 |
-
$layout
|
664 |
-
$taghtml
|
665 |
-
$h
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
|
|
675 |
'',
|
676 |
esc_attr( $key ),
|
677 |
-
esc_attr($checked),
|
678 |
-
esc_attr($this->name),
|
679 |
-
esc_url($value['img']),
|
680 |
-
esc_attr($title),
|
681 |
-
esc_attr($layout),
|
682 |
-
$linkHtml,
|
683 |
-
$taghtml
|
684 |
);
|
685 |
}
|
686 |
}
|
687 |
-
$h .=
|
688 |
return $h;
|
689 |
}
|
690 |
|
691 |
private function dateRange() {
|
692 |
$h = null;
|
693 |
-
$this->name = ( $this->name ? $this->name :
|
694 |
-
$h
|
695 |
-
$h
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
$h
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
$h
|
714 |
|
715 |
return $h;
|
716 |
}
|
717 |
-
|
718 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Fields class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
+
|
8 |
namespace RT\ThePostGrid\Models;
|
9 |
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
use RT\ThePostGrid\Helpers\Options;
|
12 |
|
13 |
+
// Do not allow directly accessing this file.
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit( 'This script cannot be accessed directly.' );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Fields class.
|
20 |
+
*/
|
21 |
class Field {
|
22 |
private $type;
|
23 |
private $name;
|
28 |
private $class;
|
29 |
private $holderClass;
|
30 |
private $description;
|
31 |
+
private $descriptionAdv;
|
32 |
private $options;
|
33 |
private $option;
|
34 |
private $optionLabel;
|
54 |
|
55 |
if ( ! $this->value ) {
|
56 |
$post_id = get_the_ID();
|
57 |
+
|
58 |
+
if ( ! Fns::meta_exist( $this->name, $post_id ) && $pagenow == 'post-new.php' ) {
|
59 |
$this->value = $this->default;
|
60 |
} else {
|
61 |
if ( $this->multiple ) {
|
62 |
+
if ( metadata_exists( 'post', $post_id, $this->name ) ) {
|
63 |
$this->value = get_post_meta( $post_id, $this->name );
|
64 |
} else {
|
65 |
$this->value = $this->default;
|
66 |
}
|
67 |
} else {
|
68 |
+
if ( metadata_exists( 'post', $post_id, $this->name ) ) {
|
69 |
$this->value = get_post_meta( $post_id, $this->name, true );
|
70 |
} else {
|
71 |
$this->value = $this->default;
|
74 |
}
|
75 |
}
|
76 |
|
77 |
+
$this->label = isset( $attr['label'] ) ? ( $attr['label'] ? $attr['label'] : null ) : null;
|
78 |
+
$this->class = isset( $attr['class'] ) ? ( $attr['class'] ? $attr['class'] : null ) : null;
|
79 |
+
$this->holderClass = isset( $attr['holderClass'] ) ? ( $attr['holderClass'] ? $attr['holderClass'] : null ) : null;
|
80 |
+
$this->placeholder = isset( $attr['placeholder'] ) ? ( $attr['placeholder'] ? $attr['placeholder'] : null ) : null;
|
81 |
+
$this->description = isset( $attr['description'] ) ? ( $attr['description'] ? $attr['description'] : null ) : null;
|
82 |
+
$this->descriptionAdv = isset( $attr['description_adv'] ) ? ( $attr['description_adv'] ? $attr['description_adv'] : null ) : null;
|
83 |
+
$this->options = isset( $attr['options'] ) ? ( $attr['options'] ? $attr['options'] : [] ) : [];
|
84 |
+
$this->option = isset( $attr['option'] ) ? ( $attr['option'] ? $attr['option'] : null ) : null;
|
85 |
+
$this->optionLabel = isset( $attr['optionLabel'] ) ? ( $attr['optionLabel'] ? $attr['optionLabel'] : null ) : null;
|
86 |
+
$this->attr = isset( $attr['attr'] ) ? ( $attr['attr'] ? $attr['attr'] : null ) : null;
|
87 |
+
$this->alignment = isset( $attr['alignment'] ) ? ( $attr['alignment'] ? $attr['alignment'] : null ) : null;
|
88 |
+
$this->blank = ! empty( $attr['blank'] ) ? $attr['blank'] : null;
|
89 |
|
90 |
}
|
91 |
|
92 |
+
public function Field( $key, $attr = [] ) {
|
93 |
$this->setArgument( $key, $attr );
|
94 |
+
$holderId = $this->name . '_holder';
|
95 |
|
96 |
+
if ( ! rtTPG()->hasPro() ) {
|
97 |
$class = $this->holderClass;
|
98 |
} else {
|
99 |
+
$class = str_replace( 'pro-field', '', $this->holderClass );
|
100 |
}
|
|
|
|
|
101 |
|
102 |
+
$html = null;
|
103 |
+
$html .= '<div class="field-holder ' . esc_attr( $class ) . '" id="' . esc_attr( $holderId ) . '">';
|
104 |
+
|
105 |
+
$holderClass = explode( ' ', $this->holderClass );
|
106 |
|
107 |
if ( $this->label ) {
|
108 |
$html .= "<div class='field-label'>";
|
109 |
+
$html .= '<label>' . Fns::htmlKses( $this->label, 'basic' ) . '</label>';
|
110 |
+
|
111 |
+
if ( in_array( 'pro-field', $holderClass, true ) && ! rtTPG()->hasPro() ) {
|
112 |
+
$html .= '<span class="rttpg-tooltip">[Pro]<span class="rttpg-tooltip-text">' . esc_html__( 'Premium Option', 'the-post-grid' ) . '</span></span>';
|
113 |
}
|
114 |
+
|
115 |
+
$html .= '</div>';
|
116 |
}
|
117 |
+
|
118 |
$html .= "<div class='field'>";
|
119 |
+
|
120 |
switch ( $this->type ) {
|
121 |
case 'text':
|
122 |
$html .= $this->text();
|
174 |
$html .= $this->imageSize();
|
175 |
break;
|
176 |
}
|
177 |
+
|
178 |
if ( $this->description ) {
|
179 |
+
$html .= '<p class="description">' . Fns::htmlKses( $this->description, 'basic' ) . '</p>';
|
180 |
+
}
|
181 |
+
|
182 |
+
if ( $this->descriptionAdv ) {
|
183 |
+
$html .= '<p class="description">' . Fns::htmlKses( $this->descriptionAdv, 'advanced' ) . '</p>';
|
184 |
}
|
185 |
+
|
186 |
+
$html .= '</div>'; // field.
|
187 |
+
$html .= '</div>'; // field holder.
|
188 |
|
189 |
return $html;
|
190 |
}
|
191 |
|
192 |
private function text() {
|
193 |
+
$holderClass = explode( ' ', $this->holderClass );
|
194 |
+
|
195 |
+
$h = null;
|
196 |
+
$h .= '<input
|
197 |
+
type="text"
|
198 |
+
class="' . esc_attr( $this->class ) . '"
|
199 |
+
id="' . esc_attr( $this->id ) . '"
|
200 |
+
value="' . esc_attr( $this->value ) . '"
|
201 |
+
name="' . esc_attr( $this->name ) . '"
|
202 |
+
placeholder="' . esc_attr( $this->placeholder ) . '"
|
203 |
+
' . Fns::htmlKses( $this->attr, 'basic' ) . '
|
204 |
+
/>';
|
205 |
|
206 |
return $h;
|
207 |
}
|
208 |
|
209 |
private function script() {
|
210 |
+
$type = 'script';
|
211 |
+
|
212 |
+
if ( $this->id == 'custom-css' ) {
|
213 |
+
$type = 'css';
|
214 |
}
|
215 |
+
|
216 |
+
$h = null;
|
217 |
+
$h .= '<div class="rt-script-wrapper" data-type="' . esc_attr( $type ) . '">';
|
218 |
$h .= '<div class="rt-script-container">';
|
219 |
+
$h .= "<div name='" . esc_attr( $this->name ) . "' id='ret-" . absint( wp_rand() ) . "' class='rt-script'>";
|
220 |
$h .= '</div>';
|
221 |
$h .= '</div>';
|
222 |
|
223 |
+
$h .= '<textarea
|
224 |
+
style="display: none;"
|
225 |
+
class="rt-script-textarea"
|
226 |
+
id="' . esc_attr( $this->id ) . '"
|
227 |
+
name="' . esc_attr( $this->name ) . '"
|
228 |
+
>' . wp_strip_all_tags( $this->value ) . '</textarea>';
|
229 |
$h .= '</div>';
|
230 |
|
231 |
return $h;
|
232 |
}
|
233 |
|
234 |
private function url() {
|
235 |
+
$h = null;
|
236 |
+
$h .= '<input
|
237 |
+
type="url"
|
238 |
+
class="' . esc_attr( $this->class ) . '"
|
239 |
+
id="' . esc_attr( $this->id ) . '"
|
240 |
+
value="' . esc_url( $this->value ) . '"
|
241 |
+
name="' . esc_attr( $this->name ) . '"
|
242 |
+
placeholder="' . esc_attr( $this->placeholder ) . '"
|
243 |
+
' . Fns::htmlKses( $this->attr, 'basic' ) . '
|
244 |
+
/>';
|
245 |
|
246 |
return $h;
|
247 |
}
|
248 |
|
249 |
private function number() {
|
250 |
+
$holderClass = explode( ' ', $this->holderClass );
|
251 |
+
|
252 |
+
$h = null;
|
253 |
+
$h .= '<input
|
254 |
+
type="number"
|
255 |
+
class="' . esc_attr( $this->class ) . '"
|
256 |
+
id="' . esc_attr( $this->id ) . '"
|
257 |
+
value="' . ( ! empty( $this->value ) ? absint( $this->value ) : null ) . '"
|
258 |
+
name="' . esc_attr( $this->name ) . '"
|
259 |
+
placeholder="' . esc_attr( $this->placeholder ) . '"
|
260 |
+
' . Fns::htmlKses( $this->attr, 'basic' ) . '
|
261 |
+
/>';
|
262 |
|
263 |
return $h;
|
264 |
}
|
265 |
|
266 |
private function select() {
|
267 |
+
$holderClass = explode( ' ', $this->holderClass );
|
268 |
+
$atts = ( in_array( 'pro-field', $holderClass, true ) ) && ! rtTPG()->hasPro() ? 'disabled="true"' : '';
|
269 |
+
$h = null;
|
270 |
+
|
271 |
if ( $this->multiple ) {
|
272 |
$this->attr = " style='min-width:160px;'";
|
273 |
+
$this->name = $this->name . '[]';
|
274 |
$this->attr = $this->attr . " multiple='multiple'";
|
275 |
+
$this->value = ( is_array( $this->value ) && ! empty( $this->value ) ? $this->value : [] );
|
276 |
} else {
|
277 |
+
$this->value = [ $this->value ];
|
278 |
}
|
279 |
|
280 |
+
$h .= '<select ' . $atts . ' name="' . esc_attr( $this->name ) . '" id="' . esc_attr( $this->id ) . '" class="' . esc_attr( $this->class ) . '" ' . Fns::htmlKses( $this->attr, 'basic' ) . '>';
|
281 |
+
|
282 |
if ( $this->blank ) {
|
283 |
+
$h .= '<option value="">' . esc_html( $this->blank ) . '</option>';
|
284 |
}
|
285 |
+
|
286 |
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
287 |
foreach ( $this->options as $key => $value ) {
|
288 |
+
$slt = ( in_array( $key, $this->value ) ? 'selected' : null );
|
289 |
+
$h .= '<option ' . esc_attr( $slt ) . ' value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>';
|
290 |
}
|
291 |
}
|
292 |
+
|
293 |
+
$h .= '</select>';
|
294 |
|
295 |
return $h;
|
296 |
}
|
297 |
|
298 |
private function textArea() {
|
299 |
+
$holderClass = explode( ' ', $this->holderClass );
|
300 |
+
|
301 |
+
$h = null;
|
302 |
+
$h .= '<textarea
|
303 |
+
class="' . esc_attr( $this->class ) . ' rt-textarea"
|
304 |
+
id="' . esc_attr( $this->id ) . '"
|
305 |
+
name="' . esc_attr( $this->name ) . '"
|
306 |
+
placeholder="' . esc_attr( $this->placeholder ) . '"
|
307 |
+
' . Fns::htmlKses( $this->attr, 'basic' ) . '
|
308 |
+
>' . wp_kses_post( $this->value ) . '</textarea>';
|
309 |
|
310 |
return $h;
|
311 |
}
|
312 |
|
313 |
private function image() {
|
314 |
+
$holderClass = explode( ' ', $this->holderClass );
|
315 |
+
|
316 |
$h = null;
|
|
|
|
|
317 |
$img = null;
|
318 |
+
|
319 |
+
$h .= "<div class='rt-image-holder'>";
|
320 |
+
$h .= '<input type="hidden" name="' . esc_attr( $this->name ) . '" value="' . absint( $this->value ) . '" id="' . esc_attr( $this->id ) . '" class="hidden-image-id" />';
|
321 |
+
$c = 'hidden';
|
322 |
+
|
323 |
if ( $id = absint( $this->value ) ) {
|
324 |
$aImg = wp_get_attachment_image_src( $id, 'thumbnail' );
|
325 |
+
$img = '<img src="' . esc_url( $aImg[0] ) . '" >';
|
326 |
$c = null;
|
327 |
}
|
328 |
|
329 |
+
$h .= '<div class="rt-image-preview">' . Fns::htmlKses( $img, 'image' ) . '<span class="dashicons dashicons-plus-alt rtAddImage"></span><span class="dashicons dashicons-trash rtRemoveImage ' . esc_attr( $c ) . '"></span></div>';
|
330 |
|
331 |
+
$h .= '</div>';
|
332 |
|
333 |
return $h;
|
334 |
}
|
335 |
|
336 |
private function imageSize() {
|
337 |
+
$width = ( ! empty( $this->value[0] ) ? $this->value[0] : null );
|
338 |
+
$height = ( ! empty( $this->value[1] ) ? $this->value[1] : null );
|
339 |
+
$cropV = ( ! empty( $this->value[2] ) ? $this->value[2] : 'soft' );
|
340 |
+
|
341 |
+
$h = null;
|
342 |
+
$h .= "<div class='rt-image-size-holder'>";
|
343 |
+
$h .= "<div class='rt-image-size-width rt-image-size'>";
|
344 |
+
$h .= '<label>Width</label>';
|
345 |
+
$h .= '<input type="number" name="' . esc_attr( $this->name ) . '[]" value="' . absint( $width ) . '" />';
|
346 |
+
$h .= '</div>';
|
347 |
+
$h .= "<div class='rt-image-size-height rt-image-size'>";
|
348 |
+
$h .= '<label>Height</label>';
|
349 |
+
$h .= '<input type="number" name="' . esc_attr( $this->name ) . '[]" value="' . absint( $height ) . '" />';
|
350 |
+
$h .= '</div>';
|
351 |
+
$h .= "<div class='rt-image-size-crop rt-image-size'>";
|
352 |
+
$h .= '<label>Crop</label>';
|
353 |
+
$h .= '<select name="' . esc_attr( $this->name ) . '[]" class="rt-select2">';
|
354 |
+
|
355 |
$cropList = Options::imageCropType();
|
356 |
+
|
357 |
foreach ( $cropList as $crop => $cropLabel ) {
|
358 |
+
$cSl = ( $crop == $cropV ? 'selected' : null );
|
359 |
+
$h .= '<option value="' . esc_attr( $crop ) . '" ' . esc_attr( $cSl ) . '>' . esc_html( $cropLabel ) . '</option>';
|
360 |
}
|
361 |
+
|
362 |
+
$h .= '</select>';
|
363 |
+
$h .= '</div>';
|
364 |
+
$h .= '</div>';
|
365 |
|
366 |
return $h;
|
367 |
}
|
368 |
|
369 |
private function checkbox() {
|
370 |
+
$holderClass = explode( ' ', $this->holderClass );
|
371 |
+
$this->alignment .= ( in_array( 'pro-field', $holderClass, true ) ) && ! rtTPG()->hasPro() ? ' disabled' : '';
|
372 |
+
$h = null;
|
373 |
+
|
374 |
if ( $this->multiple ) {
|
375 |
+
$this->name = $this->name . '[]';
|
376 |
+
$this->value = ( is_array( $this->value ) && ! empty( $this->value ) ? $this->value : [] );
|
377 |
}
|
378 |
+
|
379 |
if ( $this->multiple ) {
|
380 |
+
$h .= '<div class="checkbox-group ' . esc_attr( $this->alignment ) . '" id="' . esc_attr( $this->id ) . '">';
|
381 |
+
|
382 |
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
383 |
foreach ( $this->options as $key => $value ) {
|
384 |
+
$checked = ( in_array( $key, $this->value ) ? 'checked' : null );
|
385 |
|
386 |
+
$h .= '<label for="' . esc_attr( $this->id ) . '-' . esc_attr( $key ) . '"><input type="checkbox" id="' . esc_attr( $this->id ) . '-' . esc_attr( $key ) . '" ' . esc_attr( $checked ) . ' name="' . esc_attr( $this->name ) . '" value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</label>';
|
|
|
|
|
387 |
}
|
388 |
}
|
389 |
+
|
390 |
+
$h .= '</div>';
|
391 |
} else {
|
392 |
+
$checked = ( $this->value ? 'checked' : null );
|
393 |
+
$h .= '<label><input type="checkbox" ' . esc_attr( $checked ) . ' id="' . esc_attr( $this->id ) . '" name="' . esc_attr( $this->name ) . '" value="1" />' . esc_html( $this->option ) . '</label>';
|
394 |
}
|
395 |
|
396 |
return $h;
|
397 |
}
|
398 |
|
399 |
private function switchField() {
|
400 |
+
$h = null;
|
401 |
+
$checked = $this->value ? 'checked' : null;
|
402 |
+
$h .= '<label class="rttm-switch"><input type="checkbox" ' . esc_attr( $checked ) . ' id="' . esc_attr( $this->id ) . '" name="' . esc_attr( $this->name ) . '" value="1" /><span class="rttm-switch-slider round"></span></label>';
|
403 |
|
404 |
return $h;
|
405 |
}
|
406 |
|
407 |
private function checkboxFilter() {
|
|
|
408 |
global $post;
|
409 |
|
410 |
+
$pt = get_post_meta( $post->ID, 'tpg_post_type', true );
|
411 |
+
$advFilters = Options::rtTPAdvanceFilters();
|
412 |
+
$holderClass = explode( ' ', $this->holderClass );
|
413 |
+
$h = null;
|
414 |
|
|
|
415 |
if ( $this->multiple ) {
|
416 |
+
$this->name = $this->name . '[]';
|
417 |
+
$this->value = ( is_array( $this->value ) && ! empty( $this->value ) ? $this->value : [] );
|
418 |
}
|
419 |
+
|
420 |
if ( $this->multiple ) {
|
421 |
+
$h .= '<div class="checkbox-group ' . esc_attr( $this->alignment ) . '" id="' . esc_attr( $this->id ) . '">';
|
422 |
+
|
423 |
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
424 |
foreach ( $this->options as $key => $value ) {
|
425 |
+
$checked = ( in_array( $key, $this->value ) ? 'checked' : null );
|
426 |
|
427 |
$h .= '<div class="checkbox-filter-field">';
|
428 |
+
$h .= '<label for="' . esc_attr( $this->id ) . '-' . esc_attr( $key ) . '"><input type="checkbox" id="' . esc_attr( $this->id ) . '-' . esc_attr( $key ) . '" ' . esc_attr( $checked ) . ' name="' . esc_attr( $this->name ) . '" value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</label>';
|
429 |
|
430 |
+
if ( $key == 'tpg_taxonomy' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
431 |
$h .= "<div class='rt-tpg-filter taxonomy tpg_taxonomy tpg-hidden'>";
|
432 |
|
433 |
+
if ( isset( $pt ) && $pt ) {
|
434 |
+
$taxonomies = Fns::rt_get_all_taxonomy_by_post_type( $pt );
|
435 |
+
$taxA = get_post_meta( $post->ID, 'tpg_taxonomy' );
|
436 |
+
$post_filter = get_post_meta( $post->ID, 'post_filter' );
|
437 |
|
438 |
$h .= "<div class='taxonomy-field'>";
|
439 |
+
|
440 |
+
if ( is_array( $post_filter ) && ! empty( $post_filter ) && in_array( 'tpg_taxonomy', $post_filter ) && ! empty( $taxonomies ) ) {
|
441 |
$h .= Fns::rtFieldGenerator(
|
442 |
+
[
|
443 |
+
'tpg_taxonomy' => [
|
444 |
+
'type' => 'checkbox',
|
445 |
+
'label' => '',
|
446 |
+
'id' => 'post-taxonomy',
|
447 |
+
'multiple' => true,
|
448 |
+
'options' => $taxonomies,
|
449 |
+
],
|
450 |
+
]
|
451 |
);
|
452 |
+
} else {
|
453 |
+
$h .= '<div class="field-holder">' . esc_html__( 'No Taxonomy found', 'the-post-grid' ) . '</div>';
|
454 |
}
|
455 |
+
|
456 |
+
$h .= '</div>';
|
457 |
$h .= "<div class='rt-tpg-filter-item term-filter-item tpg-hidden'>";
|
458 |
$h .= '<div class="field-holder">';
|
459 |
$h .= '<div class="field-label">Terms</div>';
|
460 |
$h .= '<div class="field term-filter-holder">';
|
|
|
|
|
461 |
|
462 |
+
if ( is_array( $taxA ) && ! empty( $taxA ) ) {
|
463 |
+
foreach ( $taxA as $tax ) {
|
464 |
+
|
465 |
+
$h .= '<div class="term-filter-item-container ' . esc_attr( $tax ) . '">';
|
466 |
$h .= Fns::rtFieldGenerator(
|
467 |
+
[
|
468 |
+
'term_' . $tax => [
|
469 |
+
'type' => 'select',
|
470 |
+
'label' => ucfirst( str_replace( '_', ' ', $tax ) ),
|
471 |
+
'class' => 'rt-select2 full',
|
472 |
'holderClass' => "term-filter-item {$tax}",
|
473 |
+
'value' => get_post_meta( $post->ID, 'term_' . $tax ),
|
474 |
+
'multiple' => true,
|
475 |
+
'options' => Fns::rt_get_all_term_by_taxonomy( $tax ),
|
476 |
+
],
|
477 |
+
]
|
478 |
);
|
479 |
$h .= Fns::rtFieldGenerator(
|
480 |
+
[
|
481 |
+
'term_operator_' . $tax => [
|
482 |
+
'type' => 'select',
|
483 |
+
'label' => esc_html__( 'Operator', 'the-post-grid' ),
|
484 |
+
'class' => 'rt-select2 full',
|
485 |
'holderClass' => "term-filter-item-operator {$tax}",
|
486 |
+
'value' => get_post_meta( $post->ID, 'term_operator_' . $tax, true ),
|
487 |
+
'options' => Options::rtTermOperators(),
|
488 |
+
],
|
489 |
+
]
|
490 |
);
|
491 |
+
$h .= '</div>';
|
492 |
}
|
493 |
}
|
494 |
+
|
495 |
+
$h .= '</div>';
|
496 |
+
$h .= '</div>';
|
497 |
|
498 |
$h .= Fns::rtFieldGenerator(
|
499 |
+
[
|
500 |
+
'taxonomy_relation' => [
|
501 |
+
'type' => 'select',
|
502 |
+
'label' => esc_html__( 'Relation', 'the-post-grid' ),
|
503 |
+
'class' => 'rt-select2',
|
504 |
+
'holderClass' => 'term-filter-item-relation ' . ( count( $taxA ) > 1 ? null : 'hidden' ),
|
505 |
+
'value' => get_post_meta( $post->ID, 'taxonomy_relation', true ),
|
506 |
+
'options' => Options::rtTermRelations(),
|
507 |
+
],
|
508 |
+
]
|
509 |
);
|
510 |
|
511 |
+
$h .= '</div>';
|
512 |
+
} else {
|
|
|
513 |
$h .= "<div class='taxonomy-field'>";
|
514 |
+
$h .= '</div>';
|
515 |
$h .= "<div class='rt-tpg-filter-item'>";
|
516 |
$h .= '<div class="field-holder">';
|
517 |
$h .= '<div class="field-label">Terms</div>';
|
518 |
$h .= '<div class="field term-filter-holder">';
|
519 |
+
$h .= '</div>';
|
520 |
+
$h .= '</div>';
|
521 |
+
$h .= '</div>';
|
522 |
$h .= Fns::rtFieldGenerator(
|
523 |
+
[
|
524 |
+
'taxonomy_relation' => [
|
525 |
+
'type' => 'select',
|
526 |
+
'label' => esc_html__( 'Relation', 'the-post-grid' ),
|
527 |
+
'class' => 'rt-select2',
|
528 |
+
'holderClass' => 'term-filter-item-relation tpg-hidden',
|
529 |
+
'default' => 'OR',
|
530 |
+
'options' => Options::rtTermRelations(),
|
531 |
+
],
|
532 |
+
]
|
533 |
);
|
534 |
}
|
535 |
+
|
536 |
+
$h .= '</div>';
|
537 |
+
} elseif ( $key == 'order' ) {
|
538 |
+
$h .= '<div class="rt-tpg-filter ' . esc_attr( $key ) . ' tpg-hidden">';
|
539 |
$h .= "<div class='rt-tpg-filter-item'>";
|
540 |
+
$h .= "<div class='field-holder'>";
|
541 |
+
$h .= "<div class='field'>";
|
542 |
$h .= Fns::rtFieldGenerator(
|
543 |
+
[
|
544 |
+
'order_by' => [
|
545 |
+
'type' => 'select',
|
546 |
+
'label' => esc_html__( 'Order by', 'the-post-grid' ),
|
547 |
+
'class' => 'rt-select2 filter-item',
|
548 |
+
'value' => get_post_meta( $post->ID, 'order_by', true ),
|
549 |
+
'options' => Options::rtPostOrderBy( false, true ),
|
550 |
+
'description' => esc_html__( 'If "Meta value", "Meta value Number" or "Meta value datetime" is chosen then meta key is required.', 'the-post-grid' ),
|
551 |
+
],
|
552 |
+
]
|
553 |
);
|
554 |
$h .= Fns::rtFieldGenerator(
|
555 |
+
[
|
556 |
+
'tpg_meta_key' => [
|
557 |
+
'type' => 'text',
|
558 |
+
'label' => esc_html__( 'Meta key', 'the-post-grid' ),
|
559 |
+
'class' => 'rt-select2 filter-item',
|
560 |
'holderClass' => 'tpg-hidden',
|
561 |
+
'value' => get_post_meta( $post->ID, 'tpg_meta_key', true ),
|
562 |
+
],
|
563 |
+
]
|
564 |
);
|
565 |
$h .= Fns::rtFieldGenerator(
|
566 |
+
[
|
567 |
+
'order' => [
|
568 |
+
'type' => 'radio',
|
569 |
+
'label' => esc_html__( 'Order', 'the-post-grid' ),
|
570 |
+
'class' => 'rt-select2 filter-item',
|
571 |
'alignment' => 'vertical',
|
572 |
+
'default' => 'DESC',
|
573 |
+
'value' => get_post_meta( $post->ID, 'order', true ),
|
574 |
+
'options' => Options::rtPostOrders(),
|
575 |
+
],
|
576 |
+
]
|
577 |
);
|
578 |
+
$h .= '</div>';
|
579 |
+
$h .= '</div>';
|
580 |
+
$h .= '</div>';
|
581 |
+
$h .= '</div>';
|
582 |
+
} elseif ( $key == 'author' ) {
|
583 |
+
$h .= '<div class="rt-tpg-filter ' . esc_attr( $key ) . ' tpg-hidden">';
|
584 |
$h .= "<div class='rt-tpg-filter-item'>";
|
585 |
$h .= Fns::rtFieldGenerator(
|
586 |
+
[
|
587 |
+
$key => [
|
588 |
+
'type' => 'select',
|
589 |
+
'label' => '',
|
590 |
+
'class' => 'rt-select2 filter-item full',
|
591 |
+
'value' => get_post_meta( $post->ID, $key ),
|
592 |
+
'multiple' => true,
|
593 |
+
'options' => Fns::rt_get_users(),
|
594 |
+
],
|
595 |
+
]
|
596 |
);
|
597 |
+
$h .= '</div>';
|
598 |
+
$h .= '</div>';
|
599 |
+
} elseif ( $key == 'tpg_post_status' ) {
|
600 |
+
$h .= '<div class="rt-tpg-filter ' . esc_attr( $key ) . ' tpg-hidden">';
|
601 |
$h .= "<div class='rt-tpg-filter-item'>";
|
602 |
$h .= Fns::rtFieldGenerator(
|
603 |
+
[
|
604 |
+
$key => [
|
605 |
+
'type' => 'select',
|
606 |
+
'label' => '',
|
607 |
+
'class' => 'rt-select2 filter-item full',
|
608 |
+
'default' => [ 'publish' ],
|
609 |
+
'value' => get_post_meta( $post->ID, $key ),
|
610 |
+
'multiple' => true,
|
611 |
+
'options' => Options::rtTPGPostStatus(),
|
612 |
+
],
|
613 |
+
]
|
614 |
);
|
615 |
+
$h .= '</div>';
|
616 |
+
$h .= '</div>';
|
617 |
+
} elseif ( $key == 's' ) {
|
618 |
+
$h .= '<div class="rt-tpg-filter ' . esc_attr( $key ) . ' tpg-hidden">';
|
619 |
$h .= "<div class='rt-tpg-filter-item'>";
|
620 |
$h .= Fns::rtFieldGenerator(
|
621 |
+
[
|
622 |
+
$key => [
|
623 |
+
'type' => 'text',
|
624 |
+
'label' => esc_html__( 'Keyword', 'the-post-grid' ),
|
625 |
'class' => 'filter-item full',
|
626 |
+
'value' => get_post_meta( $post->ID, $key, true ),
|
627 |
+
],
|
628 |
+
]
|
629 |
);
|
630 |
+
$h .= '</div>';
|
631 |
+
$h .= '</div>';
|
632 |
+
} elseif ( $key == 'date_range' ) {
|
633 |
+
$range_start = get_post_meta( $post->ID, 'date_range_start', true );
|
634 |
+
$range_end = get_post_meta( $post->ID, 'date_range_end', true );
|
635 |
$range_value = [
|
636 |
'start' => $range_start,
|
637 |
+
'end' => $range_end,
|
638 |
];
|
639 |
+
$h .= '<div class="rt-tpg-filter ' . esc_attr( $key ) . ' tpg-hidden">';
|
640 |
+
$h .= "<div class='rt-tpg-filter-item'>";
|
641 |
+
$h .= Fns::rtFieldGenerator(
|
642 |
+
[
|
643 |
+
$key => [
|
644 |
+
'type' => 'date_range',
|
645 |
+
'label' => '',
|
646 |
+
'class' => 'filter-item full rt-date-range',
|
647 |
+
'value' => $range_value,
|
648 |
'description' => "Date format should be 'yyyy-mm-dd'",
|
649 |
+
],
|
650 |
+
]
|
651 |
);
|
652 |
+
$h .= '</div>';
|
653 |
+
$h .= '</div>';
|
654 |
}
|
655 |
+
// }
|
656 |
|
657 |
$h .= '</div>';
|
658 |
}
|
659 |
}
|
660 |
+
$h .= '</div>';
|
661 |
} else {
|
662 |
+
$checked = ( $this->value ? 'checked' : null );
|
663 |
+
$h .= '<label><input type="checkbox" ' . esc_attr( $checked ) . ' id="' . esc_attr( $this->id ) . '" name="' . esc_attr( $this->name ) . '" value="1" />' . esc_html( $this->option ) . '</label>';
|
664 |
}
|
665 |
|
666 |
return $h;
|
667 |
}
|
668 |
|
669 |
private function radioField() {
|
670 |
+
$holderClass = explode( ' ', $this->holderClass );
|
671 |
+
$this->alignment .= ( in_array( 'pro-field', $holderClass, true ) ) && ! rtTPG()->hasPro() ? ' disabled' : '';
|
672 |
+
$h = null;
|
673 |
+
|
674 |
+
$h .= '<div class="radio-group ' . esc_attr( $this->alignment ) . '" id="' . esc_attr( $this->id ) . '">';
|
675 |
+
|
676 |
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
677 |
foreach ( $this->options as $key => $value ) {
|
678 |
+
$checked = ( $key == $this->value ? 'checked' : null );
|
679 |
+
|
680 |
+
$h .= '<label for="' . esc_attr( $this->name ) . '-' . esc_attr( $key ) . '"><input type="radio" id="' . esc_attr( $this->id ) . '-' . esc_attr( $key ) . '" ' . esc_attr( $checked ) . ' name="' . esc_attr( $this->name ) . '" value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</label>';
|
|
|
|
|
|
|
|
|
681 |
}
|
682 |
}
|
683 |
+
|
684 |
+
$h .= '</div>';
|
685 |
|
686 |
return $h;
|
687 |
}
|
692 |
* @return String
|
693 |
*/
|
694 |
private function radioImage() {
|
695 |
+
$h = null;
|
696 |
$id = 'rttpg-' . $this->name;
|
697 |
|
698 |
+
$h .= sprintf( "<div class='rttpg-radio-image %s' id='%s'>", esc_attr( $this->alignment ), esc_attr( $id ) );
|
699 |
$selected_value = $this->value;
|
700 |
|
701 |
+
if ( is_array( $this->options ) && ! empty( $this->options ) ) {
|
702 |
+
foreach ( $this->options as $key => $value ) {
|
703 |
+
$checked = ( $key == $selected_value ? 'checked' : null );
|
704 |
+
$title = isset( $value['title'] ) && $value['title'] ? $value['title'] : '';
|
705 |
+
$link = isset( $value['layout_link'] ) && $value['layout_link'] ? $value['layout_link'] : '';
|
706 |
+
$linkHtml = empty( $link ) ? esc_html( $title ) : '<a href="' . esc_url( $link ) . '" target="_blank">' . esc_html( $title ) . '</a>';
|
707 |
+
$layout = isset( $value['layout'] ) ? $value['layout'] : '';
|
708 |
+
$taghtml = isset( $value['tag'] ) ? '<div class="rt-tpg-layout-tag"><span>' . $value['tag'] . '</span></div>' : '';
|
709 |
+
$h .= sprintf(
|
710 |
+
'<div class="rt-tpg-radio-layout %7$s"><label data-type="%7$s" class="radio-image %7$s" for="%2$s">
|
711 |
+
<input type="radio" id="%2$s" %3$s name="%4$s" value="%2$s">
|
712 |
+
<div class="rttpg-radio-image-wrap">
|
713 |
+
<img src="%5$s" title="%6$s" alt="%2$s">
|
714 |
+
<div class="rttpg-checked"><span class="dashicons dashicons-yes"></span></div>
|
715 |
+
%9$s
|
716 |
+
</div>
|
717 |
+
</label>
|
718 |
+
<div class="rttpg-demo-name">%8$s</div>
|
719 |
+
</div>',
|
720 |
'',
|
721 |
esc_attr( $key ),
|
722 |
+
esc_attr( $checked ),
|
723 |
+
esc_attr( $this->name ),
|
724 |
+
esc_url( $value['img'] ),
|
725 |
+
esc_attr( $title ),
|
726 |
+
esc_attr( $layout ),
|
727 |
+
Fns::htmlKses( $linkHtml, 'basic' ),
|
728 |
+
Fns::htmlKses( $taghtml, 'basic' )
|
729 |
);
|
730 |
}
|
731 |
}
|
732 |
+
$h .= '</div>';
|
733 |
return $h;
|
734 |
}
|
735 |
|
736 |
private function dateRange() {
|
737 |
$h = null;
|
738 |
+
$this->name = ( $this->name ? $this->name : 'date-range-' . rand( 0, 1000 ) );
|
739 |
+
$h .= '<div class="date-range-container" id="' . esc_attr( $this->id ) . '">';
|
740 |
+
$h .= "<div class='date-range-content start'><span>" . esc_html__( 'Start', 'the-post-grid' ) . "</span><input
|
741 |
+
type='text'
|
742 |
+
class='date-range date-range-start {$this->class}'
|
743 |
+
id='" . esc_attr( $this->id ) . "-start'
|
744 |
+
value='" . esc_attr( $this->value['start'] ) . "'
|
745 |
+
name='" . esc_attr( $this->name ) . "_start'
|
746 |
+
placeholder='" . esc_attr( $this->name ) . "'
|
747 |
+
" . Fns::htmlKses( $this->attr, 'basic' ) . '
|
748 |
+
/></div>';
|
749 |
+
$h .= "<div class='date-range-content end'><span>" . esc_html__( 'End', 'the-post-grid' ) . "</span><input
|
750 |
+
type='text'
|
751 |
+
class='date-range date-range-end {$this->class}'
|
752 |
+
id='" . esc_attr( $this->id ) . "-end'
|
753 |
+
value='" . esc_attr( $this->value['end'] ) . "'
|
754 |
+
name='" . esc_attr( $this->name ) . "_end'
|
755 |
+
placeholder='" . esc_attr( $this->name ) . "'
|
756 |
+
" . Fns::htmlKses( $this->attr, 'basic' ) . '
|
757 |
+
/></div>';
|
758 |
+
$h .= '</div>';
|
759 |
|
760 |
return $h;
|
761 |
}
|
762 |
+
}
|
|
app/Models/ReSizer.php
CHANGED
@@ -1,21 +1,27 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Models;
|
|
|
4 |
use WP_Error;
|
5 |
|
|
|
|
|
|
|
|
|
|
|
6 |
/**
|
7 |
* Image resize Class
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* @package WP_LOGO_SHOWCASE
|
11 |
-
* @since 1.0
|
12 |
-
* @author RadiusTheme
|
13 |
*/
|
14 |
class ReSizer {
|
15 |
/**
|
16 |
* The singleton instance
|
17 |
*/
|
18 |
-
static
|
19 |
|
20 |
/**
|
21 |
* Should an RtTpgException be thrown on error?
|
@@ -32,9 +38,9 @@ class ReSizer {
|
|
32 |
/**
|
33 |
* For your custom default usage you may want to initialize an rtTPGReSizer object by yourself and then have own defaults
|
34 |
*/
|
35 |
-
static
|
36 |
if ( self::$instance == null ) {
|
37 |
-
self::$instance = new self;
|
38 |
}
|
39 |
|
40 |
return self::$instance;
|
@@ -47,18 +53,39 @@ class ReSizer {
|
|
47 |
try {
|
48 |
// Validate inputs.
|
49 |
if ( ! $url ) {
|
50 |
-
return new WP_Error(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
if ( ! $width ) {
|
53 |
-
return new WP_Error(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
if ( ! $height ) {
|
56 |
-
return new WP_Error(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
// Caipt'n, ready to hook.
|
60 |
if ( true === $upscale ) {
|
61 |
-
add_filter( 'image_resize_dimensions',
|
62 |
}
|
63 |
|
64 |
// Define upload path & dir.
|
@@ -66,27 +93,38 @@ class ReSizer {
|
|
66 |
$upload_dir = $upload_info['basedir'];
|
67 |
$upload_url = $upload_info['baseurl'];
|
68 |
|
69 |
-
$http_prefix =
|
70 |
-
$https_prefix =
|
71 |
-
$relative_prefix =
|
72 |
|
73 |
-
/*
|
|
|
74 |
if the schemes differe, images don't show up. */
|
75 |
-
if ( ! strncmp( $url, $https_prefix, strlen( $https_prefix ) ) ) { //if url begins with https:// make $upload_url begin with https:// as well
|
76 |
$upload_url = str_replace( $http_prefix, $https_prefix, $upload_url );
|
77 |
-
} elseif ( ! strncmp( $url, $http_prefix, strlen( $http_prefix ) ) ) { //if url begins with http:// make $upload_url begin with http:// as well
|
78 |
$upload_url = str_replace( $https_prefix, $http_prefix, $upload_url );
|
79 |
-
} elseif ( ! strncmp( $url, $relative_prefix, strlen( $relative_prefix ) ) ) { //if url begins with // make $upload_url begin with // as well
|
80 |
-
$upload_url = str_replace(
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
84 |
}
|
85 |
|
86 |
-
|
87 |
// Check if $img_url is local.
|
88 |
if ( false === strpos( $url, $upload_url ) ) {
|
89 |
-
return new WP_Error(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
}
|
91 |
|
92 |
// Define path of image.
|
@@ -96,12 +134,12 @@ class ReSizer {
|
|
96 |
// Check if img path exists, and is an image indeed.
|
97 |
if ( ! file_exists( $img_path ) or ! getimagesize( $img_path ) ) {
|
98 |
return new WP_Error( 'broke', 'Image file does not exist (or is not an image): ' . $img_path );
|
99 |
-
//
|
100 |
}
|
101 |
|
102 |
// Get image info.
|
103 |
-
$info
|
104 |
-
$ext
|
105 |
list( $orig_w, $orig_h ) = getimagesize( $img_path );
|
106 |
|
107 |
// Get image size after cropping.
|
@@ -123,7 +161,7 @@ class ReSizer {
|
|
123 |
if ( ! $dims || ( true == $crop && false == $upscale && ( $dst_w < $width || $dst_h < $height ) ) ) {
|
124 |
// Can't resize, so return false saying that the action to do could not be processed as planned.
|
125 |
return new WP_Error( 'broke', 'Image file does not exist (or is not an image): ' . $img_path );
|
126 |
-
//
|
127 |
} // Else check if cache exists.
|
128 |
elseif ( file_exists( $destfilename ) && getimagesize( $destfilename ) ) {
|
129 |
$img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
|
@@ -134,8 +172,8 @@ class ReSizer {
|
|
134 |
|
135 |
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
|
136 |
return new WP_Error( 'broke', 'Image file does not exist (or is not an image): ' . $img_path );
|
137 |
-
//
|
138 |
-
//
|
139 |
}
|
140 |
|
141 |
$resized_file = $editor->save();
|
@@ -145,15 +183,14 @@ class ReSizer {
|
|
145 |
$img_url = $upload_url . $resized_rel_path;
|
146 |
} else {
|
147 |
return new WP_Error( 'broke', 'Image file does not exist (or is not an image): ' . $img_path );
|
148 |
-
//
|
149 |
}
|
150 |
-
|
151 |
}
|
152 |
}
|
153 |
|
154 |
// Okay, leave the ship.
|
155 |
if ( true === $upscale ) {
|
156 |
-
remove_filter( 'image_resize_dimensions',
|
157 |
}
|
158 |
|
159 |
// Return the output.
|
@@ -162,11 +199,11 @@ class ReSizer {
|
|
162 |
$image = $img_url;
|
163 |
} else {
|
164 |
// array return.
|
165 |
-
$image =
|
166 |
0 => $img_url,
|
167 |
1 => $dst_w,
|
168 |
-
2 => $dst_h
|
169 |
-
|
170 |
}
|
171 |
|
172 |
return $image;
|
@@ -189,7 +226,7 @@ class ReSizer {
|
|
189 |
function aq_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) {
|
190 |
if ( ! $crop ) {
|
191 |
return null;
|
192 |
-
} // Let the
|
193 |
|
194 |
// Here is the point we allow to use larger image size than the original one.
|
195 |
$aspect_ratio = $orig_w / $orig_h;
|
@@ -212,8 +249,6 @@ class ReSizer {
|
|
212 |
$s_x = floor( ( $orig_w - $crop_w ) / 2 );
|
213 |
$s_y = floor( ( $orig_h - $crop_h ) / 2 );
|
214 |
|
215 |
-
return
|
216 |
}
|
217 |
}
|
218 |
-
|
219 |
-
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Image resize Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Models;
|
9 |
+
|
10 |
use WP_Error;
|
11 |
|
12 |
+
// Do not allow directly accessing this file.
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit( 'This script cannot be accessed directly.' );
|
15 |
+
}
|
16 |
+
|
17 |
/**
|
18 |
* Image resize Class
|
|
|
|
|
|
|
|
|
|
|
19 |
*/
|
20 |
class ReSizer {
|
21 |
/**
|
22 |
* The singleton instance
|
23 |
*/
|
24 |
+
private static $instance = null;
|
25 |
|
26 |
/**
|
27 |
* Should an RtTpgException be thrown on error?
|
38 |
/**
|
39 |
* For your custom default usage you may want to initialize an rtTPGReSizer object by yourself and then have own defaults
|
40 |
*/
|
41 |
+
public static function getInstance() {
|
42 |
if ( self::$instance == null ) {
|
43 |
+
self::$instance = new self();
|
44 |
}
|
45 |
|
46 |
return self::$instance;
|
53 |
try {
|
54 |
// Validate inputs.
|
55 |
if ( ! $url ) {
|
56 |
+
return new WP_Error(
|
57 |
+
'broke',
|
58 |
+
sprintf(
|
59 |
+
/* Translators: %s URL */
|
60 |
+
esc_html__( '%s parameter is required', 'the-post-grid' ),
|
61 |
+
$url
|
62 |
+
)
|
63 |
+
);
|
64 |
}
|
65 |
if ( ! $width ) {
|
66 |
+
return new WP_Error(
|
67 |
+
'broke',
|
68 |
+
sprintf(
|
69 |
+
/* Translators: %s Width */
|
70 |
+
esc_html__( '%s parameter is required', 'the-post-grid' ),
|
71 |
+
$width
|
72 |
+
)
|
73 |
+
);
|
74 |
}
|
75 |
if ( ! $height ) {
|
76 |
+
return new WP_Error(
|
77 |
+
'broke',
|
78 |
+
sprintf(
|
79 |
+
/* Translators: %s Height */
|
80 |
+
esc_html__( '%s parameter is required', 'the-post-grid' ),
|
81 |
+
$height
|
82 |
+
)
|
83 |
+
);
|
84 |
}
|
85 |
|
86 |
// Caipt'n, ready to hook.
|
87 |
if ( true === $upscale ) {
|
88 |
+
add_filter( 'image_resize_dimensions', [ $this, 'aq_upscale' ], 10, 6 );
|
89 |
}
|
90 |
|
91 |
// Define upload path & dir.
|
93 |
$upload_dir = $upload_info['basedir'];
|
94 |
$upload_url = $upload_info['baseurl'];
|
95 |
|
96 |
+
$http_prefix = 'http://';
|
97 |
+
$https_prefix = 'https://';
|
98 |
+
$relative_prefix = '//'; // The protocol-relative URL
|
99 |
|
100 |
+
/*
|
101 |
+
if the $url scheme differs from $upload_url scheme, make them match
|
102 |
if the schemes differe, images don't show up. */
|
103 |
+
if ( ! strncmp( $url, $https_prefix, strlen( $https_prefix ) ) ) { // if url begins with https:// make $upload_url begin with https:// as well
|
104 |
$upload_url = str_replace( $http_prefix, $https_prefix, $upload_url );
|
105 |
+
} elseif ( ! strncmp( $url, $http_prefix, strlen( $http_prefix ) ) ) { // if url begins with http:// make $upload_url begin with http:// as well
|
106 |
$upload_url = str_replace( $https_prefix, $http_prefix, $upload_url );
|
107 |
+
} elseif ( ! strncmp( $url, $relative_prefix, strlen( $relative_prefix ) ) ) { // if url begins with // make $upload_url begin with // as well
|
108 |
+
$upload_url = str_replace(
|
109 |
+
[
|
110 |
+
0 => "$http_prefix",
|
111 |
+
1 => "$https_prefix",
|
112 |
+
],
|
113 |
+
$relative_prefix,
|
114 |
+
$upload_url
|
115 |
+
);
|
116 |
}
|
117 |
|
|
|
118 |
// Check if $img_url is local.
|
119 |
if ( false === strpos( $url, $upload_url ) ) {
|
120 |
+
return new WP_Error(
|
121 |
+
'broke',
|
122 |
+
sprintf(
|
123 |
+
/* Translators: %s URL */
|
124 |
+
esc_html__( 'Image must be local: %s', 'the-post-grid' ),
|
125 |
+
$url
|
126 |
+
)
|
127 |
+
);
|
128 |
}
|
129 |
|
130 |
// Define path of image.
|
134 |
// Check if img path exists, and is an image indeed.
|
135 |
if ( ! file_exists( $img_path ) or ! getimagesize( $img_path ) ) {
|
136 |
return new WP_Error( 'broke', 'Image file does not exist (or is not an image): ' . $img_path );
|
137 |
+
// throw new RtTpgException( 'Image file does not exist (or is not an image): ' . $img_path );
|
138 |
}
|
139 |
|
140 |
// Get image info.
|
141 |
+
$info = pathinfo( $img_path );
|
142 |
+
$ext = $info['extension'];
|
143 |
list( $orig_w, $orig_h ) = getimagesize( $img_path );
|
144 |
|
145 |
// Get image size after cropping.
|
161 |
if ( ! $dims || ( true == $crop && false == $upscale && ( $dst_w < $width || $dst_h < $height ) ) ) {
|
162 |
// Can't resize, so return false saying that the action to do could not be processed as planned.
|
163 |
return new WP_Error( 'broke', 'Image file does not exist (or is not an image): ' . $img_path );
|
164 |
+
// throw new RtTpgException( 'Unable to resize image because image_resize_dimensions() failed' );
|
165 |
} // Else check if cache exists.
|
166 |
elseif ( file_exists( $destfilename ) && getimagesize( $destfilename ) ) {
|
167 |
$img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
|
172 |
|
173 |
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
|
174 |
return new WP_Error( 'broke', 'Image file does not exist (or is not an image): ' . $img_path );
|
175 |
+
// throw new RtTpgException( 'Unable to get WP_Image_Editor: ' .
|
176 |
+
// $editor->get_error_message() . ' (is GD or ImageMagick installed?)' );
|
177 |
}
|
178 |
|
179 |
$resized_file = $editor->save();
|
183 |
$img_url = $upload_url . $resized_rel_path;
|
184 |
} else {
|
185 |
return new WP_Error( 'broke', 'Image file does not exist (or is not an image): ' . $img_path );
|
186 |
+
// throw new RtTpgException( 'Unable to save resized image file: ' . $editor->get_error_message() );
|
187 |
}
|
|
|
188 |
}
|
189 |
}
|
190 |
|
191 |
// Okay, leave the ship.
|
192 |
if ( true === $upscale ) {
|
193 |
+
remove_filter( 'image_resize_dimensions', [ $this, 'aq_upscale' ] );
|
194 |
}
|
195 |
|
196 |
// Return the output.
|
199 |
$image = $img_url;
|
200 |
} else {
|
201 |
// array return.
|
202 |
+
$image = [
|
203 |
0 => $img_url,
|
204 |
1 => $dst_w,
|
205 |
+
2 => $dst_h,
|
206 |
+
];
|
207 |
}
|
208 |
|
209 |
return $image;
|
226 |
function aq_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) {
|
227 |
if ( ! $crop ) {
|
228 |
return null;
|
229 |
+
} // Let the WordPress default function handle this.
|
230 |
|
231 |
// Here is the point we allow to use larger image size than the original one.
|
232 |
$aspect_ratio = $orig_w / $orig_h;
|
249 |
$s_x = floor( ( $orig_w - $crop_w ) / 2 );
|
250 |
$s_y = floor( ( $orig_h - $crop_h ) / 2 );
|
251 |
|
252 |
+
return [ 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h ];
|
253 |
}
|
254 |
}
|
|
|
|
app/RtTpg.php
CHANGED
@@ -1,4 +1,14 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
use RT\ThePostGrid\Controllers\Admin\AdminAjaxController;
|
4 |
use RT\ThePostGrid\Controllers\Admin\MetaController;
|
@@ -19,15 +29,34 @@ use RT\ThePostGrid\Controllers\Admin\UpgradeController;
|
|
19 |
require_once __DIR__ . './../vendor/autoload.php';
|
20 |
|
21 |
if ( ! class_exists( RtTpg::class ) ) {
|
|
|
|
|
|
|
22 |
final class RtTpg {
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
|
|
|
|
|
|
|
|
25 |
public $options = [
|
26 |
'settings' => 'rt_the_post_grid_settings',
|
27 |
'version' => RT_THE_POST_GRID_VERSION,
|
28 |
'installed_version' => 'rt_the_post_grid_current_version',
|
29 |
'slug' => RT_THE_POST_GRID_PLUGIN_SLUG,
|
30 |
];
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
public $defaultSettings = [
|
32 |
'tpg_block_type' => 'default',
|
33 |
'popup_fields' => [
|
@@ -47,10 +76,10 @@ if ( ! class_exists( RtTpg::class ) ) {
|
|
47 |
],
|
48 |
];
|
49 |
|
50 |
-
protected static $_instance;
|
51 |
-
|
52 |
/**
|
53 |
* Store the singleton object.
|
|
|
|
|
54 |
*/
|
55 |
private static $singleton = false;
|
56 |
|
@@ -64,17 +93,20 @@ if ( ! class_exists( RtTpg::class ) ) {
|
|
64 |
/**
|
65 |
* Fetch an instance of the class.
|
66 |
*/
|
67 |
-
|
68 |
-
if ( self::$singleton
|
69 |
self::$singleton = new self();
|
70 |
}
|
71 |
|
72 |
return self::$singleton;
|
73 |
}
|
74 |
|
75 |
-
|
|
|
|
|
|
|
|
|
76 |
protected function __init() {
|
77 |
-
|
78 |
$settings = get_option( $this->options['settings'] );
|
79 |
|
80 |
new UpgradeController();
|
@@ -89,9 +121,7 @@ if ( ! class_exists( RtTpg::class ) ) {
|
|
89 |
new MetaController();
|
90 |
}
|
91 |
|
92 |
-
if ( ! isset( $settings['tpg_block_type'] ) || in_array( $settings['tpg_block_type'], [ 'default',
|
93 |
-
'shortcode'
|
94 |
-
] ) ) {
|
95 |
new ShortcodeController();
|
96 |
new GutenBergController();
|
97 |
}
|
@@ -101,32 +131,43 @@ if ( ! class_exists( RtTpg::class ) ) {
|
|
101 |
|
102 |
( new SettingsController() )->init();
|
103 |
|
104 |
-
if ( ! isset( $settings['tpg_block_type'] ) || in_array( $settings['tpg_block_type'], [ 'default',
|
105 |
-
'elementor'
|
106 |
-
] ) ) {
|
107 |
new ElementorController();
|
108 |
}
|
109 |
|
110 |
-
|
111 |
$this->load_hooks();
|
112 |
}
|
113 |
|
|
|
|
|
|
|
|
|
|
|
114 |
private function load_hooks() {
|
115 |
register_activation_hook( RT_THE_POST_GRID_PLUGIN_FILE, [ Install::class, 'activate' ] );
|
116 |
register_deactivation_hook( RT_THE_POST_GRID_PLUGIN_FILE, [ Install::class, 'deactivate' ] );
|
117 |
|
118 |
add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ], - 1 );
|
119 |
add_action( 'init', [ &$this, 'init_hooks' ], 0 );
|
120 |
-
//add_action( 'init', [ ShortcodeController::class, 'init' ] ); // Init ShortCode.
|
121 |
add_filter( 'wp_calculate_image_srcset', '__return_false' );
|
122 |
}
|
123 |
|
|
|
|
|
|
|
|
|
|
|
124 |
public function init_hooks() {
|
125 |
do_action( 'rttpg_before_init', $this );
|
126 |
|
127 |
$this->load_language();
|
128 |
}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
130 |
public function load_language() {
|
131 |
do_action( 'rttpg_set_local', null );
|
132 |
$locale = determine_locale();
|
@@ -136,6 +177,11 @@ if ( ! class_exists( RtTpg::class ) ) {
|
|
136 |
load_plugin_textdomain( 'the-post-grid', false, plugin_basename( dirname( RT_THE_POST_GRID_PLUGIN_FILE ) ) . '/languages' );
|
137 |
}
|
138 |
|
|
|
|
|
|
|
|
|
|
|
139 |
public function on_plugins_loaded() {
|
140 |
do_action( 'rttpg_loaded', $this );
|
141 |
}
|
@@ -149,27 +195,48 @@ if ( ! class_exists( RtTpg::class ) ) {
|
|
149 |
return untrailingslashit( plugin_dir_path( RT_THE_POST_GRID_PLUGIN_FILE ) );
|
150 |
}
|
151 |
|
|
|
|
|
|
|
|
|
|
|
152 |
public function plugin_template_path() {
|
153 |
$plugin_template = $this->plugin_path() . '/templates/';
|
154 |
|
155 |
return apply_filters( 'tlp_tpg_template_path', $plugin_template );
|
156 |
}
|
157 |
|
|
|
|
|
|
|
|
|
|
|
158 |
public function default_template_path() {
|
159 |
return apply_filters( 'rttpg_default_template_path', untrailingslashit( plugin_dir_path( RT_THE_POST_GRID_PLUGIN_FILE ) ) );
|
160 |
}
|
161 |
|
|
|
|
|
|
|
|
|
|
|
162 |
public static function nonceText() {
|
163 |
-
return
|
164 |
}
|
165 |
|
|
|
|
|
|
|
|
|
|
|
166 |
public static function nonceId() {
|
167 |
-
return
|
168 |
}
|
169 |
|
170 |
/**
|
171 |
-
*
|
172 |
*
|
|
|
173 |
* @return string
|
174 |
*/
|
175 |
public function get_assets_uri( $file ) {
|
@@ -179,8 +246,9 @@ if ( ! class_exists( RtTpg::class ) ) {
|
|
179 |
}
|
180 |
|
181 |
/**
|
182 |
-
*
|
183 |
*
|
|
|
184 |
* @return string
|
185 |
*/
|
186 |
public function tpg_can_be_rtl( $file ) {
|
@@ -202,18 +270,52 @@ if ( ! class_exists( RtTpg::class ) ) {
|
|
202 |
return apply_filters( 'rttpg_template_path', 'the-post-grid/' );
|
203 |
}
|
204 |
|
205 |
-
|
|
|
|
|
|
|
|
|
206 |
public function hasPro() {
|
207 |
return class_exists( 'RtTpgPro' ) || class_exists( 'rtTPGP' );
|
208 |
}
|
209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
}
|
211 |
|
|
|
|
|
|
|
|
|
|
|
212 |
function rtTPG() {
|
213 |
return rtTPG::getInstance();
|
214 |
}
|
215 |
|
|
|
216 |
rtTPG();
|
217 |
}
|
218 |
-
|
219 |
-
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Main initialization class.
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
+
|
8 |
+
// Do not allow directly accessing this file.
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit( 'This script cannot be accessed directly.' );
|
11 |
+
}
|
12 |
|
13 |
use RT\ThePostGrid\Controllers\Admin\AdminAjaxController;
|
14 |
use RT\ThePostGrid\Controllers\Admin\MetaController;
|
29 |
require_once __DIR__ . './../vendor/autoload.php';
|
30 |
|
31 |
if ( ! class_exists( RtTpg::class ) ) {
|
32 |
+
/**
|
33 |
+
* Main initialization class.
|
34 |
+
*/
|
35 |
final class RtTpg {
|
36 |
+
/**
|
37 |
+
* Post Type
|
38 |
+
*
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
public $post_type = 'rttpg';
|
42 |
|
43 |
+
/**
|
44 |
+
* Options
|
45 |
+
*
|
46 |
+
* @var array
|
47 |
+
*/
|
48 |
public $options = [
|
49 |
'settings' => 'rt_the_post_grid_settings',
|
50 |
'version' => RT_THE_POST_GRID_VERSION,
|
51 |
'installed_version' => 'rt_the_post_grid_current_version',
|
52 |
'slug' => RT_THE_POST_GRID_PLUGIN_SLUG,
|
53 |
];
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Defaut Settings
|
57 |
+
*
|
58 |
+
* @var array
|
59 |
+
*/
|
60 |
public $defaultSettings = [
|
61 |
'tpg_block_type' => 'default',
|
62 |
'popup_fields' => [
|
76 |
],
|
77 |
];
|
78 |
|
|
|
|
|
79 |
/**
|
80 |
* Store the singleton object.
|
81 |
+
*
|
82 |
+
* @var boolean
|
83 |
*/
|
84 |
private static $singleton = false;
|
85 |
|
93 |
/**
|
94 |
* Fetch an instance of the class.
|
95 |
*/
|
96 |
+
public static function getInstance() {
|
97 |
+
if ( false === self::$singleton ) {
|
98 |
self::$singleton = new self();
|
99 |
}
|
100 |
|
101 |
return self::$singleton;
|
102 |
}
|
103 |
|
104 |
+
/**
|
105 |
+
* Class init
|
106 |
+
*
|
107 |
+
* @return void
|
108 |
+
*/
|
109 |
protected function __init() {
|
|
|
110 |
$settings = get_option( $this->options['settings'] );
|
111 |
|
112 |
new UpgradeController();
|
121 |
new MetaController();
|
122 |
}
|
123 |
|
124 |
+
if ( ! isset( $settings['tpg_block_type'] ) || in_array( $settings['tpg_block_type'], [ 'default', 'shortcode' ], true ) ) {
|
|
|
|
|
125 |
new ShortcodeController();
|
126 |
new GutenBergController();
|
127 |
}
|
131 |
|
132 |
( new SettingsController() )->init();
|
133 |
|
134 |
+
if ( ! isset( $settings['tpg_block_type'] ) || in_array( $settings['tpg_block_type'], [ 'default', 'elementor' ], true ) ) {
|
|
|
|
|
135 |
new ElementorController();
|
136 |
}
|
137 |
|
|
|
138 |
$this->load_hooks();
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* Load hooks
|
143 |
+
*
|
144 |
+
* @return void
|
145 |
+
*/
|
146 |
private function load_hooks() {
|
147 |
register_activation_hook( RT_THE_POST_GRID_PLUGIN_FILE, [ Install::class, 'activate' ] );
|
148 |
register_deactivation_hook( RT_THE_POST_GRID_PLUGIN_FILE, [ Install::class, 'deactivate' ] );
|
149 |
|
150 |
add_action( 'plugins_loaded', [ $this, 'on_plugins_loaded' ], - 1 );
|
151 |
add_action( 'init', [ &$this, 'init_hooks' ], 0 );
|
|
|
152 |
add_filter( 'wp_calculate_image_srcset', '__return_false' );
|
153 |
}
|
154 |
|
155 |
+
/**
|
156 |
+
* Init hooks
|
157 |
+
*
|
158 |
+
* @return void
|
159 |
+
*/
|
160 |
public function init_hooks() {
|
161 |
do_action( 'rttpg_before_init', $this );
|
162 |
|
163 |
$this->load_language();
|
164 |
}
|
165 |
|
166 |
+
/**
|
167 |
+
* I18n
|
168 |
+
*
|
169 |
+
* @return void
|
170 |
+
*/
|
171 |
public function load_language() {
|
172 |
do_action( 'rttpg_set_local', null );
|
173 |
$locale = determine_locale();
|
177 |
load_plugin_textdomain( 'the-post-grid', false, plugin_basename( dirname( RT_THE_POST_GRID_PLUGIN_FILE ) ) . '/languages' );
|
178 |
}
|
179 |
|
180 |
+
/**
|
181 |
+
* Plugin loaded action
|
182 |
+
*
|
183 |
+
* @return void
|
184 |
+
*/
|
185 |
public function on_plugins_loaded() {
|
186 |
do_action( 'rttpg_loaded', $this );
|
187 |
}
|
195 |
return untrailingslashit( plugin_dir_path( RT_THE_POST_GRID_PLUGIN_FILE ) );
|
196 |
}
|
197 |
|
198 |
+
/**
|
199 |
+
* Plugin template path
|
200 |
+
*
|
201 |
+
* @return string
|
202 |
+
*/
|
203 |
public function plugin_template_path() {
|
204 |
$plugin_template = $this->plugin_path() . '/templates/';
|
205 |
|
206 |
return apply_filters( 'tlp_tpg_template_path', $plugin_template );
|
207 |
}
|
208 |
|
209 |
+
/**
|
210 |
+
* Default template path
|
211 |
+
*
|
212 |
+
* @return string
|
213 |
+
*/
|
214 |
public function default_template_path() {
|
215 |
return apply_filters( 'rttpg_default_template_path', untrailingslashit( plugin_dir_path( RT_THE_POST_GRID_PLUGIN_FILE ) ) );
|
216 |
}
|
217 |
|
218 |
+
/**
|
219 |
+
* Nonce text
|
220 |
+
*
|
221 |
+
* @return string
|
222 |
+
*/
|
223 |
public static function nonceText() {
|
224 |
+
return 'rttpg_nonce_secret';
|
225 |
}
|
226 |
|
227 |
+
/**
|
228 |
+
* Nonce ID
|
229 |
+
*
|
230 |
+
* @return string
|
231 |
+
*/
|
232 |
public static function nonceId() {
|
233 |
+
return 'rttpg_nonce';
|
234 |
}
|
235 |
|
236 |
/**
|
237 |
+
* Get assets URI
|
238 |
*
|
239 |
+
* @param string $file File.
|
240 |
* @return string
|
241 |
*/
|
242 |
public function get_assets_uri( $file ) {
|
246 |
}
|
247 |
|
248 |
/**
|
249 |
+
* RTL check.
|
250 |
*
|
251 |
+
* @param string $file File.
|
252 |
* @return string
|
253 |
*/
|
254 |
public function tpg_can_be_rtl( $file ) {
|
270 |
return apply_filters( 'rttpg_template_path', 'the-post-grid/' );
|
271 |
}
|
272 |
|
273 |
+
/**
|
274 |
+
* Pro check.
|
275 |
+
*
|
276 |
+
* @return boolean
|
277 |
+
*/
|
278 |
public function hasPro() {
|
279 |
return class_exists( 'RtTpgPro' ) || class_exists( 'rtTPGP' );
|
280 |
}
|
281 |
|
282 |
+
/**
|
283 |
+
* Pro link.
|
284 |
+
*
|
285 |
+
* @return string
|
286 |
+
*/
|
287 |
+
public function proLink() {
|
288 |
+
return 'https://www.radiustheme.com/downloads/the-post-grid-pro-for-wordpress/';
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Doc link.
|
293 |
+
*
|
294 |
+
* @return string
|
295 |
+
*/
|
296 |
+
public function docLink() {
|
297 |
+
return 'https://www.radiustheme.com/docs/the-post-grid/';
|
298 |
+
}
|
299 |
+
|
300 |
+
/**
|
301 |
+
* Demo link.
|
302 |
+
*
|
303 |
+
* @return string
|
304 |
+
*/
|
305 |
+
public function demoLink() {
|
306 |
+
return 'https://www.radiustheme.com/demo/plugins/the-post-grid/';
|
307 |
+
}
|
308 |
}
|
309 |
|
310 |
+
/**
|
311 |
+
* Function for external use.
|
312 |
+
*
|
313 |
+
* @return rtTPG
|
314 |
+
*/
|
315 |
function rtTPG() {
|
316 |
return rtTPG::getInstance();
|
317 |
}
|
318 |
|
319 |
+
// Init app.
|
320 |
rtTPG();
|
321 |
}
|
|
|
|
app/Widgets/ElementorWidget.php
CHANGED
@@ -1,10 +1,23 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Widgets;
|
4 |
|
5 |
use Elementor\Widget_Base;
|
6 |
use RT\ThePostGrid\Helpers\Fns;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
class ElementorWidget extends Widget_Base {
|
9 |
|
10 |
public function get_name() {
|
@@ -12,7 +25,7 @@ class ElementorWidget extends Widget_Base {
|
|
12 |
}
|
13 |
|
14 |
public function get_title() {
|
15 |
-
return
|
16 |
}
|
17 |
|
18 |
public function get_icon() {
|
@@ -27,19 +40,19 @@ class ElementorWidget extends Widget_Base {
|
|
27 |
$this->start_controls_section(
|
28 |
'content_section',
|
29 |
[
|
30 |
-
'label' =>
|
31 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
|
32 |
]
|
33 |
);
|
34 |
|
35 |
$this->add_control(
|
36 |
'post_grid_id',
|
37 |
-
|
38 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
39 |
'id' => 'style',
|
40 |
-
'label' =>
|
41 |
-
'options' => Fns::getAllTPGShortCodeList()
|
42 |
-
|
43 |
);
|
44 |
|
45 |
$this->end_controls_section();
|
@@ -47,10 +60,10 @@ class ElementorWidget extends Widget_Base {
|
|
47 |
|
48 |
protected function render() {
|
49 |
$settings = $this->get_settings_for_display();
|
50 |
-
if(isset($settings['post_grid_id']) && !empty($settings['post_grid_id']) && $id =
|
51 |
-
echo do_shortcode( '[the-post-grid id="' . $id . '"]' );
|
52 |
-
}else{
|
53 |
-
echo
|
54 |
}
|
55 |
}
|
56 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Elementor Widget Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Widgets;
|
9 |
|
10 |
use Elementor\Widget_Base;
|
11 |
use RT\ThePostGrid\Helpers\Fns;
|
12 |
|
13 |
+
// Do not allow directly accessing this file.
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit( 'This script cannot be accessed directly.' );
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Elementor Widget Class
|
20 |
+
*/
|
21 |
class ElementorWidget extends Widget_Base {
|
22 |
|
23 |
public function get_name() {
|
25 |
}
|
26 |
|
27 |
public function get_title() {
|
28 |
+
return esc_html__( 'The Post Grid', 'the-post-grid' );
|
29 |
}
|
30 |
|
31 |
public function get_icon() {
|
40 |
$this->start_controls_section(
|
41 |
'content_section',
|
42 |
[
|
43 |
+
'label' => esc_html__( 'The Post Grid', 'the-post-grid' ),
|
44 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
|
45 |
]
|
46 |
);
|
47 |
|
48 |
$this->add_control(
|
49 |
'post_grid_id',
|
50 |
+
[
|
51 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
52 |
'id' => 'style',
|
53 |
+
'label' => esc_html__( 'Post Grid', 'the-post-grid' ),
|
54 |
+
'options' => Fns::getAllTPGShortCodeList(),
|
55 |
+
]
|
56 |
);
|
57 |
|
58 |
$this->end_controls_section();
|
60 |
|
61 |
protected function render() {
|
62 |
$settings = $this->get_settings_for_display();
|
63 |
+
if ( isset( $settings['post_grid_id'] ) && ! empty( $settings['post_grid_id'] ) && $id = $settings['post_grid_id'] ) {
|
64 |
+
echo do_shortcode( '[the-post-grid id="' . absint( $id ) . '"]' );
|
65 |
+
} else {
|
66 |
+
echo 'Please select a post grid';
|
67 |
}
|
68 |
}
|
69 |
+
}
|
app/Widgets/TPGWidget.php
CHANGED
@@ -1,81 +1,93 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
namespace RT\ThePostGrid\Widgets;
|
4 |
|
5 |
use RT\ThePostGrid\Helpers\Fns;
|
6 |
use WP_Widget;
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
/**
|
|
|
9 |
*
|
|
|
10 |
*/
|
11 |
class TPGWidget extends WP_Widget {
|
12 |
|
13 |
-
function __construct() {
|
14 |
-
|
15 |
$widget_ops = [
|
16 |
'classname' => 'widget_tpg_post_grid',
|
17 |
-
'description' =>
|
18 |
];
|
19 |
-
|
|
|
20 |
|
21 |
}
|
22 |
|
23 |
/**
|
24 |
* display the widgets on the screen.
|
25 |
*/
|
26 |
-
function widget( $args, $instance ) {
|
27 |
extract( $args );
|
28 |
$id = ( ! empty( $instance['id'] ) ? absint( $instance['id'] ) : null );
|
29 |
|
30 |
-
echo $before_widget;
|
|
|
31 |
if ( ! empty( $instance['title'] ) ) {
|
32 |
-
echo $args['before_title'] . apply_filters( 'widget_title',
|
33 |
-
( isset( $instance['title'] ) ? $instance['title'] : "The Post Grid" ) ) . $args['after_title'];
|
34 |
}
|
|
|
35 |
if ( ! empty( $id ) ) {
|
36 |
-
echo do_shortcode(
|
37 |
}
|
38 |
-
|
|
|
39 |
}
|
40 |
|
41 |
-
function form( $instance ) {
|
42 |
|
43 |
$scList = Fns::getAllTPGShortCodeList();
|
44 |
-
$defaults =
|
45 |
-
'title' =>
|
46 |
-
'id' => null
|
47 |
-
|
48 |
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
'
|
58 |
-
|
59 |
-
name="<?php echo $this->get_field_name( 'id' ); ?>">
|
60 |
-
<option value="">Select one</option>
|
61 |
<?php
|
62 |
if ( ! empty( $scList ) ) {
|
63 |
foreach ( $scList as $scId => $sc ) {
|
64 |
-
$selected = ( $scId == $instance['id'] ?
|
65 |
-
echo
|
66 |
}
|
67 |
}
|
68 |
?>
|
69 |
-
|
70 |
<?php
|
71 |
}
|
72 |
|
73 |
public function update( $new_instance, $old_instance ) {
|
74 |
-
$instance =
|
75 |
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
|
76 |
$instance['id'] = ( ! empty( $new_instance['id'] ) ) ? absint( $new_instance['id'] ) : '';
|
77 |
|
78 |
return $instance;
|
79 |
}
|
80 |
|
81 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* TPG Widget Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
namespace RT\ThePostGrid\Widgets;
|
9 |
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
use WP_Widget;
|
12 |
|
13 |
+
// Do not allow directly accessing this file.
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
+
exit( 'This script cannot be accessed directly.' );
|
16 |
+
}
|
17 |
+
|
18 |
/**
|
19 |
+
* TPG Widget Class
|
20 |
*
|
21 |
+
* @package RT_TPG
|
22 |
*/
|
23 |
class TPGWidget extends WP_Widget {
|
24 |
|
25 |
+
public function __construct() {
|
|
|
26 |
$widget_ops = [
|
27 |
'classname' => 'widget_tpg_post_grid',
|
28 |
+
'description' => esc_html__( 'Display the post grid.', 'the-post-grid' ),
|
29 |
];
|
30 |
+
|
31 |
+
parent::__construct( 'widget_tpg_post_grid', esc_html__( 'The Post Grid', 'the-post-grid' ), $widget_ops );
|
32 |
|
33 |
}
|
34 |
|
35 |
/**
|
36 |
* display the widgets on the screen.
|
37 |
*/
|
38 |
+
public function widget( $args, $instance ) {
|
39 |
extract( $args );
|
40 |
$id = ( ! empty( $instance['id'] ) ? absint( $instance['id'] ) : null );
|
41 |
|
42 |
+
echo $before_widget; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
43 |
+
|
44 |
if ( ! empty( $instance['title'] ) ) {
|
45 |
+
echo $args['before_title'] . apply_filters( 'widget_title', ( isset( $instance['title'] ) ? $instance['title'] : 'The Post Grid' ) ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
|
|
46 |
}
|
47 |
+
|
48 |
if ( ! empty( $id ) ) {
|
49 |
+
echo do_shortcode( '[the-post-grid id="' . absint( $id ) . '" ]' );
|
50 |
}
|
51 |
+
|
52 |
+
echo $after_widget; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
53 |
}
|
54 |
|
55 |
+
public function form( $instance ) {
|
56 |
|
57 |
$scList = Fns::getAllTPGShortCodeList();
|
58 |
+
$defaults = [
|
59 |
+
'title' => 'The Post Grid',
|
60 |
+
'id' => null,
|
61 |
+
];
|
62 |
$instance = wp_parse_args( (array) $instance, $defaults ); ?>
|
63 |
|
64 |
+
<p><label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"> <?php esc_html_e( 'Title:', 'the-post-grid' ); ?></label>
|
65 |
+
<input type="text" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
|
66 |
+
name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>"
|
67 |
+
style="width:100%;"/></p>
|
68 |
+
|
69 |
+
<p><label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Select post grid', 'the-post-grid' ); ?></label>
|
70 |
+
<select id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"
|
71 |
+
name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>">
|
72 |
+
<option value="">Select one</option>
|
|
|
|
|
73 |
<?php
|
74 |
if ( ! empty( $scList ) ) {
|
75 |
foreach ( $scList as $scId => $sc ) {
|
76 |
+
$selected = ( $scId == $instance['id'] ? 'selected' : null );
|
77 |
+
echo '<option value="' . absint( $scId ) . '" ' . esc_attr( $selected ) . '>' . esc_html( $sc ) . '</option>';
|
78 |
}
|
79 |
}
|
80 |
?>
|
81 |
+
</select></p>
|
82 |
<?php
|
83 |
}
|
84 |
|
85 |
public function update( $new_instance, $old_instance ) {
|
86 |
+
$instance = [];
|
87 |
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
|
88 |
$instance['id'] = ( ! empty( $new_instance['id'] ) ) ? absint( $new_instance['id'] ) : '';
|
89 |
|
90 |
return $instance;
|
91 |
}
|
92 |
|
93 |
+
}
|
app/Widgets/elementor/base.php
CHANGED
@@ -1,22 +1,23 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
-
|
9 |
use Elementor\Widget_Base;
|
10 |
use RT\ThePostGrid\Helpers\Fns;
|
11 |
use RT\ThePostGrid\Helpers\Options;
|
12 |
-
use RT\ThePostGridPro\Traits\ListingItem;
|
13 |
|
|
|
14 |
if ( ! defined( 'ABSPATH' ) ) {
|
15 |
-
exit;
|
16 |
-
}
|
17 |
|
|
|
|
|
|
|
18 |
abstract class Custom_Widget_Base extends Widget_Base {
|
19 |
-
|
20 |
public $tpg_name;
|
21 |
public $tpg_base;
|
22 |
public $tpg_category;
|
@@ -41,12 +42,10 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
41 |
$this->get_pro_message = null;
|
42 |
$this->last_post_id = $this->get_last_post_id();
|
43 |
|
44 |
-
|
45 |
if ( ! rtTPG()->hasPro() ) {
|
46 |
$this->pro_label = __( '<span class="tpg-pro-label">Pro</span>', 'the-post-grid' );
|
47 |
$this->is_post_layout = ' the-post-grid-pro-needed';
|
48 |
-
$this->get_pro_message =
|
49 |
-
'the-post-grid' );
|
50 |
}
|
51 |
|
52 |
parent::__construct( $data, $args );
|
@@ -57,7 +56,7 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
57 |
return;
|
58 |
}
|
59 |
|
60 |
-
return
|
61 |
}
|
62 |
|
63 |
public function get_name() {
|
@@ -80,12 +79,14 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
80 |
public function tpg_template( $data ) {
|
81 |
$layout = str_replace( '-2', '', $data['layout'] );
|
82 |
$template_name = '/the-post-grid/elementor/' . $layout . '.php';
|
|
|
83 |
if ( file_exists( STYLESHEETPATH . $template_name ) ) {
|
84 |
$file = STYLESHEETPATH . $template_name;
|
85 |
} elseif ( file_exists( TEMPLATEPATH . $template_name ) ) {
|
86 |
$file = TEMPLATEPATH . $template_name;
|
87 |
} else {
|
88 |
$file = RT_THE_POST_GRID_PLUGIN_PATH . '/templates/elementor/' . $layout . '.php';
|
|
|
89 |
if ( ! file_exists( $file ) ) {
|
90 |
if ( rtTPG()->hasPro() ) {
|
91 |
$file = RT_THE_POST_GRID_PRO_PLUGIN_PATH . '/templates/elementor/' . $layout . '.php';
|
@@ -97,7 +98,6 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
97 |
}
|
98 |
}
|
99 |
|
100 |
-
|
101 |
ob_start();
|
102 |
include $file;
|
103 |
echo ob_get_clean();
|
@@ -107,6 +107,7 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
107 |
$layout = str_replace( '-2', '', $data['layout'] );
|
108 |
$template_name = '/the-post-grid/elementor/' . $layout . '.php';
|
109 |
$path = RT_THE_POST_GRID_PLUGIN_PATH . '/templates/elementor/';
|
|
|
110 |
if ( file_exists( STYLESHEETPATH . $template_name ) ) {
|
111 |
$path = STYLESHEETPATH . '/the-post-grid/elementor/';
|
112 |
} elseif ( file_exists( TEMPLATEPATH . $template_name ) ) {
|
@@ -128,11 +129,10 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
128 |
* Get last post id
|
129 |
*
|
130 |
* @param string $post_type
|
131 |
-
* @param false
|
132 |
*
|
133 |
* @return int
|
134 |
*/
|
135 |
-
|
136 |
public function get_last_post_id( $post_type = 'post' ): int {
|
137 |
if ( is_singular( $post_type ) ) {
|
138 |
return get_the_ID();
|
@@ -163,18 +163,22 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
163 |
if ( is_archive() ) {
|
164 |
return;
|
165 |
}
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
|
|
|
|
|
|
|
|
171 |
if ( ! empty( $categories ) && ! is_wp_error( $categories ) ) {
|
172 |
return $categories[0]->term_id;
|
173 |
}
|
174 |
}
|
175 |
|
176 |
-
//post category list
|
177 |
-
function tpg_category_list() {
|
178 |
$categories = get_categories( [ 'hide_empty' => false ] );
|
179 |
$lists = [];
|
180 |
foreach ( $categories as $category ) {
|
@@ -184,8 +188,8 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
184 |
return $lists;
|
185 |
}
|
186 |
|
187 |
-
// post tags lists
|
188 |
-
function tpg_tag_list() {
|
189 |
$tags = get_tags( [ 'hide_empty' => false ] );
|
190 |
$tag_list = [];
|
191 |
foreach ( $tags as $tag ) {
|
@@ -195,13 +199,16 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
195 |
return $tag_list;
|
196 |
}
|
197 |
|
198 |
-
//Get Custom post category
|
199 |
protected function tpg_get_categories_by_slug( $cat ) {
|
200 |
-
$terms = get_terms(
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
|
|
|
|
205 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
|
206 |
foreach ( $terms as $term ) {
|
207 |
$options[ $term->slug ] = $term->name;
|
@@ -211,14 +218,17 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
211 |
}
|
212 |
}
|
213 |
|
214 |
-
//Get Custom post category
|
215 |
public function tpg_get_categories_by_id( $cat ) {
|
216 |
-
$terms = get_terms(
|
217 |
-
|
218 |
-
|
219 |
-
|
|
|
|
|
220 |
|
221 |
$options = [];
|
|
|
222 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
|
223 |
foreach ( $terms as $term ) {
|
224 |
$options[ $term->term_id ] = $term->name;
|
@@ -232,6 +242,7 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
232 |
public function get_all_post_type() {
|
233 |
$post_types = get_post_types( [], 'objects' );
|
234 |
$pt_list = [];
|
|
|
235 |
foreach ( $post_types as $type ) {
|
236 |
if ( isset( $type->rewrite->slug ) ) {
|
237 |
$pt_list[ $type->rewrite->slug ] = $type->rewrite->name;
|
@@ -242,7 +253,13 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
242 |
}
|
243 |
|
244 |
public static function get_post_types() {
|
245 |
-
$post_types = get_post_types(
|
|
|
|
|
|
|
|
|
|
|
|
|
246 |
$post_types = wp_list_pluck( $post_types, 'label', 'name' );
|
247 |
|
248 |
return array_diff_key( $post_types, [ 'elementor_library', 'attachment' ] );
|
@@ -276,9 +293,9 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
276 |
*/
|
277 |
public function get_frontend_filter_markup( $data ) {
|
278 |
if ( ! rtTPG()->hasPro()
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
) {
|
283 |
return;
|
284 |
}
|
@@ -287,13 +304,12 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
287 |
$wrapperContainer = $wrapperClass = $itemClass = $filter_btn_item_per_page = '';
|
288 |
|
289 |
if ( 'carousel' === $data['filter_btn_style'] ) {
|
290 |
-
$wrapperContainer
|
291 |
-
$wrapperClass
|
292 |
-
$itemClass
|
293 |
-
$filter_btn_mobile
|
294 |
-
$filter_btn_tablet
|
295 |
-
$filter_btn_item_per_page
|
296 |
-
= "data-per-page = '{$data['filter_btn_item_per_page']}' data-per-page-mobile = '{$filter_btn_mobile}' data-per-tablet = '{$filter_btn_tablet}'";
|
297 |
}
|
298 |
|
299 |
$html .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
|
@@ -301,18 +317,15 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
301 |
if ( 'show' == $data['show_author_filter'] || 'show' == $data['show_taxonomy_filter'] ) {
|
302 |
$html .= "<div class='filter-left-wrapper {$wrapperContainer}' {$filter_btn_item_per_page}>";
|
303 |
}
|
304 |
-
|
305 |
-
// $html .= "<div class='swiper-pagination'></div>";
|
306 |
-
// }
|
307 |
$selectedSubTermsForButton = null;
|
308 |
|
309 |
$filterType = $data['filter_type'];
|
310 |
$post_count = ( 'yes' == $data['filter_post_count'] ) ? true : false;
|
311 |
|
312 |
-
|
313 |
if ( 'show' == $data['show_taxonomy_filter'] ) {
|
314 |
-
$postCountClass = ( $post_count ?
|
315 |
-
$allSelect =
|
316 |
$isTermSelected = false;
|
317 |
|
318 |
$taxFilterOperator = $data['relation'];
|
@@ -321,89 +334,101 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
321 |
$taxFilter = $data[ $section_term_key ];
|
322 |
|
323 |
$taxonomy_label = '';
|
|
|
324 |
if ( $taxFilter ) {
|
325 |
$taxonomy_details = get_taxonomy( $taxFilter );
|
326 |
$taxonomy_label = $taxonomy_details->label;
|
327 |
}
|
328 |
|
329 |
-
|
330 |
$default_term_key = $taxFilter . '_default_terms';
|
331 |
$default_term = $data[ $default_term_key ];
|
332 |
|
333 |
-
$allText = $data['tax_filter_all_text'] ? $data['tax_filter_all_text'] :
|
334 |
-
|
335 |
|
336 |
$_taxonomies = get_object_taxonomies( $data['post_type'], 'objects' );
|
337 |
$terms = [];
|
|
|
338 |
foreach ( $_taxonomies as $index => $object ) {
|
339 |
if ( $object->name != $taxFilter ) {
|
340 |
continue;
|
341 |
}
|
|
|
342 |
$setting_key = $object->name . '_ids';
|
|
|
343 |
if ( ! empty( $data[ $setting_key ] ) ) {
|
344 |
$terms = $data[ $setting_key ];
|
345 |
} else {
|
346 |
-
$terms = get_terms(
|
347 |
-
|
348 |
-
|
349 |
-
|
|
|
|
|
350 |
}
|
351 |
}
|
352 |
$taxFilterTerms = $terms;
|
353 |
|
354 |
-
|
355 |
if ( $default_term && $taxFilter ) {
|
356 |
$isTermSelected = true;
|
357 |
$allSelect = null;
|
358 |
}
|
|
|
359 |
if ( $filterType == 'dropdown' ) {
|
360 |
-
$html
|
361 |
$termDefaultText = $allText;
|
362 |
$dataTerm = 'all';
|
363 |
-
$htmlButton =
|
364 |
$selectedSubTerms = null;
|
365 |
$pCount = 0;
|
366 |
|
367 |
-
|
368 |
if ( ! empty( $terms ) ) {
|
369 |
$i = 0;
|
|
|
370 |
foreach ( $terms as $term_id ) {
|
371 |
$term = get_term( $term_id, $taxFilter, ARRAY_A );
|
372 |
$id = $term['term_id'];
|
373 |
$pCount = $pCount + $term['count'];
|
374 |
$sT = null;
|
|
|
375 |
if ( $data['tgp_filter_taxonomy_hierarchical'] == 'yes' ) {
|
376 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
|
|
377 |
if ( ! empty( $subTerms ) ) {
|
378 |
$count = 0;
|
379 |
$item = $allCount = null;
|
|
|
380 |
foreach ( $subTerms as $stId => $t ) {
|
381 |
$count = $count + absint( $t['count'] );
|
382 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
383 |
-
$item
|
384 |
}
|
|
|
385 |
if ( $post_count ) {
|
386 |
$allCount = " (<span class='rt-post-count'>{$count}</span>)";
|
387 |
}
|
|
|
388 |
$sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
|
389 |
$sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
$sT .= '<span class="term-dropdown rt-filter-dropdown">';
|
394 |
$sT .= $item;
|
395 |
$sT .= '</span>';
|
396 |
-
$sT .=
|
397 |
}
|
|
|
398 |
if ( $default_term === $id ) {
|
399 |
$selectedSubTerms = $sT;
|
400 |
}
|
401 |
}
|
402 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
|
|
403 |
if ( $default_term && $default_term == $id ) {
|
404 |
$termDefaultText = $term['name'] . $postCount;
|
405 |
$dataTerm = $id;
|
406 |
}
|
|
|
407 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
408 |
if ( in_array( $id, $taxFilterTerms ) ) {
|
409 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
@@ -411,52 +436,60 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
411 |
} else {
|
412 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
413 |
}
|
|
|
414 |
$i ++;
|
415 |
}
|
416 |
}
|
417 |
$pAllCount = null;
|
|
|
418 |
if ( $post_count ) {
|
419 |
$pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
|
|
|
420 |
if ( ! $default_term ) {
|
421 |
$termDefaultText = $termDefaultText;
|
422 |
}
|
423 |
}
|
424 |
|
425 |
if ( 'yes' == $data['tpg_hide_all_button'] ) {
|
426 |
-
$htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText .
|
427 |
-
. $htmlButton;
|
428 |
}
|
|
|
429 |
$htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
|
430 |
|
431 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
|
436 |
$html .= $showAllhtml . $htmlButton;
|
437 |
$html .= '</div>' . $selectedSubTerms;
|
438 |
} else {
|
439 |
-
//if Button the execute
|
440 |
-
|
441 |
|
442 |
$bCount = 0;
|
443 |
$bItems = null;
|
|
|
444 |
if ( ! empty( $terms ) ) {
|
445 |
foreach ( $terms as $term_id ) {
|
446 |
-
$term
|
447 |
-
|
448 |
$id = $term['term_id'];
|
449 |
$bCount = $bCount + absint( $term['count'] );
|
450 |
$sT = null;
|
|
|
451 |
if ( $data['tgp_filter_taxonomy_hierarchical'] == 'yes' && $data['filter_btn_style'] === 'default' && $data['filter_type'] == 'button' ) {
|
452 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
|
|
453 |
if ( ! empty( $subTerms ) ) {
|
454 |
$sT .= "<div class='rt-filter-sub-tax sub-button-group '>";
|
|
|
455 |
foreach ( $subTerms as $stId => $t ) {
|
456 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
457 |
-
$sT
|
458 |
}
|
459 |
-
|
|
|
|
|
460 |
if ( $default_term === $id ) {
|
461 |
$selectedSubTermsForButton = $sT;
|
462 |
}
|
@@ -464,9 +497,11 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
464 |
}
|
465 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
466 |
$termSelected = null;
|
|
|
467 |
if ( $isTermSelected && $id == $default_term ) {
|
468 |
-
$termSelected =
|
469 |
}
|
|
|
470 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
471 |
if ( in_array( $id, $taxFilterTerms ) ) {
|
472 |
$bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected} {$itemClass}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
|
@@ -478,21 +513,21 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
478 |
}
|
479 |
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass} {$wrapperClass}' data-taxonomy='{$taxFilter}' data-filter='taxonomy'>";
|
480 |
|
481 |
-
//$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
482 |
if ( 'yes' == $data['tpg_hide_all_button'] ) {
|
483 |
-
$html .= "<span class='term-button-item rt-filter-button-item {$allSelect} {$itemClass}' data-term='all'>" . $allText .
|
484 |
}
|
485 |
|
486 |
$html .= $bItems;
|
487 |
|
488 |
-
$html .=
|
|
|
489 |
if ( 'carousel' === $data['filter_btn_style'] ) {
|
490 |
$html .= '<div class="swiper-navigation"><div class="swiper-button-prev slider-btn"></div><div class="swiper-button-next slider-btn"></div></div>';
|
491 |
}
|
492 |
}
|
493 |
}
|
494 |
|
495 |
-
// TODO: Author filter
|
496 |
if ( 'show' == $data['show_author_filter'] ) {
|
497 |
$user_el = $data['author'];
|
498 |
|
@@ -503,25 +538,24 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
503 |
} else {
|
504 |
$users = get_users( apply_filters( 'tpg_author_arg', [] ) );
|
505 |
}
|
506 |
-
|
507 |
-
$
|
508 |
-
|
509 |
-
// if ( $default_term && $taxFilter ) {
|
510 |
$isTermSelected = true;
|
511 |
-
|
512 |
-
// }
|
513 |
if ( $filterType == 'dropdown' ) {
|
514 |
-
$html
|
515 |
$termDefaultText = $allText;
|
516 |
$dataAuthor = 'all';
|
517 |
-
$htmlButton =
|
518 |
-
$htmlButton
|
519 |
-
$htmlButton
|
520 |
|
521 |
if ( ! empty( $users ) ) {
|
522 |
foreach ( $users as $user ) {
|
523 |
$user_post_count = false;
|
524 |
-
$post_count ?
|
|
|
525 |
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
526 |
if ( in_array( $user->ID, $filterAuthors ) ) {
|
527 |
if ( $default_term == $user->ID ) {
|
@@ -542,13 +576,12 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
542 |
}
|
543 |
}
|
544 |
|
545 |
-
|
546 |
$htmlButton .= '</span>';
|
547 |
|
548 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
|
553 |
$html .= $showAllhtml . $htmlButton;
|
554 |
$html .= '</div>';
|
@@ -569,74 +602,72 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
569 |
}
|
570 |
|
571 |
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-filter='author'>";
|
572 |
-
|
573 |
-
//$pCountH = ( $post_count ? " (<span class='rt-post-count'>{$bCount}</span>)" : null );
|
574 |
-
$html .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . "</span>";
|
575 |
-
// }
|
576 |
$html .= $bItems;
|
577 |
-
$html .=
|
578 |
}
|
579 |
}
|
580 |
|
581 |
-
|
582 |
if ( 'show' == $data['show_author_filter'] || 'show' == $data['show_taxonomy_filter'] ) {
|
583 |
-
$html .=
|
584 |
}
|
585 |
|
586 |
-
|
587 |
if ( 'show' == $data['show_order_by'] || 'show' == $data['show_sort_order'] || 'show' == $data['show_search'] ) {
|
588 |
$html .= "<div class='filter-right-wrapper'>";
|
589 |
}
|
590 |
|
591 |
-
|
592 |
-
// TODO: Order Filter
|
593 |
if ( 'show' == $data['show_sort_order'] ) {
|
594 |
-
$action_order = ( $data['order'] ? strtoupper( $data['order'] ) :
|
595 |
-
$html
|
596 |
-
$html
|
597 |
-
$html
|
598 |
}
|
599 |
|
600 |
-
//TODO: Orderby Filter
|
601 |
if ( 'show' == $data['show_order_by'] ) {
|
602 |
-
$wooFeature = ( $data['post_type'] ==
|
603 |
$orders = Options::rtPostOrderBy( $wooFeature );
|
604 |
-
$action_orderby = ( ! empty( $data['orderby'] ) ? $data['orderby'] :
|
|
|
605 |
if ( $action_orderby == 'none' ) {
|
606 |
-
$action_orderby_label =
|
607 |
} elseif ( in_array( $action_orderby, array_keys( Options::rtMetaKeyType() ) ) ) {
|
608 |
-
$action_orderby_label =
|
609 |
} else {
|
610 |
-
$action_orderby_label =
|
611 |
}
|
|
|
612 |
if ( $action_orderby !== 'none' ) {
|
613 |
-
$orders['none'] =
|
614 |
}
|
|
|
615 |
$html .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap" data-filter="orderby">';
|
616 |
$html .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
$html .= '<span class="order-by-dropdown rt-filter-dropdown">';
|
621 |
|
622 |
foreach ( $orders as $orderKey => $order ) {
|
623 |
$html .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
|
624 |
}
|
|
|
625 |
$html .= '</span>';
|
626 |
$html .= '</div>';
|
627 |
}
|
628 |
|
629 |
-
//TODO: Search Filter
|
630 |
if ( 'show' == $data['show_search'] ) {
|
631 |
$html .= '<div class="rt-filter-item-wrap rt-search-filter-wrap" data-filter="search">';
|
632 |
-
$html .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__(
|
633 |
$html .= "<span class='rt-action'>🔍</span>";
|
634 |
$html .= "<span class='rt-loading'></span>";
|
635 |
$html .= '</div>';
|
636 |
}
|
637 |
|
638 |
if ( 'show' == $data['show_order_by'] || 'show' == $data['show_sort_order'] || 'show' == $data['show_search'] ) {
|
639 |
-
$html .=
|
640 |
}
|
641 |
|
642 |
$html .= "</div>$selectedSubTermsForButton</div>";
|
@@ -662,30 +693,28 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
662 |
$posts_loading_type = $data['pagination_type'];
|
663 |
$posts_per_page = ( isset( $data['display_per_page'] ) && $data['display_per_page'] ) ? $data['display_per_page']
|
664 |
: ( $data['post_limit'] ? $data['post_limit'] : get_option( 'posts_per_page' ) );
|
665 |
-
$hide = ( $query->max_num_pages < 2 ?
|
666 |
|
667 |
-
if ( $posts_loading_type ==
|
668 |
$htmlUtility .= Fns::rt_pagination( $query, $posts_per_page );
|
669 |
-
} elseif ( rtTPG()->hasPro() && $posts_loading_type ==
|
670 |
$htmlUtility .= "<div class='rt-page-numbers'></div>";
|
671 |
-
} elseif ( rtTPG()->hasPro() && $posts_loading_type ==
|
672 |
-
$load_more_btn_text = $data['load_more_button_text'] ? esc_html( $data['load_more_button_text'] ) :
|
673 |
-
$htmlUtility
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
} elseif ( rtTPG()->hasPro() && $posts_loading_type ==
|
678 |
-
$htmlUtility .= "<div class='rt-infinite-action'>
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
}
|
684 |
|
685 |
-
|
686 |
if ( $htmlUtility ) {
|
687 |
-
$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}' >"
|
688 |
-
. $htmlUtility . "</div>";
|
689 |
|
690 |
return $html;
|
691 |
}
|
@@ -696,25 +725,27 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
696 |
/**
|
697 |
* Get Popup Modal Markup
|
698 |
*/
|
699 |
-
function get_modal_markup() {
|
700 |
-
$html
|
701 |
$html .= '<div class="md-modal rt-md-effect" id="rt-modal">
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
$html .= "<div class='md-overlay'></div>";
|
710 |
-
|
|
|
711 |
}
|
712 |
|
713 |
/**
|
714 |
* Get Archive page title
|
715 |
*/
|
716 |
-
function get_archive_title() {
|
717 |
$queried_obj = get_queried_object();
|
|
|
718 |
if ( is_tag() || is_category() ) {
|
719 |
echo esc_html( $queried_obj->name );
|
720 |
} elseif ( is_author() ) {
|
@@ -725,7 +756,7 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
725 |
$day = get_query_var( 'day' );
|
726 |
$time_string = $year . '/' . $monthnum . '/' . $day;
|
727 |
$time_stamp = strtotime( $time_string );
|
728 |
-
|
729 |
}
|
730 |
}
|
731 |
|
@@ -734,30 +765,31 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
734 |
*
|
735 |
* @param $data
|
736 |
*/
|
737 |
-
function get_section_title( $data ) {
|
738 |
if ( 'show' != $data['show_section_title'] ) {
|
739 |
return;
|
740 |
}
|
741 |
|
742 |
$_is_link = false;
|
|
|
743 |
if ( ! empty( $data['section_title_link']['url'] ) ) {
|
744 |
$this->add_link_attributes( 'section_title_link', $data['section_title_link'] );
|
745 |
$_is_link = true;
|
746 |
}
|
747 |
|
748 |
-
|
749 |
$this->add_inline_editing_attributes( 'section_title_text', 'none' );
|
750 |
ob_start();
|
751 |
?>
|
752 |
|
753 |
-
|
754 |
-
|
755 |
|
756 |
-
<?php printf( "<%s class='tpg-widget-heading'>", $data['section_title_tag'] ); ?>
|
757 |
|
758 |
<?php
|
759 |
-
if ( $_is_link ) :
|
760 |
-
|
|
|
761 |
<?php endif; ?>
|
762 |
|
763 |
<?php
|
@@ -765,6 +797,7 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
765 |
$archive_prefix = $data['title_prefix'] ? $data['title_prefix'] . ' ' : null;
|
766 |
$archive_suffix = $data['title_suffix'] ? ' ' . $data['title_suffix'] : null;
|
767 |
printf( "<span class='prefix-text'>%s</span>", esc_html( $archive_prefix ) );
|
|
|
768 |
if ( is_archive() ) {
|
769 |
$this->get_archive_title();
|
770 |
} elseif ( is_search() ) {
|
@@ -772,31 +805,33 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
772 |
} else {
|
773 |
the_title();
|
774 |
}
|
|
|
775 |
printf( "<span class='suffix-text'>%s</span>", esc_html( $archive_suffix ) );
|
776 |
} else {
|
777 |
?>
|
778 |
-
|
779 |
-
|
780 |
-
|
781 |
<?php
|
782 |
}
|
783 |
?>
|
784 |
|
785 |
<?php if ( $_is_link ) : ?>
|
786 |
-
|
787 |
|
788 |
<?php endif; ?>
|
789 |
-
<?php printf(
|
790 |
-
|
791 |
-
|
792 |
|
793 |
<?php if ( isset( $data['show_cat_desc'] ) && $data['show_cat_desc'] == 'yes' && category_description( $this->get_last_category_id() ) ) : ?>
|
794 |
-
|
795 |
<?php echo category_description( $this->get_last_category_id() ); ?>
|
796 |
-
|
797 |
<?php endif; ?>
|
798 |
|
799 |
-
<?php
|
|
|
800 |
}
|
801 |
|
802 |
|
@@ -809,7 +844,7 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
809 |
*
|
810 |
* @return array
|
811 |
*/
|
812 |
-
function get_render_data_set( $data, $total_pages, $posts_per_page ) {
|
813 |
$_prefix = $this->prefix;
|
814 |
|
815 |
$data_set = [
|
@@ -895,6 +930,4 @@ abstract class Custom_Widget_Base extends Widget_Base {
|
|
895 |
|
896 |
return $data_set;
|
897 |
}
|
898 |
-
|
899 |
-
|
900 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Base Abstract Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
|
|
8 |
use Elementor\Widget_Base;
|
9 |
use RT\ThePostGrid\Helpers\Fns;
|
10 |
use RT\ThePostGrid\Helpers\Options;
|
|
|
11 |
|
12 |
+
// Do not allow directly accessing this file.
|
13 |
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit( 'This script cannot be accessed directly.' );
|
15 |
+
}
|
16 |
|
17 |
+
/**
|
18 |
+
* Base Abstract Class
|
19 |
+
*/
|
20 |
abstract class Custom_Widget_Base extends Widget_Base {
|
|
|
21 |
public $tpg_name;
|
22 |
public $tpg_base;
|
23 |
public $tpg_category;
|
42 |
$this->get_pro_message = null;
|
43 |
$this->last_post_id = $this->get_last_post_id();
|
44 |
|
|
|
45 |
if ( ! rtTPG()->hasPro() ) {
|
46 |
$this->pro_label = __( '<span class="tpg-pro-label">Pro</span>', 'the-post-grid' );
|
47 |
$this->is_post_layout = ' the-post-grid-pro-needed';
|
48 |
+
$this->get_pro_message = 'Please <a target="_blank" href="' . esc_url( rtTpg()->proLink() ) . '">upgrade</a> to pro for more options';
|
|
|
49 |
}
|
50 |
|
51 |
parent::__construct( $data, $args );
|
56 |
return;
|
57 |
}
|
58 |
|
59 |
+
return 'Please <a target="_blank" href="' . esc_url( rtTpg()->proLink() ) . '">upgrade</a> to pro for ' . esc_html( $message );
|
60 |
}
|
61 |
|
62 |
public function get_name() {
|
79 |
public function tpg_template( $data ) {
|
80 |
$layout = str_replace( '-2', '', $data['layout'] );
|
81 |
$template_name = '/the-post-grid/elementor/' . $layout . '.php';
|
82 |
+
|
83 |
if ( file_exists( STYLESHEETPATH . $template_name ) ) {
|
84 |
$file = STYLESHEETPATH . $template_name;
|
85 |
} elseif ( file_exists( TEMPLATEPATH . $template_name ) ) {
|
86 |
$file = TEMPLATEPATH . $template_name;
|
87 |
} else {
|
88 |
$file = RT_THE_POST_GRID_PLUGIN_PATH . '/templates/elementor/' . $layout . '.php';
|
89 |
+
|
90 |
if ( ! file_exists( $file ) ) {
|
91 |
if ( rtTPG()->hasPro() ) {
|
92 |
$file = RT_THE_POST_GRID_PRO_PLUGIN_PATH . '/templates/elementor/' . $layout . '.php';
|
98 |
}
|
99 |
}
|
100 |
|
|
|
101 |
ob_start();
|
102 |
include $file;
|
103 |
echo ob_get_clean();
|
107 |
$layout = str_replace( '-2', '', $data['layout'] );
|
108 |
$template_name = '/the-post-grid/elementor/' . $layout . '.php';
|
109 |
$path = RT_THE_POST_GRID_PLUGIN_PATH . '/templates/elementor/';
|
110 |
+
|
111 |
if ( file_exists( STYLESHEETPATH . $template_name ) ) {
|
112 |
$path = STYLESHEETPATH . '/the-post-grid/elementor/';
|
113 |
} elseif ( file_exists( TEMPLATEPATH . $template_name ) ) {
|
129 |
* Get last post id
|
130 |
*
|
131 |
* @param string $post_type
|
132 |
+
* @param false $all_content
|
133 |
*
|
134 |
* @return int
|
135 |
*/
|
|
|
136 |
public function get_last_post_id( $post_type = 'post' ): int {
|
137 |
if ( is_singular( $post_type ) ) {
|
138 |
return get_the_ID();
|
163 |
if ( is_archive() ) {
|
164 |
return;
|
165 |
}
|
166 |
+
|
167 |
+
$categories = get_terms(
|
168 |
+
[
|
169 |
+
'taxonomy' => 'category',
|
170 |
+
'hide_empty' => false,
|
171 |
+
'number' => 1,
|
172 |
+
]
|
173 |
+
);
|
174 |
+
|
175 |
if ( ! empty( $categories ) && ! is_wp_error( $categories ) ) {
|
176 |
return $categories[0]->term_id;
|
177 |
}
|
178 |
}
|
179 |
|
180 |
+
// post category list.
|
181 |
+
public function tpg_category_list() {
|
182 |
$categories = get_categories( [ 'hide_empty' => false ] );
|
183 |
$lists = [];
|
184 |
foreach ( $categories as $category ) {
|
188 |
return $lists;
|
189 |
}
|
190 |
|
191 |
+
// post tags lists.
|
192 |
+
public function tpg_tag_list() {
|
193 |
$tags = get_tags( [ 'hide_empty' => false ] );
|
194 |
$tag_list = [];
|
195 |
foreach ( $tags as $tag ) {
|
199 |
return $tag_list;
|
200 |
}
|
201 |
|
202 |
+
// Get Custom post category:.
|
203 |
protected function tpg_get_categories_by_slug( $cat ) {
|
204 |
+
$terms = get_terms(
|
205 |
+
[
|
206 |
+
'taxonomy' => $cat,
|
207 |
+
'hide_empty' => true,
|
208 |
+
]
|
209 |
+
);
|
210 |
+
$options = [ '0' => esc_html__( 'All Categories', 'the-post-grid' ) ];
|
211 |
+
|
212 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
|
213 |
foreach ( $terms as $term ) {
|
214 |
$options[ $term->slug ] = $term->name;
|
218 |
}
|
219 |
}
|
220 |
|
221 |
+
// Get Custom post category.
|
222 |
public function tpg_get_categories_by_id( $cat ) {
|
223 |
+
$terms = get_terms(
|
224 |
+
[
|
225 |
+
'taxonomy' => $cat,
|
226 |
+
'hide_empty' => true,
|
227 |
+
]
|
228 |
+
);
|
229 |
|
230 |
$options = [];
|
231 |
+
|
232 |
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
|
233 |
foreach ( $terms as $term ) {
|
234 |
$options[ $term->term_id ] = $term->name;
|
242 |
public function get_all_post_type() {
|
243 |
$post_types = get_post_types( [], 'objects' );
|
244 |
$pt_list = [];
|
245 |
+
|
246 |
foreach ( $post_types as $type ) {
|
247 |
if ( isset( $type->rewrite->slug ) ) {
|
248 |
$pt_list[ $type->rewrite->slug ] = $type->rewrite->name;
|
253 |
}
|
254 |
|
255 |
public static function get_post_types() {
|
256 |
+
$post_types = get_post_types(
|
257 |
+
[
|
258 |
+
'public' => true,
|
259 |
+
'show_in_nav_menus' => true,
|
260 |
+
],
|
261 |
+
'objects'
|
262 |
+
);
|
263 |
$post_types = wp_list_pluck( $post_types, 'label', 'name' );
|
264 |
|
265 |
return array_diff_key( $post_types, [ 'elementor_library', 'attachment' ] );
|
293 |
*/
|
294 |
public function get_frontend_filter_markup( $data ) {
|
295 |
if ( ! rtTPG()->hasPro()
|
296 |
+
|| ! ( $data['show_taxonomy_filter'] == 'show' || $data['show_author_filter'] == 'show' || $data['show_order_by'] == 'show'
|
297 |
+
|| $data['show_sort_order'] == 'show'
|
298 |
+
|| $data['show_search'] == 'show' )
|
299 |
) {
|
300 |
return;
|
301 |
}
|
304 |
$wrapperContainer = $wrapperClass = $itemClass = $filter_btn_item_per_page = '';
|
305 |
|
306 |
if ( 'carousel' === $data['filter_btn_style'] ) {
|
307 |
+
$wrapperContainer = 'swiper';
|
308 |
+
$wrapperClass = 'swiper-wrapper';
|
309 |
+
$itemClass = 'swiper-slide';
|
310 |
+
$filter_btn_mobile = isset( $data['filter_btn_item_per_page_mobile'] ) ? $data['filter_btn_item_per_page_mobile'] : 'auto';
|
311 |
+
$filter_btn_tablet = isset( $data['filter_btn_item_per_page_tablet'] ) ? $data['filter_btn_item_per_page_tablet'] : 'auto';
|
312 |
+
$filter_btn_item_per_page = "data-per-page = '{$data['filter_btn_item_per_page']}' data-per-page-mobile = '{$filter_btn_mobile}' data-per-tablet = '{$filter_btn_tablet}'";
|
|
|
313 |
}
|
314 |
|
315 |
$html .= "<div class='rt-layout-filter-container rt-clear'><div class='rt-filter-wrap'>";
|
317 |
if ( 'show' == $data['show_author_filter'] || 'show' == $data['show_taxonomy_filter'] ) {
|
318 |
$html .= "<div class='filter-left-wrapper {$wrapperContainer}' {$filter_btn_item_per_page}>";
|
319 |
}
|
320 |
+
|
|
|
|
|
321 |
$selectedSubTermsForButton = null;
|
322 |
|
323 |
$filterType = $data['filter_type'];
|
324 |
$post_count = ( 'yes' == $data['filter_post_count'] ) ? true : false;
|
325 |
|
|
|
326 |
if ( 'show' == $data['show_taxonomy_filter'] ) {
|
327 |
+
$postCountClass = ( $post_count ? ' has-post-count' : null );
|
328 |
+
$allSelect = ' selected';
|
329 |
$isTermSelected = false;
|
330 |
|
331 |
$taxFilterOperator = $data['relation'];
|
334 |
$taxFilter = $data[ $section_term_key ];
|
335 |
|
336 |
$taxonomy_label = '';
|
337 |
+
|
338 |
if ( $taxFilter ) {
|
339 |
$taxonomy_details = get_taxonomy( $taxFilter );
|
340 |
$taxonomy_label = $taxonomy_details->label;
|
341 |
}
|
342 |
|
|
|
343 |
$default_term_key = $taxFilter . '_default_terms';
|
344 |
$default_term = $data[ $default_term_key ];
|
345 |
|
346 |
+
$allText = $data['tax_filter_all_text'] ? $data['tax_filter_all_text'] : esc_html__( 'All ', 'the-post-grid' ) . $taxonomy_label;
|
|
|
347 |
|
348 |
$_taxonomies = get_object_taxonomies( $data['post_type'], 'objects' );
|
349 |
$terms = [];
|
350 |
+
|
351 |
foreach ( $_taxonomies as $index => $object ) {
|
352 |
if ( $object->name != $taxFilter ) {
|
353 |
continue;
|
354 |
}
|
355 |
+
|
356 |
$setting_key = $object->name . '_ids';
|
357 |
+
|
358 |
if ( ! empty( $data[ $setting_key ] ) ) {
|
359 |
$terms = $data[ $setting_key ];
|
360 |
} else {
|
361 |
+
$terms = get_terms(
|
362 |
+
[
|
363 |
+
'taxonomy' => $taxFilter,
|
364 |
+
'fields' => 'ids',
|
365 |
+
]
|
366 |
+
);
|
367 |
}
|
368 |
}
|
369 |
$taxFilterTerms = $terms;
|
370 |
|
|
|
371 |
if ( $default_term && $taxFilter ) {
|
372 |
$isTermSelected = true;
|
373 |
$allSelect = null;
|
374 |
}
|
375 |
+
|
376 |
if ( $filterType == 'dropdown' ) {
|
377 |
+
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-taxonomy='{$taxFilter}' data-filter='taxonomy'>";
|
378 |
$termDefaultText = $allText;
|
379 |
$dataTerm = 'all';
|
380 |
+
$htmlButton = '';
|
381 |
$selectedSubTerms = null;
|
382 |
$pCount = 0;
|
383 |
|
|
|
384 |
if ( ! empty( $terms ) ) {
|
385 |
$i = 0;
|
386 |
+
|
387 |
foreach ( $terms as $term_id ) {
|
388 |
$term = get_term( $term_id, $taxFilter, ARRAY_A );
|
389 |
$id = $term['term_id'];
|
390 |
$pCount = $pCount + $term['count'];
|
391 |
$sT = null;
|
392 |
+
|
393 |
if ( $data['tgp_filter_taxonomy_hierarchical'] == 'yes' ) {
|
394 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
395 |
+
|
396 |
if ( ! empty( $subTerms ) ) {
|
397 |
$count = 0;
|
398 |
$item = $allCount = null;
|
399 |
+
|
400 |
foreach ( $subTerms as $stId => $t ) {
|
401 |
$count = $count + absint( $t['count'] );
|
402 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
403 |
+
$item .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$stId}'><span class='rt-text'>{$t['name']}{$sTPostCount}</span></span>";
|
404 |
}
|
405 |
+
|
406 |
if ( $post_count ) {
|
407 |
$allCount = " (<span class='rt-post-count'>{$count}</span>)";
|
408 |
}
|
409 |
+
|
410 |
$sT .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-dropdown-wrap sub-dropdown-wrap{$postCountClass}'>";
|
411 |
$sT .= "<span class='term-default rt-filter-dropdown-default' data-term='{$id}'>
|
412 |
+
<span class='rt-text'>" . $allText . "</span>
|
413 |
+
<i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
|
414 |
+
</span>";
|
415 |
$sT .= '<span class="term-dropdown rt-filter-dropdown">';
|
416 |
$sT .= $item;
|
417 |
$sT .= '</span>';
|
418 |
+
$sT .= '</div>';
|
419 |
}
|
420 |
+
|
421 |
if ( $default_term === $id ) {
|
422 |
$selectedSubTerms = $sT;
|
423 |
}
|
424 |
}
|
425 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
426 |
+
|
427 |
if ( $default_term && $default_term == $id ) {
|
428 |
$termDefaultText = $term['name'] . $postCount;
|
429 |
$dataTerm = $id;
|
430 |
}
|
431 |
+
|
432 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
433 |
if ( in_array( $id, $taxFilterTerms ) ) {
|
434 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
436 |
} else {
|
437 |
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='{$id}'><span class='rt-text'>{$term['name']}{$postCount}</span>{$sT}</span>";
|
438 |
}
|
439 |
+
|
440 |
$i ++;
|
441 |
}
|
442 |
}
|
443 |
$pAllCount = null;
|
444 |
+
|
445 |
if ( $post_count ) {
|
446 |
$pAllCount = " (<span class='rt-post-count'>{$pCount}</span>)";
|
447 |
+
|
448 |
if ( ! $default_term ) {
|
449 |
$termDefaultText = $termDefaultText;
|
450 |
}
|
451 |
}
|
452 |
|
453 |
if ( 'yes' == $data['tpg_hide_all_button'] ) {
|
454 |
+
$htmlButton = "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'><span class='rt-text'>" . $allText . '</span></span>' . $htmlButton;
|
|
|
455 |
}
|
456 |
+
|
457 |
$htmlButton = sprintf( '<span class="term-dropdown rt-filter-dropdown">%s</span>', $htmlButton );
|
458 |
|
459 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataTerm . '">
|
460 |
+
<span class="rt-text">' . $termDefaultText . '</span>
|
461 |
+
<i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
|
462 |
+
</span>';
|
463 |
|
464 |
$html .= $showAllhtml . $htmlButton;
|
465 |
$html .= '</div>' . $selectedSubTerms;
|
466 |
} else {
|
467 |
+
// if Button the execute.
|
468 |
+
// $termDefaultText = $allText;
|
469 |
|
470 |
$bCount = 0;
|
471 |
$bItems = null;
|
472 |
+
|
473 |
if ( ! empty( $terms ) ) {
|
474 |
foreach ( $terms as $term_id ) {
|
475 |
+
$term = get_term( $term_id, $taxFilter, ARRAY_A );
|
|
|
476 |
$id = $term['term_id'];
|
477 |
$bCount = $bCount + absint( $term['count'] );
|
478 |
$sT = null;
|
479 |
+
|
480 |
if ( $data['tgp_filter_taxonomy_hierarchical'] == 'yes' && $data['filter_btn_style'] === 'default' && $data['filter_type'] == 'button' ) {
|
481 |
$subTerms = Fns::rt_get_all_term_by_taxonomy( $taxFilter, true, $id );
|
482 |
+
|
483 |
if ( ! empty( $subTerms ) ) {
|
484 |
$sT .= "<div class='rt-filter-sub-tax sub-button-group '>";
|
485 |
+
|
486 |
foreach ( $subTerms as $stId => $t ) {
|
487 |
$sTPostCount = ( $post_count ? " (<span class='rt-post-count'>{$t['count']}</span>)" : null );
|
488 |
+
$sT .= "<span class='term-button-item rt-filter-button-item ' data-term='{$stId}'>{$t['name']}{$sTPostCount}</span>";
|
489 |
}
|
490 |
+
|
491 |
+
$sT .= '</div>';
|
492 |
+
|
493 |
if ( $default_term === $id ) {
|
494 |
$selectedSubTermsForButton = $sT;
|
495 |
}
|
497 |
}
|
498 |
$postCount = ( $post_count ? " (<span class='rt-post-count'>{$term['count']}</span>)" : null );
|
499 |
$termSelected = null;
|
500 |
+
|
501 |
if ( $isTermSelected && $id == $default_term ) {
|
502 |
+
$termSelected = ' selected';
|
503 |
}
|
504 |
+
|
505 |
if ( is_array( $taxFilterTerms ) && ! empty( $taxFilterTerms ) ) {
|
506 |
if ( in_array( $id, $taxFilterTerms ) ) {
|
507 |
$bItems .= "<span class='term-button-item rt-filter-button-item {$termSelected} {$itemClass}' data-term='{$id}'>{$term['name']}{$postCount}{$sT}</span>";
|
513 |
}
|
514 |
$html .= "<div class='rt-filter-item-wrap rt-tax-filter rt-filter-button-wrap{$postCountClass} {$wrapperClass}' data-taxonomy='{$taxFilter}' data-filter='taxonomy'>";
|
515 |
|
|
|
516 |
if ( 'yes' == $data['tpg_hide_all_button'] ) {
|
517 |
+
$html .= "<span class='term-button-item rt-filter-button-item {$allSelect} {$itemClass}' data-term='all'>" . $allText . '</span>';
|
518 |
}
|
519 |
|
520 |
$html .= $bItems;
|
521 |
|
522 |
+
$html .= '</div>';
|
523 |
+
|
524 |
if ( 'carousel' === $data['filter_btn_style'] ) {
|
525 |
$html .= '<div class="swiper-navigation"><div class="swiper-button-prev slider-btn"></div><div class="swiper-button-next slider-btn"></div></div>';
|
526 |
}
|
527 |
}
|
528 |
}
|
529 |
|
530 |
+
// TODO: Author filter.
|
531 |
if ( 'show' == $data['show_author_filter'] ) {
|
532 |
$user_el = $data['author'];
|
533 |
|
538 |
} else {
|
539 |
$users = get_users( apply_filters( 'tpg_author_arg', [] ) );
|
540 |
}
|
541 |
+
|
542 |
+
$allText = $allText = $data['author_filter_all_text'] ? $data['author_filter_all_text'] : esc_html__( 'All Users', 'the-post-grid' );
|
543 |
+
$allSelect = ' selected';
|
|
|
544 |
$isTermSelected = true;
|
545 |
+
|
|
|
546 |
if ( $filterType == 'dropdown' ) {
|
547 |
+
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-dropdown-wrap parent-dropdown-wrap{$postCountClass}' data-filter='author'>";
|
548 |
$termDefaultText = $allText;
|
549 |
$dataAuthor = 'all';
|
550 |
+
$htmlButton = '';
|
551 |
+
$htmlButton .= '<span class="author-dropdown rt-filter-dropdown">';
|
552 |
+
$htmlButton .= "<span class='term-dropdown-item rt-filter-dropdown-item' data-term='all'>" . $allText . '</span>';
|
553 |
|
554 |
if ( ! empty( $users ) ) {
|
555 |
foreach ( $users as $user ) {
|
556 |
$user_post_count = false;
|
557 |
+
$post_count ? '(' . count_user_posts( $user->ID, $data['post_type'] ) . ')' : null;
|
558 |
+
|
559 |
if ( is_array( $filterAuthors ) && ! empty( $filterAuthors ) ) {
|
560 |
if ( in_array( $user->ID, $filterAuthors ) ) {
|
561 |
if ( $default_term == $user->ID ) {
|
576 |
}
|
577 |
}
|
578 |
|
|
|
579 |
$htmlButton .= '</span>';
|
580 |
|
581 |
$showAllhtml = '<span class="term-default rt-filter-dropdown-default" data-term="' . $dataAuthor . '">
|
582 |
+
<span class="rt-text">' . $termDefaultText . '</span>
|
583 |
+
<i class="fa fa-angle-down rt-arrow-angle" aria-hidden="true"></i>
|
584 |
+
</span>';
|
585 |
|
586 |
$html .= $showAllhtml . $htmlButton;
|
587 |
$html .= '</div>';
|
602 |
}
|
603 |
|
604 |
$html .= "<div class='rt-filter-item-wrap rt-author-filter rt-filter-button-wrap{$postCountClass}' data-filter='author'>";
|
605 |
+
$html .= "<span class='author-button-item rt-filter-button-item {$allSelect}' data-author='all'>" . $allText . '</span>';
|
|
|
|
|
|
|
606 |
$html .= $bItems;
|
607 |
+
$html .= '</div>';
|
608 |
}
|
609 |
}
|
610 |
|
|
|
611 |
if ( 'show' == $data['show_author_filter'] || 'show' == $data['show_taxonomy_filter'] ) {
|
612 |
+
$html .= '</div>';
|
613 |
}
|
614 |
|
|
|
615 |
if ( 'show' == $data['show_order_by'] || 'show' == $data['show_sort_order'] || 'show' == $data['show_search'] ) {
|
616 |
$html .= "<div class='filter-right-wrapper'>";
|
617 |
}
|
618 |
|
619 |
+
// TODO: Order Filter.
|
|
|
620 |
if ( 'show' == $data['show_sort_order'] ) {
|
621 |
+
$action_order = ( $data['order'] ? strtoupper( $data['order'] ) : 'DESC' );
|
622 |
+
$html .= '<div class="rt-filter-item-wrap rt-sort-order-action" data-filter="order">';
|
623 |
+
$html .= "<span class='rt-sort-order-action-arrow' data-sort-order='{$action_order}'> <span></span></span>";
|
624 |
+
$html .= '</div>';
|
625 |
}
|
626 |
|
627 |
+
// TODO: Orderby Filter.
|
628 |
if ( 'show' == $data['show_order_by'] ) {
|
629 |
+
$wooFeature = ( $data['post_type'] == 'product' ? true : false );
|
630 |
$orders = Options::rtPostOrderBy( $wooFeature );
|
631 |
+
$action_orderby = ( ! empty( $data['orderby'] ) ? $data['orderby'] : 'none' );
|
632 |
+
|
633 |
if ( $action_orderby == 'none' ) {
|
634 |
+
$action_orderby_label = esc_html__( 'Sort By', 'the-post-grid' );
|
635 |
} elseif ( in_array( $action_orderby, array_keys( Options::rtMetaKeyType() ) ) ) {
|
636 |
+
$action_orderby_label = esc_html__( 'Meta value', 'the-post-grid' );
|
637 |
} else {
|
638 |
+
$action_orderby_label = esc_html__( 'By ', 'the-post-grid' ) . $action_orderby;
|
639 |
}
|
640 |
+
|
641 |
if ( $action_orderby !== 'none' ) {
|
642 |
+
$orders['none'] = esc_html__( 'Sort By', 'the-post-grid' );
|
643 |
}
|
644 |
+
|
645 |
$html .= '<div class="rt-filter-item-wrap rt-order-by-action rt-filter-dropdown-wrap" data-filter="orderby">';
|
646 |
$html .= "<span class='order-by-default rt-filter-dropdown-default' data-order-by='{$action_orderby}'>
|
647 |
+
<span class='rt-text-order-by'>{$action_orderby_label}</span>
|
648 |
+
<i class='fa fa-angle-down rt-arrow-angle' aria-hidden='true'></i>
|
649 |
+
</span>";
|
650 |
$html .= '<span class="order-by-dropdown rt-filter-dropdown">';
|
651 |
|
652 |
foreach ( $orders as $orderKey => $order ) {
|
653 |
$html .= '<span class="order-by-dropdown-item rt-filter-dropdown-item" data-order-by="' . $orderKey . '">' . $order . '</span>';
|
654 |
}
|
655 |
+
|
656 |
$html .= '</span>';
|
657 |
$html .= '</div>';
|
658 |
}
|
659 |
|
660 |
+
// TODO: Search Filter.
|
661 |
if ( 'show' == $data['show_search'] ) {
|
662 |
$html .= '<div class="rt-filter-item-wrap rt-search-filter-wrap" data-filter="search">';
|
663 |
+
$html .= sprintf( '<input type="text" class="rt-search-input" placeholder="%s">', esc_html__( 'Search...', 'the-post-grid' ) );
|
664 |
$html .= "<span class='rt-action'>🔍</span>";
|
665 |
$html .= "<span class='rt-loading'></span>";
|
666 |
$html .= '</div>';
|
667 |
}
|
668 |
|
669 |
if ( 'show' == $data['show_order_by'] || 'show' == $data['show_sort_order'] || 'show' == $data['show_search'] ) {
|
670 |
+
$html .= '</div>';
|
671 |
}
|
672 |
|
673 |
$html .= "</div>$selectedSubTermsForButton</div>";
|
693 |
$posts_loading_type = $data['pagination_type'];
|
694 |
$posts_per_page = ( isset( $data['display_per_page'] ) && $data['display_per_page'] ) ? $data['display_per_page']
|
695 |
: ( $data['post_limit'] ? $data['post_limit'] : get_option( 'posts_per_page' ) );
|
696 |
+
$hide = ( $query->max_num_pages < 2 ? ' rt-hidden-elm' : null );
|
697 |
|
698 |
+
if ( $posts_loading_type == 'pagination' ) {
|
699 |
$htmlUtility .= Fns::rt_pagination( $query, $posts_per_page );
|
700 |
+
} elseif ( rtTPG()->hasPro() && $posts_loading_type == 'pagination_ajax' ) { // && ! $isIsotope
|
701 |
$htmlUtility .= "<div class='rt-page-numbers'></div>";
|
702 |
+
} elseif ( rtTPG()->hasPro() && $posts_loading_type == 'load_more' ) {
|
703 |
+
$load_more_btn_text = $data['load_more_button_text'] ? esc_html( $data['load_more_button_text'] ) : esc_html__( 'Load More', 'the-post-grid' );
|
704 |
+
$htmlUtility .= "<div class='rt-loadmore-btn rt-loadmore-action rt-loadmore-style{$hide}'>
|
705 |
+
<span class='rt-loadmore-text'>" . $load_more_btn_text . "</span>
|
706 |
+
<div class='rt-loadmore-loading rt-ball-scale-multiple rt-2x'><div></div><div></div><div></div></div>
|
707 |
+
</div>";
|
708 |
+
} elseif ( rtTPG()->hasPro() && $posts_loading_type == 'load_on_scroll' ) {
|
709 |
+
$htmlUtility .= "<div class='rt-infinite-action'>
|
710 |
+
<div class='rt-infinite-loading la-fire la-2x'>
|
711 |
+
<div></div><div></div><div></div>
|
712 |
+
</div>
|
713 |
+
</div>";
|
714 |
}
|
715 |
|
|
|
716 |
if ( $htmlUtility ) {
|
717 |
+
$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}' >" . $htmlUtility . '</div>';
|
|
|
718 |
|
719 |
return $html;
|
720 |
}
|
725 |
/**
|
726 |
* Get Popup Modal Markup
|
727 |
*/
|
728 |
+
public function get_modal_markup() {
|
729 |
+
$html = null;
|
730 |
$html .= '<div class="md-modal rt-md-effect" id="rt-modal">
|
731 |
+
<div class="md-content">
|
732 |
+
<div class="rt-md-content-holder"></div>
|
733 |
+
<div class="md-cls-btn">
|
734 |
+
<button class="md-close"><i class="fa fa-times" aria-hidden="true"></i></button>
|
735 |
+
</div>
|
736 |
+
</div>
|
737 |
+
</div>';
|
738 |
$html .= "<div class='md-overlay'></div>";
|
739 |
+
|
740 |
+
Fns::print_html( $html );
|
741 |
}
|
742 |
|
743 |
/**
|
744 |
* Get Archive page title
|
745 |
*/
|
746 |
+
public function get_archive_title() {
|
747 |
$queried_obj = get_queried_object();
|
748 |
+
|
749 |
if ( is_tag() || is_category() ) {
|
750 |
echo esc_html( $queried_obj->name );
|
751 |
} elseif ( is_author() ) {
|
756 |
$day = get_query_var( 'day' );
|
757 |
$time_string = $year . '/' . $monthnum . '/' . $day;
|
758 |
$time_stamp = strtotime( $time_string );
|
759 |
+
Fns::print_html( date( get_option( 'date_format' ), $time_stamp ) );
|
760 |
}
|
761 |
}
|
762 |
|
765 |
*
|
766 |
* @param $data
|
767 |
*/
|
768 |
+
public function get_section_title( $data ) {
|
769 |
if ( 'show' != $data['show_section_title'] ) {
|
770 |
return;
|
771 |
}
|
772 |
|
773 |
$_is_link = false;
|
774 |
+
|
775 |
if ( ! empty( $data['section_title_link']['url'] ) ) {
|
776 |
$this->add_link_attributes( 'section_title_link', $data['section_title_link'] );
|
777 |
$_is_link = true;
|
778 |
}
|
779 |
|
|
|
780 |
$this->add_inline_editing_attributes( 'section_title_text', 'none' );
|
781 |
ob_start();
|
782 |
?>
|
783 |
|
784 |
+
<div class="tpg-widget-heading-wrapper rt-clear heading-<?php echo esc_attr( $data['section_title_style'] ); ?> ">
|
785 |
+
<span class="tpg-widget-heading-line line-left"></span>
|
786 |
|
787 |
+
<?php printf( "<%s class='tpg-widget-heading'>", esc_attr( $data['section_title_tag'] ) ); ?>
|
788 |
|
789 |
<?php
|
790 |
+
if ( $_is_link ) :
|
791 |
+
?>
|
792 |
+
<a <?php Fns::print_html( $this->get_render_attribute_string( 'section_title_link' ), true ); ?>>
|
793 |
<?php endif; ?>
|
794 |
|
795 |
<?php
|
797 |
$archive_prefix = $data['title_prefix'] ? $data['title_prefix'] . ' ' : null;
|
798 |
$archive_suffix = $data['title_suffix'] ? ' ' . $data['title_suffix'] : null;
|
799 |
printf( "<span class='prefix-text'>%s</span>", esc_html( $archive_prefix ) );
|
800 |
+
|
801 |
if ( is_archive() ) {
|
802 |
$this->get_archive_title();
|
803 |
} elseif ( is_search() ) {
|
805 |
} else {
|
806 |
the_title();
|
807 |
}
|
808 |
+
|
809 |
printf( "<span class='suffix-text'>%s</span>", esc_html( $archive_suffix ) );
|
810 |
} else {
|
811 |
?>
|
812 |
+
<span <?php $this->print_render_attribute_string( 'section_title_text' ); ?>>
|
813 |
+
<?php $this->print_unescaped_setting( 'section_title_text' ); ?>
|
814 |
+
</span>
|
815 |
<?php
|
816 |
}
|
817 |
?>
|
818 |
|
819 |
<?php if ( $_is_link ) : ?>
|
820 |
+
</a>
|
821 |
|
822 |
<?php endif; ?>
|
823 |
+
<?php printf( '</%s>', $data['section_title_tag'] ); ?>
|
824 |
+
<span class="tpg-widget-heading-line line-right"></span>
|
825 |
+
</div>
|
826 |
|
827 |
<?php if ( isset( $data['show_cat_desc'] ) && $data['show_cat_desc'] == 'yes' && category_description( $this->get_last_category_id() ) ) : ?>
|
828 |
+
<div class="tpg-category-description">
|
829 |
<?php echo category_description( $this->get_last_category_id() ); ?>
|
830 |
+
</div>
|
831 |
<?php endif; ?>
|
832 |
|
833 |
+
<?php
|
834 |
+
Fns::print_html( ob_get_clean() );
|
835 |
}
|
836 |
|
837 |
|
844 |
*
|
845 |
* @return array
|
846 |
*/
|
847 |
+
public function get_render_data_set( $data, $total_pages, $posts_per_page ) {
|
848 |
$_prefix = $this->prefix;
|
849 |
|
850 |
$data_set = [
|
930 |
|
931 |
return $data_set;
|
932 |
}
|
933 |
+
}
|
|
|
|
app/Widgets/elementor/rtTPGElementorHelper.php
CHANGED
@@ -1,23 +1,25 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
9 |
-
exit;
|
10 |
-
}
|
11 |
-
|
12 |
use Elementor\Controls_Manager;
|
13 |
use RT\ThePostGrid\Helpers\Fns;
|
14 |
use RT\ThePostGrid\Helpers\Options;
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
require_once( RT_THE_POST_GRID_PLUGIN_PATH . '/app/Widgets/elementor/rtTPGElementorQuery.php' );
|
17 |
|
|
|
|
|
|
|
18 |
class rtTPGElementorHelper {
|
19 |
-
|
20 |
-
|
21 |
/**
|
22 |
* Post Query Settings
|
23 |
*
|
@@ -53,7 +55,7 @@ class rtTPGElementorHelper {
|
|
53 |
$ref->add_control(
|
54 |
'common_filters_heading',
|
55 |
[
|
56 |
-
'label' =>
|
57 |
'type' => \Elementor\Controls_Manager::HEADING,
|
58 |
'separator' => 'before',
|
59 |
'classes' => 'tpg-control-type-heading',
|
@@ -63,48 +65,47 @@ class rtTPGElementorHelper {
|
|
63 |
$ref->add_control(
|
64 |
'post_id',
|
65 |
[
|
66 |
-
'label' =>
|
67 |
'type' => \Elementor\Controls_Manager::TEXT,
|
68 |
-
'description' =>
|
69 |
-
'placeholder' =>
|
70 |
]
|
71 |
);
|
72 |
|
73 |
$ref->add_control(
|
74 |
'exclude',
|
75 |
[
|
76 |
-
'label' =>
|
77 |
'type' => \Elementor\Controls_Manager::TEXT,
|
78 |
-
'description' =>
|
79 |
-
'placeholder' =>
|
80 |
]
|
81 |
);
|
82 |
|
83 |
$ref->add_control(
|
84 |
'post_limit',
|
85 |
[
|
86 |
-
'label' =>
|
87 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
88 |
-
'description' =>
|
89 |
]
|
90 |
);
|
91 |
|
92 |
$ref->add_control(
|
93 |
'offset',
|
94 |
[
|
95 |
-
'label' =>
|
96 |
'type' => \Elementor\Controls_Manager::TEXT,
|
97 |
-
'placeholder' =>
|
98 |
-
'description' =>
|
99 |
]
|
100 |
);
|
101 |
|
102 |
-
//TODO: Advance Filter
|
103 |
-
|
104 |
$ref->add_control(
|
105 |
'advanced_filters_heading',
|
106 |
[
|
107 |
-
'label' =>
|
108 |
'type' => \Elementor\Controls_Manager::HEADING,
|
109 |
'separator' => 'before',
|
110 |
'classes' => 'tpg-control-type-heading',
|
@@ -113,14 +114,14 @@ class rtTPGElementorHelper {
|
|
113 |
|
114 |
foreach ( $taxonomies as $taxonomy => $object ) {
|
115 |
if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) )
|
116 |
-
|
117 |
) {
|
118 |
continue;
|
119 |
}
|
120 |
$ref->add_control(
|
121 |
$taxonomy . '_ids',
|
122 |
[
|
123 |
-
'label' =>
|
124 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
125 |
'label_block' => true,
|
126 |
'multiple' => true,
|
@@ -135,13 +136,13 @@ class rtTPGElementorHelper {
|
|
135 |
$ref->add_control(
|
136 |
'relation',
|
137 |
[
|
138 |
-
'label' =>
|
139 |
'type' => \Elementor\Controls_Manager::SELECT,
|
140 |
'default' => 'OR',
|
141 |
'options' => [
|
142 |
-
'OR' =>
|
143 |
-
'AND' =>
|
144 |
-
'NOT IN' =>
|
145 |
],
|
146 |
]
|
147 |
);
|
@@ -149,7 +150,7 @@ class rtTPGElementorHelper {
|
|
149 |
$ref->add_control(
|
150 |
'author',
|
151 |
[
|
152 |
-
'label' =>
|
153 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
154 |
'multiple' => true,
|
155 |
'label_block' => true,
|
@@ -160,45 +161,46 @@ class rtTPGElementorHelper {
|
|
160 |
$ref->add_control(
|
161 |
'post_keyword',
|
162 |
[
|
163 |
-
'label' =>
|
164 |
'type' => \Elementor\Controls_Manager::TEXT,
|
165 |
'label_block' => true,
|
166 |
-
'placeholder' =>
|
167 |
-
'description' =>
|
168 |
]
|
169 |
);
|
170 |
|
171 |
$ref->add_control(
|
172 |
'date_range',
|
173 |
[
|
174 |
-
'label' =>
|
175 |
'type' => \Elementor\Controls_Manager::DATE_TIME,
|
176 |
-
'placeholder' =>
|
177 |
-
'description' =>
|
178 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
179 |
'picker_options' => [
|
180 |
'enableTime' => false,
|
181 |
-
'mode' =>
|
182 |
-
'dateFormat' =>
|
183 |
],
|
184 |
]
|
185 |
);
|
186 |
|
187 |
|
188 |
$orderby_opt = [
|
189 |
-
'date' =>
|
190 |
-
'ID' =>
|
191 |
-
'author' =>
|
192 |
-
'title' =>
|
193 |
-
'modified' =>
|
194 |
-
'parent' =>
|
195 |
-
'comment_count' =>
|
196 |
-
'menu_order' =>
|
197 |
|
198 |
];
|
|
|
199 |
if ( rtTPG()->hasPro() ) {
|
200 |
$prderby_pro_opt = [
|
201 |
-
'rand' =>
|
202 |
];
|
203 |
$orderby_opt = array_merge( $orderby_opt, $prderby_pro_opt );
|
204 |
}
|
@@ -206,7 +208,7 @@ class rtTPGElementorHelper {
|
|
206 |
$ref->add_control(
|
207 |
'orderby',
|
208 |
[
|
209 |
-
'label' =>
|
210 |
'type' => \Elementor\Controls_Manager::SELECT,
|
211 |
'options' => $orderby_opt,
|
212 |
'default' => 'date',
|
@@ -217,11 +219,11 @@ class rtTPGElementorHelper {
|
|
217 |
$ref->add_control(
|
218 |
'order',
|
219 |
[
|
220 |
-
'label' =>
|
221 |
'type' => \Elementor\Controls_Manager::SELECT,
|
222 |
'options' => [
|
223 |
-
'ASC' =>
|
224 |
-
'DESC' =>
|
225 |
],
|
226 |
'default' => 'DESC',
|
227 |
'condition' => [
|
@@ -244,10 +246,10 @@ class rtTPGElementorHelper {
|
|
244 |
$ref->add_control(
|
245 |
'ignore_sticky_posts',
|
246 |
[
|
247 |
-
'label' =>
|
248 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
249 |
-
'label_on' =>
|
250 |
-
'label_off' =>
|
251 |
'return_value' => 'yes',
|
252 |
'default' => 'no',
|
253 |
'disabled' => true,
|
@@ -258,10 +260,10 @@ class rtTPGElementorHelper {
|
|
258 |
$ref->add_control(
|
259 |
'no_posts_found_text',
|
260 |
[
|
261 |
-
'label' =>
|
262 |
'type' => \Elementor\Controls_Manager::TEXT,
|
263 |
-
'default' =>
|
264 |
-
'placeholder' =>
|
265 |
'separator' => 'before',
|
266 |
]
|
267 |
);
|
@@ -294,9 +296,9 @@ class rtTPGElementorHelper {
|
|
294 |
$ref->add_control(
|
295 |
'post_limit',
|
296 |
[
|
297 |
-
'label' =>
|
298 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
299 |
-
'description' =>
|
300 |
]
|
301 |
);
|
302 |
|
@@ -305,7 +307,7 @@ class rtTPGElementorHelper {
|
|
305 |
$get_all_taxonomy = [];
|
306 |
foreach ( $taxonomies as $taxonomy => $object ) {
|
307 |
if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) )
|
308 |
-
|
309 |
) {
|
310 |
continue;
|
311 |
}
|
@@ -315,7 +317,7 @@ class rtTPGElementorHelper {
|
|
315 |
$ref->add_control(
|
316 |
'taxonomy_lists',
|
317 |
[
|
318 |
-
'label' =>
|
319 |
'type' => \Elementor\Controls_Manager::SELECT,
|
320 |
'default' => 'category',
|
321 |
'options' => $get_all_taxonomy,
|
@@ -323,22 +325,22 @@ class rtTPGElementorHelper {
|
|
323 |
);
|
324 |
|
325 |
$orderby_opt = [
|
326 |
-
'date' =>
|
327 |
-
'ID' =>
|
328 |
-
'author' =>
|
329 |
-
'title' =>
|
330 |
-
'modified' =>
|
331 |
-
'parent' =>
|
332 |
-
'comment_count' =>
|
333 |
-
'menu_order' =>
|
334 |
-
'rand' =>
|
335 |
|
336 |
];
|
337 |
|
338 |
$ref->add_control(
|
339 |
'orderby',
|
340 |
[
|
341 |
-
'label' =>
|
342 |
'type' => \Elementor\Controls_Manager::SELECT,
|
343 |
'options' => $orderby_opt,
|
344 |
'default' => 'date',
|
@@ -348,11 +350,11 @@ class rtTPGElementorHelper {
|
|
348 |
$ref->add_control(
|
349 |
'order',
|
350 |
[
|
351 |
-
'label' =>
|
352 |
'type' => \Elementor\Controls_Manager::SELECT,
|
353 |
'options' => [
|
354 |
-
'ASC' =>
|
355 |
-
'DESC' =>
|
356 |
],
|
357 |
'default' => 'DESC',
|
358 |
'condition' => [
|
@@ -364,40 +366,40 @@ class rtTPGElementorHelper {
|
|
364 |
$ref->add_control(
|
365 |
'post_id',
|
366 |
[
|
367 |
-
'label' =>
|
368 |
'type' => \Elementor\Controls_Manager::TEXT,
|
369 |
-
'description' =>
|
370 |
-
'placeholder' =>
|
371 |
]
|
372 |
);
|
373 |
|
374 |
$ref->add_control(
|
375 |
'exclude',
|
376 |
[
|
377 |
-
'label' =>
|
378 |
'type' => \Elementor\Controls_Manager::TEXT,
|
379 |
-
'description' =>
|
380 |
-
'placeholder' =>
|
381 |
]
|
382 |
);
|
383 |
|
384 |
$ref->add_control(
|
385 |
'offset',
|
386 |
[
|
387 |
-
'label' =>
|
388 |
'type' => \Elementor\Controls_Manager::TEXT,
|
389 |
-
'placeholder' =>
|
390 |
-
'description' =>
|
391 |
]
|
392 |
);
|
393 |
|
394 |
$ref->add_control(
|
395 |
'no_posts_found_text_archive',
|
396 |
[
|
397 |
-
'label' =>
|
398 |
'type' => \Elementor\Controls_Manager::TEXT,
|
399 |
-
'default' =>
|
400 |
-
'placeholder' =>
|
401 |
'separator' => 'before',
|
402 |
]
|
403 |
);
|
@@ -416,7 +418,7 @@ class rtTPGElementorHelper {
|
|
416 |
$ref->start_controls_section(
|
417 |
$prefix . '_layout_settings',
|
418 |
[
|
419 |
-
'label' =>
|
420 |
'tab' => Controls_Manager::TAB_CONTENT,
|
421 |
]
|
422 |
);
|
@@ -425,31 +427,31 @@ class rtTPGElementorHelper {
|
|
425 |
$layout_class = 'grid-layout';
|
426 |
$layout_options = [
|
427 |
$prefix . '-layout1' => [
|
428 |
-
'title' =>
|
429 |
],
|
430 |
$prefix . '-layout3' => [
|
431 |
-
'title' =>
|
432 |
],
|
433 |
$prefix . '-layout4' => [
|
434 |
-
'title' =>
|
435 |
],
|
436 |
$prefix . '-layout2' => [
|
437 |
-
'title' =>
|
438 |
],
|
439 |
$prefix . '-layout5' => [
|
440 |
-
'title' =>
|
441 |
],
|
442 |
$prefix . '-layout5-2' => [
|
443 |
-
'title' =>
|
444 |
],
|
445 |
$prefix . '-layout6' => [
|
446 |
-
'title' =>
|
447 |
],
|
448 |
$prefix . '-layout6-2' => [
|
449 |
-
'title' =>
|
450 |
],
|
451 |
$prefix . '-layout7' => [
|
452 |
-
'title' =>
|
453 |
],
|
454 |
];
|
455 |
}
|
@@ -458,52 +460,52 @@ class rtTPGElementorHelper {
|
|
458 |
$layout_class = 'grid-hover-layout';
|
459 |
$layout_options = [
|
460 |
$prefix . '-layout1' => [
|
461 |
-
'title' =>
|
462 |
],
|
463 |
$prefix . '-layout2' => [
|
464 |
-
'title' =>
|
465 |
],
|
466 |
$prefix . '-layout3' => [
|
467 |
-
'title' =>
|
468 |
],
|
469 |
$prefix . '-layout4' => [
|
470 |
-
'title' =>
|
471 |
],
|
472 |
$prefix . '-layout4-2' => [
|
473 |
-
'title' =>
|
474 |
],
|
475 |
$prefix . '-layout5' => [
|
476 |
-
'title' =>
|
477 |
],
|
478 |
$prefix . '-layout5-2' => [
|
479 |
-
'title' =>
|
480 |
],
|
481 |
$prefix . '-layout6' => [
|
482 |
-
'title' =>
|
483 |
],
|
484 |
$prefix . '-layout6-2' => [
|
485 |
-
'title' =>
|
486 |
],
|
487 |
$prefix . '-layout7' => [
|
488 |
-
'title' =>
|
489 |
],
|
490 |
$prefix . '-layout7-2' => [
|
491 |
-
'title' =>
|
492 |
],
|
493 |
$prefix . '-layout8' => [
|
494 |
-
'title' =>
|
495 |
],
|
496 |
$prefix . '-layout9' => [
|
497 |
-
'title' =>
|
498 |
],
|
499 |
$prefix . '-layout9-2' => [
|
500 |
-
'title' =>
|
501 |
],
|
502 |
$prefix . '-layout10' => [
|
503 |
-
'title' =>
|
504 |
],
|
505 |
$prefix . '-layout11' => [
|
506 |
-
'title' =>
|
507 |
],
|
508 |
];
|
509 |
}
|
@@ -512,43 +514,43 @@ class rtTPGElementorHelper {
|
|
512 |
$layout_class = 'slider-layout';
|
513 |
$layout_options = [
|
514 |
$prefix . '-layout1' => [
|
515 |
-
'title' =>
|
516 |
],
|
517 |
$prefix . '-layout2' => [
|
518 |
-
'title' =>
|
519 |
],
|
520 |
$prefix . '-layout3' => [
|
521 |
-
'title' =>
|
522 |
],
|
523 |
$prefix . '-layout4' => [
|
524 |
-
'title' =>
|
525 |
],
|
526 |
$prefix . '-layout5' => [
|
527 |
-
'title' =>
|
528 |
],
|
529 |
$prefix . '-layout6' => [
|
530 |
-
'title' =>
|
531 |
],
|
532 |
$prefix . '-layout7' => [
|
533 |
-
'title' =>
|
534 |
],
|
535 |
$prefix . '-layout8' => [
|
536 |
-
'title' =>
|
537 |
],
|
538 |
$prefix . '-layout9' => [
|
539 |
-
'title' =>
|
540 |
],
|
541 |
$prefix . '-layout10' => [
|
542 |
-
'title' =>
|
543 |
],
|
544 |
$prefix . '-layout11' => [
|
545 |
-
'title' =>
|
546 |
],
|
547 |
$prefix . '-layout12' => [
|
548 |
-
'title' =>
|
549 |
],
|
550 |
$prefix . '-layout13' => [
|
551 |
-
'title' =>
|
552 |
],
|
553 |
];
|
554 |
|
@@ -560,7 +562,7 @@ class rtTPGElementorHelper {
|
|
560 |
$ref->add_control(
|
561 |
$prefix . '_layout',
|
562 |
[
|
563 |
-
'label' =>
|
564 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
565 |
'label_block' => true,
|
566 |
'options' => $layout_options,
|
@@ -574,7 +576,7 @@ class rtTPGElementorHelper {
|
|
574 |
$ref->add_control(
|
575 |
'layout_options_heading',
|
576 |
[
|
577 |
-
'label' =>
|
578 |
'type' => \Elementor\Controls_Manager::HEADING,
|
579 |
'classes' => 'tpg-control-type-heading',
|
580 |
]
|
@@ -582,11 +584,11 @@ class rtTPGElementorHelper {
|
|
582 |
|
583 |
|
584 |
$column_options = [
|
585 |
-
'0' =>
|
586 |
-
'12' =>
|
587 |
-
'6' =>
|
588 |
-
'4' =>
|
589 |
-
'3' =>
|
590 |
];
|
591 |
|
592 |
if ( 'grid' === $prefix ) {
|
@@ -603,13 +605,13 @@ class rtTPGElementorHelper {
|
|
603 |
|
604 |
if ( 'slider' === $prefix ) {
|
605 |
$column_options = [
|
606 |
-
'0' =>
|
607 |
-
'1' =>
|
608 |
-
'2' =>
|
609 |
-
'3' =>
|
610 |
-
'4' =>
|
611 |
-
'5' =>
|
612 |
-
'6' =>
|
613 |
];
|
614 |
$grid_column_condition = [
|
615 |
'slider_layout!' => [ 'slider-layout10', 'slider-layout11', 'slider-layout13' ],
|
@@ -625,7 +627,7 @@ class rtTPGElementorHelper {
|
|
625 |
'default' => '0',
|
626 |
'tablet_default' => '0',
|
627 |
'mobile_default' => '0',
|
628 |
-
'description' =>
|
629 |
'condition' => $grid_column_condition,
|
630 |
]
|
631 |
);
|
@@ -634,10 +636,10 @@ class rtTPGElementorHelper {
|
|
634 |
$ref->add_control(
|
635 |
'enable_related_slider',
|
636 |
[
|
637 |
-
'label' =>
|
638 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
639 |
-
'label_on' =>
|
640 |
-
'label_off' =>
|
641 |
'return_value' => 'yes',
|
642 |
'default' => 'yes',
|
643 |
]
|
@@ -646,7 +648,7 @@ class rtTPGElementorHelper {
|
|
646 |
$ref->add_responsive_control(
|
647 |
'slider_gap_2',
|
648 |
[
|
649 |
-
'label' =>
|
650 |
'type' => Controls_Manager::SLIDER,
|
651 |
'size_units' => [ 'px' ],
|
652 |
'range' => [
|
@@ -670,7 +672,7 @@ class rtTPGElementorHelper {
|
|
670 |
$ref->add_responsive_control(
|
671 |
$prefix . '_offset_col_width',
|
672 |
[
|
673 |
-
'label' =>
|
674 |
'type' => Controls_Manager::SLIDER,
|
675 |
'size_units' => [ '%' ],
|
676 |
'range' => [
|
@@ -713,12 +715,12 @@ class rtTPGElementorHelper {
|
|
713 |
|
714 |
if ( 'grid' === $prefix ) {
|
715 |
$layout_style_opt = [
|
716 |
-
'tpg-even' =>
|
717 |
-
'tpg-full-height' =>
|
718 |
];
|
719 |
if ( rtTPG()->hasPro() ) {
|
720 |
$layout_style_new_opt = [
|
721 |
-
'masonry' =>
|
722 |
];
|
723 |
$layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt );
|
724 |
}
|
@@ -726,11 +728,11 @@ class rtTPGElementorHelper {
|
|
726 |
$ref->add_control(
|
727 |
$prefix . '_layout_style',
|
728 |
[
|
729 |
-
'label' =>
|
730 |
'type' => \Elementor\Controls_Manager::SELECT,
|
731 |
'default' => 'tpg-full-height',
|
732 |
'options' => $layout_style_opt,
|
733 |
-
'description' =>
|
734 |
'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field',
|
735 |
'condition' => [
|
736 |
$prefix . '_layout!' => [ 'grid-layout2',
|
@@ -761,15 +763,15 @@ class rtTPGElementorHelper {
|
|
761 |
$ref->add_control(
|
762 |
$prefix . '_layout_alignment',
|
763 |
[
|
764 |
-
'label' =>
|
765 |
'type' => \Elementor\Controls_Manager::SELECT,
|
766 |
'options' => [
|
767 |
-
'' =>
|
768 |
-
'flex-start' =>
|
769 |
-
'center' =>
|
770 |
-
'flex-end' =>
|
771 |
-
'space-around' =>
|
772 |
-
'space-between' =>
|
773 |
],
|
774 |
'condition' => [
|
775 |
$prefix . '_layout!' => [
|
@@ -796,15 +798,15 @@ class rtTPGElementorHelper {
|
|
796 |
$ref->add_control(
|
797 |
$prefix . '_layout_alignment_2',
|
798 |
[
|
799 |
-
'label' =>
|
800 |
'type' => \Elementor\Controls_Manager::SELECT,
|
801 |
'options' => [
|
802 |
-
'' =>
|
803 |
-
'flex-start' =>
|
804 |
-
'center' =>
|
805 |
-
'flex-end' =>
|
806 |
-
'space-around' =>
|
807 |
-
'space-between' =>
|
808 |
],
|
809 |
'condition' => [
|
810 |
$prefix . '_layout!' => [ 'slider-layout1',
|
@@ -873,7 +875,7 @@ class rtTPGElementorHelper {
|
|
873 |
$ref->start_controls_section(
|
874 |
$prefix . '_filter_settings',
|
875 |
[
|
876 |
-
'label' =>
|
877 |
'tab' => Controls_Manager::TAB_CONTENT,
|
878 |
]
|
879 |
);
|
@@ -881,10 +883,10 @@ class rtTPGElementorHelper {
|
|
881 |
$ref->add_control(
|
882 |
'show_taxonomy_filter',
|
883 |
[
|
884 |
-
'label' =>
|
885 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
886 |
-
'label_on' =>
|
887 |
-
'label_off' =>
|
888 |
'return_value' => 'show',
|
889 |
'default' => 'hide',
|
890 |
]
|
@@ -893,10 +895,10 @@ class rtTPGElementorHelper {
|
|
893 |
$ref->add_control(
|
894 |
'show_author_filter',
|
895 |
[
|
896 |
-
'label' =>
|
897 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
898 |
-
'label_on' =>
|
899 |
-
'label_off' =>
|
900 |
'return_value' => 'show',
|
901 |
'default' => 'hide',
|
902 |
]
|
@@ -905,10 +907,10 @@ class rtTPGElementorHelper {
|
|
905 |
$ref->add_control(
|
906 |
'show_order_by',
|
907 |
[
|
908 |
-
'label' =>
|
909 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
910 |
-
'label_on' =>
|
911 |
-
'label_off' =>
|
912 |
'return_value' => 'show',
|
913 |
'default' => 'hide',
|
914 |
]
|
@@ -917,10 +919,10 @@ class rtTPGElementorHelper {
|
|
917 |
$ref->add_control(
|
918 |
'show_sort_order',
|
919 |
[
|
920 |
-
'label' =>
|
921 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
922 |
-
'label_on' =>
|
923 |
-
'label_off' =>
|
924 |
'return_value' => 'show',
|
925 |
'default' => 'hide',
|
926 |
]
|
@@ -929,10 +931,10 @@ class rtTPGElementorHelper {
|
|
929 |
$ref->add_control(
|
930 |
'show_search',
|
931 |
[
|
932 |
-
'label' =>
|
933 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
934 |
-
'label_on' =>
|
935 |
-
'label_off' =>
|
936 |
'return_value' => 'show',
|
937 |
'default' => 'hide',
|
938 |
]
|
@@ -976,12 +978,12 @@ class rtTPGElementorHelper {
|
|
976 |
$ref->add_control(
|
977 |
'filter_type',
|
978 |
[
|
979 |
-
'label' =>
|
980 |
'type' => \Elementor\Controls_Manager::SELECT,
|
981 |
'default' => 'dropdown',
|
982 |
'options' => [
|
983 |
-
'dropdown' =>
|
984 |
-
'button' =>
|
985 |
],
|
986 |
'render_type' => 'template',
|
987 |
'prefix_class' => 'tpg-filter-type-',
|
@@ -993,39 +995,39 @@ class rtTPGElementorHelper {
|
|
993 |
$ref->add_control(
|
994 |
'filter_btn_style',
|
995 |
[
|
996 |
-
'label' =>
|
997 |
'type' => \Elementor\Controls_Manager::SELECT,
|
998 |
'default' => 'default',
|
999 |
'options' => [
|
1000 |
-
'default' =>
|
1001 |
-
'carousel' =>
|
1002 |
],
|
1003 |
'condition' => [
|
1004 |
'filter_type' => 'button',
|
1005 |
],
|
1006 |
'conditions' => $front_end_filter_condition,
|
1007 |
-
'description' =>
|
1008 |
]
|
1009 |
);
|
1010 |
|
1011 |
$ref->add_responsive_control(
|
1012 |
'filter_btn_item_per_page',
|
1013 |
[
|
1014 |
-
'label' =>
|
1015 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1016 |
'options' => [
|
1017 |
-
'auto' =>
|
1018 |
-
'2' =>
|
1019 |
-
'3' =>
|
1020 |
-
'4' =>
|
1021 |
-
'5' =>
|
1022 |
-
'6' =>
|
1023 |
-
'7' =>
|
1024 |
-
'8' =>
|
1025 |
-
'9' =>
|
1026 |
-
'10' =>
|
1027 |
-
'11' =>
|
1028 |
-
'12' =>
|
1029 |
],
|
1030 |
'default' => 'auto',
|
1031 |
'tablet_default' => 'auto',
|
@@ -1035,7 +1037,7 @@ class rtTPGElementorHelper {
|
|
1035 |
'filter_btn_style' => 'carousel',
|
1036 |
],
|
1037 |
'conditions' => $front_end_filter_condition,
|
1038 |
-
'description' =>
|
1039 |
]
|
1040 |
);
|
1041 |
|
@@ -1085,7 +1087,7 @@ class rtTPGElementorHelper {
|
|
1085 |
$ref->add_control(
|
1086 |
$post_type . '_filter_taxonomy',
|
1087 |
[
|
1088 |
-
'label' =>
|
1089 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1090 |
'default' => $default_cat,
|
1091 |
'options' => $taxonomies_list,
|
@@ -1093,7 +1095,7 @@ class rtTPGElementorHelper {
|
|
1093 |
'post_type' => $post_type,
|
1094 |
'show_taxonomy_filter' => 'show',
|
1095 |
],
|
1096 |
-
'description' =>
|
1097 |
]
|
1098 |
);
|
1099 |
|
@@ -1106,7 +1108,7 @@ class rtTPGElementorHelper {
|
|
1106 |
continue;
|
1107 |
}
|
1108 |
|
1109 |
-
$term_first = [ '0' =>
|
1110 |
$term_lists = get_terms(
|
1111 |
[
|
1112 |
'taxonomy' => $tax->name, //Custom taxonomy name
|
@@ -1120,7 +1122,7 @@ class rtTPGElementorHelper {
|
|
1120 |
$ref->add_control(
|
1121 |
$tax->name . '_default_terms',
|
1122 |
[
|
1123 |
-
'label' =>
|
1124 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1125 |
'default' => '0',
|
1126 |
'options' => $term_lists,
|
@@ -1153,12 +1155,12 @@ class rtTPGElementorHelper {
|
|
1153 |
$ref->add_control(
|
1154 |
'filter_post_count',
|
1155 |
[
|
1156 |
-
'label' =>
|
1157 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1158 |
'default' => 'no',
|
1159 |
'options' => [
|
1160 |
-
'yes' =>
|
1161 |
-
'no' =>
|
1162 |
],
|
1163 |
'conditions' => $front_end_filter_tax_condition,
|
1164 |
]
|
@@ -1168,10 +1170,10 @@ class rtTPGElementorHelper {
|
|
1168 |
$ref->add_control(
|
1169 |
'tgp_filter_taxonomy_hierarchical',
|
1170 |
[
|
1171 |
-
'label' =>
|
1172 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1173 |
-
'label_on' =>
|
1174 |
-
'label_off' =>
|
1175 |
'return_value' => 'yes',
|
1176 |
'default' => 'yes',
|
1177 |
'conditions' => $front_end_filter_tax_condition,
|
@@ -1185,10 +1187,10 @@ class rtTPGElementorHelper {
|
|
1185 |
$ref->add_control(
|
1186 |
'tpg_hide_all_button',
|
1187 |
[
|
1188 |
-
'label' =>
|
1189 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1190 |
-
'label_on' =>
|
1191 |
-
'label_off' =>
|
1192 |
'return_value' => 'yes',
|
1193 |
'default' => 'yes',
|
1194 |
'conditions' => $front_end_filter_tax_condition,
|
@@ -1201,18 +1203,18 @@ class rtTPGElementorHelper {
|
|
1201 |
$ref->add_control(
|
1202 |
'tax_filter_all_text',
|
1203 |
[
|
1204 |
-
'label' =>
|
1205 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1206 |
-
'placeholder' =>
|
1207 |
'conditions' => $front_end_filter_tax_condition,
|
1208 |
]
|
1209 |
);
|
1210 |
$ref->add_control(
|
1211 |
'author_filter_all_text',
|
1212 |
[
|
1213 |
-
'label' =>
|
1214 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1215 |
-
'placeholder' =>
|
1216 |
'condition' => [
|
1217 |
'show_author_filter' => 'show',
|
1218 |
'filter_btn_style' => 'default',
|
@@ -1243,30 +1245,30 @@ class rtTPGElementorHelper {
|
|
1243 |
$ref->add_control(
|
1244 |
'list_layout',
|
1245 |
[
|
1246 |
-
'label' =>
|
1247 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
1248 |
'label_block' => true,
|
1249 |
'options' => [
|
1250 |
'list-layout1' => [
|
1251 |
-
'title' =>
|
1252 |
],
|
1253 |
'list-layout2' => [
|
1254 |
-
'title' =>
|
1255 |
],
|
1256 |
'list-layout2-2' => [
|
1257 |
-
'title' =>
|
1258 |
],
|
1259 |
'list-layout3' => [
|
1260 |
-
'title' =>
|
1261 |
],
|
1262 |
'list-layout3-2' => [
|
1263 |
-
'title' =>
|
1264 |
],
|
1265 |
'list-layout4' => [
|
1266 |
-
'title' =>
|
1267 |
],
|
1268 |
'list-layout5' => [
|
1269 |
-
'title' =>
|
1270 |
],
|
1271 |
],
|
1272 |
'toggle' => false,
|
@@ -1279,7 +1281,7 @@ class rtTPGElementorHelper {
|
|
1279 |
$ref->add_control(
|
1280 |
'layout_options_heading2',
|
1281 |
[
|
1282 |
-
'label' =>
|
1283 |
'type' => \Elementor\Controls_Manager::HEADING,
|
1284 |
'classes' => 'tpg-control-type-heading',
|
1285 |
]
|
@@ -1291,16 +1293,16 @@ class rtTPGElementorHelper {
|
|
1291 |
'label' => esc_html__( 'Column', 'the-post-grid' ),
|
1292 |
'type' => Controls_Manager::SELECT,
|
1293 |
'options' => [
|
1294 |
-
'0' =>
|
1295 |
-
'12' =>
|
1296 |
-
'6' =>
|
1297 |
-
'4' =>
|
1298 |
-
'3' =>
|
1299 |
],
|
1300 |
'default' => '0',
|
1301 |
'tablet_default' => '0',
|
1302 |
'mobile_default' => '0',
|
1303 |
-
'description' =>
|
1304 |
'condition' => [
|
1305 |
'list_layout!' => [ 'list-layout2', 'list-layout2-2', 'list-layout4' ],
|
1306 |
],
|
@@ -1311,15 +1313,15 @@ class rtTPGElementorHelper {
|
|
1311 |
$ref->add_responsive_control(
|
1312 |
'list_layout_alignment',
|
1313 |
[
|
1314 |
-
'label' =>
|
1315 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1316 |
'options' => [
|
1317 |
-
'' =>
|
1318 |
-
'flex-start' =>
|
1319 |
-
'center' =>
|
1320 |
-
'flex-end' =>
|
1321 |
-
'space-around' =>
|
1322 |
-
'space-between' =>
|
1323 |
],
|
1324 |
'selectors' => [
|
1325 |
'{{WRAPPER}} .tpg-el-main-wrapper .list-behaviour .rt-holder .rt-el-content-wrapper' => 'align-items: {{VALUE}};',
|
@@ -1333,7 +1335,7 @@ class rtTPGElementorHelper {
|
|
1333 |
$ref->add_responsive_control(
|
1334 |
'list_left_side_width',
|
1335 |
[
|
1336 |
-
'label' =>
|
1337 |
'type' => Controls_Manager::SLIDER,
|
1338 |
'size_units' => [ '%' ],
|
1339 |
'range' => [
|
@@ -1359,11 +1361,11 @@ class rtTPGElementorHelper {
|
|
1359 |
|
1360 |
|
1361 |
$layout_style_opt = [
|
1362 |
-
'tpg-even' =>
|
1363 |
];
|
1364 |
if ( rtTPG()->hasPro() ) {
|
1365 |
$layout_style_new_opt = [
|
1366 |
-
'masonry' =>
|
1367 |
];
|
1368 |
$layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt );
|
1369 |
}
|
@@ -1371,7 +1373,7 @@ class rtTPGElementorHelper {
|
|
1371 |
$ref->add_control(
|
1372 |
'list_layout_style',
|
1373 |
[
|
1374 |
-
'label' =>
|
1375 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1376 |
'default' => 'tpg-even',
|
1377 |
'options' => $layout_style_opt,
|
@@ -1424,7 +1426,7 @@ class rtTPGElementorHelper {
|
|
1424 |
$ref->start_controls_section(
|
1425 |
'pagination_settings',
|
1426 |
[
|
1427 |
-
'label' =>
|
1428 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
|
1429 |
]
|
1430 |
);
|
@@ -1432,10 +1434,10 @@ class rtTPGElementorHelper {
|
|
1432 |
$ref->add_control(
|
1433 |
'show_pagination',
|
1434 |
[
|
1435 |
-
'label' =>
|
1436 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1437 |
-
'label_on' =>
|
1438 |
-
'label_off' =>
|
1439 |
'return_value' => 'show',
|
1440 |
'default' => 'default',
|
1441 |
'render_type' => 'template',
|
@@ -1448,10 +1450,10 @@ class rtTPGElementorHelper {
|
|
1448 |
$ref->add_control(
|
1449 |
'display_per_page',
|
1450 |
[
|
1451 |
-
'label' =>
|
1452 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
1453 |
'default' => 6,
|
1454 |
-
'description' =>
|
1455 |
'condition' => [
|
1456 |
'show_pagination' => 'show',
|
1457 |
],
|
@@ -1466,15 +1468,15 @@ class rtTPGElementorHelper {
|
|
1466 |
$default_pagination = 'pagination_ajax';
|
1467 |
} else {
|
1468 |
$pagination_type = [
|
1469 |
-
'pagination' =>
|
1470 |
];
|
1471 |
}
|
1472 |
|
1473 |
if ( rtTPG()->hasPro() ) {
|
1474 |
$pagination_type_pro = [
|
1475 |
-
'pagination_ajax' =>
|
1476 |
-
'load_more' =>
|
1477 |
-
'load_on_scroll' =>
|
1478 |
];
|
1479 |
$pagination_type = array_merge( $pagination_type, $pagination_type_pro );
|
1480 |
}
|
@@ -1482,7 +1484,7 @@ class rtTPGElementorHelper {
|
|
1482 |
$ref->add_control(
|
1483 |
'pagination_type',
|
1484 |
[
|
1485 |
-
'label' =>
|
1486 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1487 |
'default' => $default_pagination,
|
1488 |
'options' => $pagination_type,
|
@@ -1496,10 +1498,10 @@ class rtTPGElementorHelper {
|
|
1496 |
$ref->add_control(
|
1497 |
'ajax_pagination_type',
|
1498 |
[
|
1499 |
-
'label' =>
|
1500 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1501 |
-
'label_on' =>
|
1502 |
-
'label_off' =>
|
1503 |
'return_value' => 'yes',
|
1504 |
'default' => false,
|
1505 |
'condition' => [
|
@@ -1514,9 +1516,9 @@ class rtTPGElementorHelper {
|
|
1514 |
$ref->add_control(
|
1515 |
'load_more_button_text',
|
1516 |
[
|
1517 |
-
'label' =>
|
1518 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1519 |
-
'default' =>
|
1520 |
'condition' => [
|
1521 |
'pagination_type' => 'load_more',
|
1522 |
'show_pagination' => 'show',
|
@@ -1547,10 +1549,10 @@ class rtTPGElementorHelper {
|
|
1547 |
$ref->add_control(
|
1548 |
'show_section_title',
|
1549 |
[
|
1550 |
-
'label' =>
|
1551 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1552 |
-
'label_on' =>
|
1553 |
-
'label_off' =>
|
1554 |
'return_value' => 'show',
|
1555 |
'default' => 'show',
|
1556 |
'render_type' => 'template',
|
@@ -1561,10 +1563,10 @@ class rtTPGElementorHelper {
|
|
1561 |
$ref->add_control(
|
1562 |
'show_title',
|
1563 |
[
|
1564 |
-
'label' =>
|
1565 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1566 |
-
'label_on' =>
|
1567 |
-
'label_off' =>
|
1568 |
'return_value' => 'show',
|
1569 |
'default' => 'show',
|
1570 |
'render_type' => 'template',
|
@@ -1579,10 +1581,10 @@ class rtTPGElementorHelper {
|
|
1579 |
$ref->add_control(
|
1580 |
'show_thumb',
|
1581 |
[
|
1582 |
-
'label' =>
|
1583 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1584 |
-
'label_on' =>
|
1585 |
-
'label_off' =>
|
1586 |
'return_value' => 'show',
|
1587 |
'default' => 'show',
|
1588 |
'render_type' => 'template',
|
@@ -1593,10 +1595,10 @@ class rtTPGElementorHelper {
|
|
1593 |
$ref->add_control(
|
1594 |
'show_excerpt',
|
1595 |
[
|
1596 |
-
'label' =>
|
1597 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1598 |
-
'label_on' =>
|
1599 |
-
'label_off' =>
|
1600 |
'return_value' => 'show',
|
1601 |
'default' => 'show',
|
1602 |
'render_type' => 'template',
|
@@ -1610,10 +1612,10 @@ class rtTPGElementorHelper {
|
|
1610 |
$ref->add_control(
|
1611 |
'show_meta',
|
1612 |
[
|
1613 |
-
'label' =>
|
1614 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1615 |
-
'label_on' =>
|
1616 |
-
'label_off' =>
|
1617 |
'return_value' => 'show',
|
1618 |
'default' => 'show',
|
1619 |
'render_type' => 'template',
|
@@ -1627,10 +1629,10 @@ class rtTPGElementorHelper {
|
|
1627 |
$ref->add_control(
|
1628 |
'show_date',
|
1629 |
[
|
1630 |
-
'label' =>
|
1631 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1632 |
-
'label_on' =>
|
1633 |
-
'label_off' =>
|
1634 |
'return_value' => 'show',
|
1635 |
'default' => 'show',
|
1636 |
'render_type' => 'template',
|
@@ -1646,10 +1648,10 @@ class rtTPGElementorHelper {
|
|
1646 |
$ref->add_control(
|
1647 |
'show_category',
|
1648 |
[
|
1649 |
-
'label' =>
|
1650 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1651 |
-
'label_on' =>
|
1652 |
-
'label_off' =>
|
1653 |
'return_value' => 'show',
|
1654 |
'default' => 'show',
|
1655 |
'render_type' => 'template',
|
@@ -1665,10 +1667,10 @@ class rtTPGElementorHelper {
|
|
1665 |
$ref->add_control(
|
1666 |
'show_author',
|
1667 |
[
|
1668 |
-
'label' =>
|
1669 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1670 |
-
'label_on' =>
|
1671 |
-
'label_off' =>
|
1672 |
'return_value' => 'show',
|
1673 |
'default' => 'show',
|
1674 |
'classes' => 'tpg-padding-left',
|
@@ -1682,10 +1684,10 @@ class rtTPGElementorHelper {
|
|
1682 |
$ref->add_control(
|
1683 |
'show_tags',
|
1684 |
[
|
1685 |
-
'label' =>
|
1686 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1687 |
-
'label_on' =>
|
1688 |
-
'label_off' =>
|
1689 |
'return_value' => 'show',
|
1690 |
'default' => false,
|
1691 |
'classes' => 'tpg-padding-left',
|
@@ -1699,10 +1701,10 @@ class rtTPGElementorHelper {
|
|
1699 |
$ref->add_control(
|
1700 |
'show_comment_count',
|
1701 |
[
|
1702 |
-
'label' =>
|
1703 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1704 |
-
'label_on' =>
|
1705 |
-
'label_off' =>
|
1706 |
'return_value' => 'show',
|
1707 |
'default' => false,
|
1708 |
'classes' => 'tpg-padding-left',
|
@@ -1716,10 +1718,10 @@ class rtTPGElementorHelper {
|
|
1716 |
$ref->add_control(
|
1717 |
'show_post_count',
|
1718 |
[
|
1719 |
-
'label' =>
|
1720 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1721 |
-
'label_on' =>
|
1722 |
-
'label_off' =>
|
1723 |
'return_value' => 'show',
|
1724 |
'default' => false,
|
1725 |
'classes' => rtTPG()->hasPro() ? 'tpg-padding-left' : 'the-post-grid-field-hide tpg-padding-left',
|
@@ -1734,10 +1736,10 @@ class rtTPGElementorHelper {
|
|
1734 |
$ref->add_control(
|
1735 |
'show_read_more',
|
1736 |
[
|
1737 |
-
'label' =>
|
1738 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1739 |
-
'label_on' =>
|
1740 |
-
'label_off' =>
|
1741 |
'return_value' => 'show',
|
1742 |
'default' => false,
|
1743 |
'condition' => [
|
@@ -1749,10 +1751,10 @@ class rtTPGElementorHelper {
|
|
1749 |
$ref->add_control(
|
1750 |
'show_social_share',
|
1751 |
[
|
1752 |
-
'label' =>
|
1753 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1754 |
-
'label_on' =>
|
1755 |
-
'label_off' =>
|
1756 |
'return_value' => 'show',
|
1757 |
'default' => 'default',
|
1758 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
@@ -1765,10 +1767,10 @@ class rtTPGElementorHelper {
|
|
1765 |
$ref->add_control(
|
1766 |
'show_woocommerce_rating',
|
1767 |
[
|
1768 |
-
'label' =>
|
1769 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1770 |
-
'label_on' =>
|
1771 |
-
'label_off' =>
|
1772 |
'return_value' => 'show',
|
1773 |
'default' => 'default',
|
1774 |
'condition' => [
|
@@ -1782,10 +1784,10 @@ class rtTPGElementorHelper {
|
|
1782 |
$ref->add_control(
|
1783 |
'show_acf',
|
1784 |
[
|
1785 |
-
'label' =>
|
1786 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1787 |
-
'label_on' =>
|
1788 |
-
'label_off' =>
|
1789 |
'return_value' => 'show',
|
1790 |
'default' => false,
|
1791 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
@@ -1823,14 +1825,14 @@ class rtTPGElementorHelper {
|
|
1823 |
$ref->add_control(
|
1824 |
'section_title_style',
|
1825 |
[
|
1826 |
-
'label' =>
|
1827 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1828 |
'default' => 'style1',
|
1829 |
'options' => [
|
1830 |
-
'default' =>
|
1831 |
-
'style1' =>
|
1832 |
-
'style2' =>
|
1833 |
-
'style3' =>
|
1834 |
],
|
1835 |
'prefix_class' => 'section-title-style-',
|
1836 |
'render_type' => 'template',
|
@@ -1853,12 +1855,12 @@ class rtTPGElementorHelper {
|
|
1853 |
$ref->add_control(
|
1854 |
'section_title_source',
|
1855 |
[
|
1856 |
-
'label' =>
|
1857 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1858 |
'default' => 'custom_title',
|
1859 |
'options' => [
|
1860 |
-
'page_title' =>
|
1861 |
-
'custom_title' =>
|
1862 |
],
|
1863 |
'condition' => [
|
1864 |
'show_section_title' => 'show',
|
@@ -1870,10 +1872,10 @@ class rtTPGElementorHelper {
|
|
1870 |
$ref->add_control(
|
1871 |
'section_title_text',
|
1872 |
[
|
1873 |
-
'label' =>
|
1874 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1875 |
-
'placeholder' =>
|
1876 |
-
'default' =>
|
1877 |
'label_block' => true,
|
1878 |
'condition' => [
|
1879 |
'section_title_source' => 'custom_title',
|
@@ -1886,9 +1888,9 @@ class rtTPGElementorHelper {
|
|
1886 |
$ref->add_control(
|
1887 |
'title_prefix',
|
1888 |
[
|
1889 |
-
'label' =>
|
1890 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1891 |
-
'placeholder' =>
|
1892 |
'condition' => [
|
1893 |
'section_title_source' => 'page_title',
|
1894 |
],
|
@@ -1898,9 +1900,9 @@ class rtTPGElementorHelper {
|
|
1898 |
$ref->add_control(
|
1899 |
'title_suffix',
|
1900 |
[
|
1901 |
-
'label' =>
|
1902 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1903 |
-
'placeholder' =>
|
1904 |
'condition' => [
|
1905 |
'section_title_source' => 'page_title',
|
1906 |
],
|
@@ -1910,16 +1912,16 @@ class rtTPGElementorHelper {
|
|
1910 |
$ref->add_control(
|
1911 |
'section_title_tag',
|
1912 |
[
|
1913 |
-
'label' =>
|
1914 |
'type' => Controls_Manager::SELECT,
|
1915 |
'default' => 'h2',
|
1916 |
'options' => [
|
1917 |
-
'h1' =>
|
1918 |
-
'h2' =>
|
1919 |
-
'h3' =>
|
1920 |
-
'h4' =>
|
1921 |
-
'h5' =>
|
1922 |
-
'h6' =>
|
1923 |
],
|
1924 |
'condition' => [
|
1925 |
'show_section_title' => 'show',
|
@@ -1931,10 +1933,10 @@ class rtTPGElementorHelper {
|
|
1931 |
$ref->add_control(
|
1932 |
'show_cat_desc',
|
1933 |
[
|
1934 |
-
'label' =>
|
1935 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1936 |
-
'label_on' =>
|
1937 |
-
'label_off' =>
|
1938 |
'return_value' => 'yes',
|
1939 |
'default' => false,
|
1940 |
]
|
@@ -1968,12 +1970,12 @@ class rtTPGElementorHelper {
|
|
1968 |
$ref->add_control(
|
1969 |
'media_source',
|
1970 |
[
|
1971 |
-
'label' =>
|
1972 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1973 |
'default' => 'feature_image',
|
1974 |
'options' => [
|
1975 |
-
'feature_image' =>
|
1976 |
-
'first_image' =>
|
1977 |
],
|
1978 |
]
|
1979 |
);
|
@@ -2001,12 +2003,12 @@ class rtTPGElementorHelper {
|
|
2001 |
$ref->add_control(
|
2002 |
'img_crop_style',
|
2003 |
[
|
2004 |
-
'label' =>
|
2005 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2006 |
'default' => 'hard',
|
2007 |
'options' => [
|
2008 |
-
'soft' =>
|
2009 |
-
'hard' =>
|
2010 |
],
|
2011 |
'condition' => [
|
2012 |
'image_size' => 'custom',
|
@@ -2068,7 +2070,7 @@ class rtTPGElementorHelper {
|
|
2068 |
$ref->add_responsive_control(
|
2069 |
'list_image_side_width',
|
2070 |
[
|
2071 |
-
'label' =>
|
2072 |
'type' => Controls_Manager::SLIDER,
|
2073 |
'size_units' => [ 'px', '%' ],
|
2074 |
'range' => [
|
@@ -2096,7 +2098,7 @@ class rtTPGElementorHelper {
|
|
2096 |
$ref->add_responsive_control(
|
2097 |
'image_height',
|
2098 |
[
|
2099 |
-
'label' =>
|
2100 |
'type' => Controls_Manager::SLIDER,
|
2101 |
'size_units' => [ '%', 'px' ],
|
2102 |
'range' => [
|
@@ -2122,7 +2124,7 @@ class rtTPGElementorHelper {
|
|
2122 |
$ref->add_responsive_control(
|
2123 |
'offset_image_height',
|
2124 |
[
|
2125 |
-
'label' =>
|
2126 |
'type' => Controls_Manager::SLIDER,
|
2127 |
'size_units' => [ '%', 'px' ],
|
2128 |
'range' => [
|
@@ -2148,16 +2150,16 @@ class rtTPGElementorHelper {
|
|
2148 |
$ref->add_control(
|
2149 |
'hover_animation',
|
2150 |
[
|
2151 |
-
'label' =>
|
2152 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2153 |
'default' => 'default',
|
2154 |
'options' => [
|
2155 |
-
'default' =>
|
2156 |
-
'img_zoom_in' =>
|
2157 |
-
'img_zoom_out' =>
|
2158 |
-
'slide_to_right' =>
|
2159 |
-
'slide_to_left' =>
|
2160 |
-
'img_no_effect' =>
|
2161 |
],
|
2162 |
'render_type' => 'template',
|
2163 |
'prefix_class' => 'img_hover_animation_',
|
@@ -2167,13 +2169,13 @@ class rtTPGElementorHelper {
|
|
2167 |
$ref->add_control(
|
2168 |
'is_thumb_lightbox',
|
2169 |
[
|
2170 |
-
'label' =>
|
2171 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2172 |
'default' => 'default',
|
2173 |
'options' => [
|
2174 |
-
'default' =>
|
2175 |
-
'show' =>
|
2176 |
-
'hide' =>
|
2177 |
],
|
2178 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
2179 |
]
|
@@ -2182,7 +2184,7 @@ class rtTPGElementorHelper {
|
|
2182 |
$ref->add_control(
|
2183 |
'light_box_icon',
|
2184 |
[
|
2185 |
-
'label' =>
|
2186 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2187 |
'default' => [
|
2188 |
'value' => 'fas fa-plus',
|
@@ -2197,10 +2199,10 @@ class rtTPGElementorHelper {
|
|
2197 |
$ref->add_control(
|
2198 |
'is_default_img',
|
2199 |
[
|
2200 |
-
'label' =>
|
2201 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2202 |
-
'label_on' =>
|
2203 |
-
'label_off' =>
|
2204 |
'return_value' => 'yes',
|
2205 |
'default' => false,
|
2206 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
@@ -2211,7 +2213,7 @@ class rtTPGElementorHelper {
|
|
2211 |
$ref->add_control(
|
2212 |
'default_image',
|
2213 |
[
|
2214 |
-
'label' =>
|
2215 |
'type' => \Elementor\Controls_Manager::MEDIA,
|
2216 |
'default' => [
|
2217 |
'url' => rtTPG()->get_assets_uri( 'images/placeholder.png' ),
|
@@ -2251,16 +2253,16 @@ class rtTPGElementorHelper {
|
|
2251 |
$ref->add_control(
|
2252 |
'title_tag',
|
2253 |
[
|
2254 |
-
'label' =>
|
2255 |
'type' => Controls_Manager::SELECT,
|
2256 |
'default' => 'h3',
|
2257 |
'options' => [
|
2258 |
-
'h1' =>
|
2259 |
-
'h2' =>
|
2260 |
-
'h3' =>
|
2261 |
-
'h4' =>
|
2262 |
-
'h5' =>
|
2263 |
-
'h6' =>
|
2264 |
],
|
2265 |
]
|
2266 |
);
|
@@ -2268,15 +2270,15 @@ class rtTPGElementorHelper {
|
|
2268 |
$ref->add_control(
|
2269 |
'title_visibility_style',
|
2270 |
[
|
2271 |
-
'label' =>
|
2272 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2273 |
'default' => 'default',
|
2274 |
'options' => [
|
2275 |
-
'default' =>
|
2276 |
-
'one-line' =>
|
2277 |
-
'two-line' =>
|
2278 |
-
'three-line' =>
|
2279 |
-
'custom' =>
|
2280 |
],
|
2281 |
'render_type' => 'template',
|
2282 |
'prefix_class' => 'title-',
|
@@ -2286,7 +2288,7 @@ class rtTPGElementorHelper {
|
|
2286 |
$ref->add_control(
|
2287 |
'title_limit',
|
2288 |
[
|
2289 |
-
'label' =>
|
2290 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
2291 |
'step' => 1,
|
2292 |
'classes' => 'tpg-padding-left',
|
@@ -2299,12 +2301,12 @@ class rtTPGElementorHelper {
|
|
2299 |
$ref->add_control(
|
2300 |
'title_limit_type',
|
2301 |
[
|
2302 |
-
'label' =>
|
2303 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2304 |
'default' => 'word',
|
2305 |
'options' => [
|
2306 |
-
'word' =>
|
2307 |
-
'character' =>
|
2308 |
],
|
2309 |
'classes' => 'tpg-padding-left',
|
2310 |
'conditions' => [
|
@@ -2327,12 +2329,12 @@ class rtTPGElementorHelper {
|
|
2327 |
);
|
2328 |
|
2329 |
$title_position = [
|
2330 |
-
'default' =>
|
2331 |
];
|
2332 |
if ( rtTPG()->hasPro() ) {
|
2333 |
$title_position_pro = [
|
2334 |
-
'above_image' =>
|
2335 |
-
'below_image' =>
|
2336 |
];
|
2337 |
$title_position = array_merge( $title_position, $title_position_pro );
|
2338 |
}
|
@@ -2340,7 +2342,7 @@ class rtTPGElementorHelper {
|
|
2340 |
$ref->add_control(
|
2341 |
'title_position',
|
2342 |
[
|
2343 |
-
'label' =>
|
2344 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2345 |
'default' => 'default',
|
2346 |
'prefix_class' => 'title_position_',
|
@@ -2365,14 +2367,14 @@ class rtTPGElementorHelper {
|
|
2365 |
$ref->add_control(
|
2366 |
'title_position_hidden',
|
2367 |
[
|
2368 |
-
'label' =>
|
2369 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2370 |
'default' => 'default',
|
2371 |
'prefix_class' => 'title_position_',
|
2372 |
'render_type' => 'template',
|
2373 |
'classes' => 'tpg-should-hide-field',
|
2374 |
'options' => [
|
2375 |
-
'default' =>
|
2376 |
],
|
2377 |
'condition' => [
|
2378 |
$prefix . '_layout!' => [
|
@@ -2391,15 +2393,15 @@ class rtTPGElementorHelper {
|
|
2391 |
$ref->add_control(
|
2392 |
'title_hover_underline',
|
2393 |
[
|
2394 |
-
'label' =>
|
2395 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2396 |
'default' => 'default',
|
2397 |
'prefix_class' => 'title_hover_border_',
|
2398 |
'render_type' => 'template',
|
2399 |
'options' => [
|
2400 |
-
'default' =>
|
2401 |
-
'enable' =>
|
2402 |
-
'disable' =>
|
2403 |
],
|
2404 |
]
|
2405 |
);
|
@@ -2431,19 +2433,19 @@ class rtTPGElementorHelper {
|
|
2431 |
);
|
2432 |
|
2433 |
$excerpt_type = [
|
2434 |
-
'character' =>
|
2435 |
-
'word' =>
|
2436 |
];
|
2437 |
|
2438 |
|
2439 |
if ( in_array( $prefix, [ 'grid', 'list' ] ) ) {
|
2440 |
-
$excerpt_type['full'] =
|
2441 |
}
|
2442 |
|
2443 |
$ref->add_control(
|
2444 |
'excerpt_type',
|
2445 |
[
|
2446 |
-
'label' =>
|
2447 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2448 |
'default' => 'character',
|
2449 |
'options' => $excerpt_type,
|
@@ -2458,7 +2460,7 @@ class rtTPGElementorHelper {
|
|
2458 |
$ref->add_control(
|
2459 |
'excerpt_limit',
|
2460 |
[
|
2461 |
-
'label' =>
|
2462 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
2463 |
'step' => 1,
|
2464 |
'default' => $default_excerpt_limit,
|
@@ -2471,7 +2473,7 @@ class rtTPGElementorHelper {
|
|
2471 |
$ref->add_control(
|
2472 |
'excerpt_more_text',
|
2473 |
[
|
2474 |
-
'label' =>
|
2475 |
'type' => \Elementor\Controls_Manager::TEXT,
|
2476 |
'default' => '...',
|
2477 |
'condition' => [
|
@@ -2540,14 +2542,14 @@ class rtTPGElementorHelper {
|
|
2540 |
);
|
2541 |
|
2542 |
$meta_position = [
|
2543 |
-
'default' =>
|
2544 |
];
|
2545 |
if ( rtTPG()->hasPro() ) {
|
2546 |
$meta_position_pro = [
|
2547 |
-
'above_title' =>
|
2548 |
-
'below_title' =>
|
2549 |
-
'above_excerpt' =>
|
2550 |
-
'below_excerpt' =>
|
2551 |
];
|
2552 |
$meta_position = array_merge( $meta_position, $meta_position_pro );
|
2553 |
}
|
@@ -2555,7 +2557,7 @@ class rtTPGElementorHelper {
|
|
2555 |
$ref->add_control(
|
2556 |
'meta_position',
|
2557 |
[
|
2558 |
-
'label' =>
|
2559 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2560 |
'default' => 'default',
|
2561 |
'prefix_class' => 'meta_position_',
|
@@ -2568,10 +2570,10 @@ class rtTPGElementorHelper {
|
|
2568 |
$ref->add_control(
|
2569 |
'show_meta_icon',
|
2570 |
[
|
2571 |
-
'label' =>
|
2572 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2573 |
-
'label_on' =>
|
2574 |
-
'label_off' =>
|
2575 |
'return_value' => 'yes',
|
2576 |
'default' => 'yes',
|
2577 |
]
|
@@ -2580,16 +2582,16 @@ class rtTPGElementorHelper {
|
|
2580 |
$ref->add_control(
|
2581 |
'meta_separator',
|
2582 |
[
|
2583 |
-
'label' =>
|
2584 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2585 |
'default' => 'default',
|
2586 |
'options' => [
|
2587 |
-
'default' =>
|
2588 |
-
'.' =>
|
2589 |
-
'/' =>
|
2590 |
-
'//' =>
|
2591 |
-
'-' =>
|
2592 |
-
'|' =>
|
2593 |
],
|
2594 |
]
|
2595 |
);
|
@@ -2598,10 +2600,10 @@ class rtTPGElementorHelper {
|
|
2598 |
$ref->add_control(
|
2599 |
'meta_popover_toggle',
|
2600 |
[
|
2601 |
-
'label' =>
|
2602 |
'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
|
2603 |
-
'label_off' =>
|
2604 |
-
'label_on' =>
|
2605 |
'return_value' => 'yes',
|
2606 |
'condition' => [
|
2607 |
'show_meta_icon' => 'yes',
|
@@ -2614,7 +2616,7 @@ class rtTPGElementorHelper {
|
|
2614 |
$ref->add_control(
|
2615 |
'user_icon',
|
2616 |
[
|
2617 |
-
'label' =>
|
2618 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2619 |
'default' => [
|
2620 |
'value' => 'fas fa-user',
|
@@ -2629,7 +2631,7 @@ class rtTPGElementorHelper {
|
|
2629 |
$ref->add_control(
|
2630 |
'cat_icon',
|
2631 |
[
|
2632 |
-
'label' =>
|
2633 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2634 |
'default' => [
|
2635 |
'value' => 'fas fa-folder-open',
|
@@ -2644,7 +2646,7 @@ class rtTPGElementorHelper {
|
|
2644 |
$ref->add_control(
|
2645 |
'date_icon',
|
2646 |
[
|
2647 |
-
'label' =>
|
2648 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2649 |
'default' => [
|
2650 |
'value' => 'far fa-calendar-alt',
|
@@ -2659,7 +2661,7 @@ class rtTPGElementorHelper {
|
|
2659 |
$ref->add_control(
|
2660 |
'tag_icon',
|
2661 |
[
|
2662 |
-
'label' =>
|
2663 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2664 |
'default' => [
|
2665 |
'value' => 'fa fa-tags',
|
@@ -2674,7 +2676,7 @@ class rtTPGElementorHelper {
|
|
2674 |
$ref->add_control(
|
2675 |
'comment_icon',
|
2676 |
[
|
2677 |
-
'label' =>
|
2678 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2679 |
'default' => [
|
2680 |
'value' => 'fas fa-comments',
|
@@ -2689,7 +2691,7 @@ class rtTPGElementorHelper {
|
|
2689 |
$ref->add_control(
|
2690 |
'post_count_icon',
|
2691 |
[
|
2692 |
-
'label' =>
|
2693 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2694 |
'default' => [
|
2695 |
'value' => 'fas fa-eye',
|
@@ -2722,7 +2724,7 @@ class rtTPGElementorHelper {
|
|
2722 |
$ref->add_control(
|
2723 |
'meta_author_heading',
|
2724 |
[
|
2725 |
-
'label' =>
|
2726 |
'type' => \Elementor\Controls_Manager::HEADING,
|
2727 |
'classes' => 'tpg-control-type-heading',
|
2728 |
'condition' => [
|
@@ -2734,9 +2736,9 @@ class rtTPGElementorHelper {
|
|
2734 |
$ref->add_control(
|
2735 |
'author_prefix',
|
2736 |
[
|
2737 |
-
'label' =>
|
2738 |
'type' => \Elementor\Controls_Manager::TEXT,
|
2739 |
-
'placeholder' =>
|
2740 |
'condition' => [
|
2741 |
'show_author!' => '',
|
2742 |
],
|
@@ -2746,13 +2748,13 @@ class rtTPGElementorHelper {
|
|
2746 |
$ref->add_control(
|
2747 |
'author_icon_visibility',
|
2748 |
[
|
2749 |
-
'label' =>
|
2750 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2751 |
'default' => 'default',
|
2752 |
'options' => [
|
2753 |
-
'default' =>
|
2754 |
-
'hide' =>
|
2755 |
-
'show' =>
|
2756 |
],
|
2757 |
'condition' => [
|
2758 |
'show_author!' => '',
|
@@ -2764,10 +2766,10 @@ class rtTPGElementorHelper {
|
|
2764 |
$ref->add_control(
|
2765 |
'show_author_image',
|
2766 |
[
|
2767 |
-
'label' =>
|
2768 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2769 |
-
'label_on' =>
|
2770 |
-
'label_off' =>
|
2771 |
'return_value' => 'show',
|
2772 |
'default' => 'show',
|
2773 |
'render_type' => 'template',
|
@@ -2783,7 +2785,7 @@ class rtTPGElementorHelper {
|
|
2783 |
$ref->add_responsive_control(
|
2784 |
'author_icon_width',
|
2785 |
[
|
2786 |
-
'label' =>
|
2787 |
'type' => Controls_Manager::SLIDER,
|
2788 |
'size_units' => [ 'px' ],
|
2789 |
'range' => [
|
@@ -2811,7 +2813,7 @@ class rtTPGElementorHelper {
|
|
2811 |
$ref->add_control(
|
2812 |
'category_heading',
|
2813 |
[
|
2814 |
-
'label' =>
|
2815 |
'type' => \Elementor\Controls_Manager::HEADING,
|
2816 |
'classes' => 'tpg-control-type-heading',
|
2817 |
'conditions' => [
|
@@ -2836,18 +2838,18 @@ class rtTPGElementorHelper {
|
|
2836 |
$ref->add_control(
|
2837 |
'category_position',
|
2838 |
[
|
2839 |
-
'label' =>
|
2840 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2841 |
'default' => 'default',
|
2842 |
'options' => [
|
2843 |
-
'default' =>
|
2844 |
-
'above_title' =>
|
2845 |
-
'with_meta' =>
|
2846 |
-
'top_left' =>
|
2847 |
-
'top_right' =>
|
2848 |
-
'bottom_left' =>
|
2849 |
-
'bottom_right' =>
|
2850 |
-
'image_center' =>
|
2851 |
],
|
2852 |
'condition' => [
|
2853 |
'show_category' => 'show',
|
@@ -2862,13 +2864,13 @@ class rtTPGElementorHelper {
|
|
2862 |
$ref->add_control(
|
2863 |
'category_style',
|
2864 |
[
|
2865 |
-
'label' =>
|
2866 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2867 |
'default' => 'style1',
|
2868 |
'options' => [
|
2869 |
-
'style1' =>
|
2870 |
-
'style2' =>
|
2871 |
-
'style3' =>
|
2872 |
],
|
2873 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
2874 |
'condition' => [
|
@@ -2881,10 +2883,10 @@ class rtTPGElementorHelper {
|
|
2881 |
$ref->add_control(
|
2882 |
'show_cat_icon',
|
2883 |
[
|
2884 |
-
'label' =>
|
2885 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2886 |
-
'label_on' =>
|
2887 |
-
'label_off' =>
|
2888 |
'return_value' => 'yes',
|
2889 |
'default' => false,
|
2890 |
'condition' => [
|
@@ -2949,7 +2951,7 @@ class rtTPGElementorHelper {
|
|
2949 |
$ref->add_control(
|
2950 |
$post_type . '_taxonomy',
|
2951 |
[
|
2952 |
-
'label' =>
|
2953 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2954 |
'default' => $default_cat,
|
2955 |
'options' => $term_options,
|
@@ -2957,14 +2959,14 @@ class rtTPGElementorHelper {
|
|
2957 |
'show_category' => 'show',
|
2958 |
'post_type' => $post_type,
|
2959 |
],
|
2960 |
-
'description' =>
|
2961 |
]
|
2962 |
);
|
2963 |
|
2964 |
$ref->add_control(
|
2965 |
$post_type . '_tags',
|
2966 |
[
|
2967 |
-
'label' =>
|
2968 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2969 |
'default' => $default_tag,
|
2970 |
'options' => $term_options,
|
@@ -2972,7 +2974,7 @@ class rtTPGElementorHelper {
|
|
2972 |
'show_category' => 'show',
|
2973 |
'post_type' => $post_type,
|
2974 |
],
|
2975 |
-
'description' =>
|
2976 |
]
|
2977 |
);
|
2978 |
}
|
@@ -2980,7 +2982,7 @@ class rtTPGElementorHelper {
|
|
2980 |
$ref->add_control(
|
2981 |
'comment_count_heading',
|
2982 |
[
|
2983 |
-
'label' =>
|
2984 |
'type' => \Elementor\Controls_Manager::HEADING,
|
2985 |
'classes' => 'tpg-control-type-heading',
|
2986 |
'condition' => [
|
@@ -2992,10 +2994,10 @@ class rtTPGElementorHelper {
|
|
2992 |
$ref->add_control(
|
2993 |
'show_comment_count_label',
|
2994 |
[
|
2995 |
-
'label' =>
|
2996 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2997 |
-
'label_on' =>
|
2998 |
-
'label_off' =>
|
2999 |
'return_value' => 'yes',
|
3000 |
'default' => 'yes',
|
3001 |
'condition' => [
|
@@ -3007,10 +3009,10 @@ class rtTPGElementorHelper {
|
|
3007 |
$ref->add_control(
|
3008 |
'comment_count_label_singular',
|
3009 |
[
|
3010 |
-
'label' =>
|
3011 |
'type' => \Elementor\Controls_Manager::TEXT,
|
3012 |
-
'default' =>
|
3013 |
-
'placeholder' =>
|
3014 |
'condition' => [
|
3015 |
'show_comment_count' => 'show',
|
3016 |
'show_comment_count_label' => 'yes',
|
@@ -3021,10 +3023,10 @@ class rtTPGElementorHelper {
|
|
3021 |
$ref->add_control(
|
3022 |
'comment_count_label_plural',
|
3023 |
[
|
3024 |
-
'label' =>
|
3025 |
'type' => \Elementor\Controls_Manager::TEXT,
|
3026 |
-
'default' =>
|
3027 |
-
'placeholder' =>
|
3028 |
'condition' => [
|
3029 |
'show_comment_count' => 'show',
|
3030 |
'show_comment_count_label' => 'yes',
|
@@ -3035,7 +3037,7 @@ class rtTPGElementorHelper {
|
|
3035 |
$ref->add_control(
|
3036 |
'meta_ordering_heading',
|
3037 |
[
|
3038 |
-
'label' =>
|
3039 |
'type' => \Elementor\Controls_Manager::HEADING,
|
3040 |
'classes' => 'tpg-control-type-heading',
|
3041 |
]
|
@@ -3120,12 +3122,12 @@ class rtTPGElementorHelper {
|
|
3120 |
$ref->add_control(
|
3121 |
'readmore_btn_style',
|
3122 |
[
|
3123 |
-
'label' =>
|
3124 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3125 |
'default' => 'default-style',
|
3126 |
'options' => [
|
3127 |
-
'default-style' =>
|
3128 |
-
'only-text' =>
|
3129 |
],
|
3130 |
'prefix_class' => 'readmore-btn-',
|
3131 |
]
|
@@ -3134,10 +3136,10 @@ class rtTPGElementorHelper {
|
|
3134 |
$ref->add_control(
|
3135 |
'read_more_label',
|
3136 |
[
|
3137 |
-
'label' =>
|
3138 |
'type' => \Elementor\Controls_Manager::TEXT,
|
3139 |
-
'default' =>
|
3140 |
-
'placeholder' =>
|
3141 |
]
|
3142 |
);
|
3143 |
|
@@ -3145,10 +3147,10 @@ class rtTPGElementorHelper {
|
|
3145 |
$ref->add_control(
|
3146 |
'show_btn_icon',
|
3147 |
[
|
3148 |
-
'label' =>
|
3149 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3150 |
-
'label_on' =>
|
3151 |
-
'label_off' =>
|
3152 |
'return_value' => 'yes',
|
3153 |
'default' => false,
|
3154 |
]
|
@@ -3157,7 +3159,7 @@ class rtTPGElementorHelper {
|
|
3157 |
$ref->add_control(
|
3158 |
'readmore_btn_icon',
|
3159 |
[
|
3160 |
-
'label' =>
|
3161 |
'type' => \Elementor\Controls_Manager::ICONS,
|
3162 |
'default' => [
|
3163 |
'value' => 'fas fa-angle-right',
|
@@ -3208,7 +3210,7 @@ class rtTPGElementorHelper {
|
|
3208 |
// $ref->add_control(
|
3209 |
// 'cf_group',
|
3210 |
// [
|
3211 |
-
// 'label' =>
|
3212 |
// 'type' => \Elementor\Controls_Manager::SELECT2,
|
3213 |
// 'multiple' => true,
|
3214 |
// 'label_block' => true,
|
@@ -3232,7 +3234,7 @@ class rtTPGElementorHelper {
|
|
3232 |
$ref->add_control(
|
3233 |
$post_type . '_cf_group',
|
3234 |
[
|
3235 |
-
'label' =>
|
3236 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
3237 |
'label_block' => true,
|
3238 |
'multiple' => true,
|
@@ -3248,10 +3250,10 @@ class rtTPGElementorHelper {
|
|
3248 |
$ref->add_control(
|
3249 |
'cf_hide_empty_value',
|
3250 |
[
|
3251 |
-
'label' =>
|
3252 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3253 |
-
'label_on' =>
|
3254 |
-
'label_off' =>
|
3255 |
'return_value' => 'yes',
|
3256 |
'default' => 'yes',
|
3257 |
]
|
@@ -3260,10 +3262,10 @@ class rtTPGElementorHelper {
|
|
3260 |
$ref->add_control(
|
3261 |
'cf_hide_group_title',
|
3262 |
[
|
3263 |
-
'label' =>
|
3264 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3265 |
-
'label_on' =>
|
3266 |
-
'label_off' =>
|
3267 |
'return_value' => 'yes',
|
3268 |
'default' => 'yes',
|
3269 |
]
|
@@ -3272,10 +3274,10 @@ class rtTPGElementorHelper {
|
|
3272 |
$ref->add_control(
|
3273 |
'cf_show_only_value',
|
3274 |
[
|
3275 |
-
'label' =>
|
3276 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3277 |
-
'label_on' =>
|
3278 |
-
'label_off' =>
|
3279 |
'return_value' => 'yes',
|
3280 |
'default' => 'yes',
|
3281 |
]
|
@@ -3304,18 +3306,18 @@ class rtTPGElementorHelper {
|
|
3304 |
);
|
3305 |
|
3306 |
$link_type = [
|
3307 |
-
'default' =>
|
3308 |
];
|
3309 |
if ( rtTPG()->hasPro() ) {
|
3310 |
-
$link_type['popup'] =
|
3311 |
-
$link_type['multi_popup'] =
|
3312 |
}
|
3313 |
-
$link_type['none'] =
|
3314 |
|
3315 |
$ref->add_control(
|
3316 |
'post_link_type',
|
3317 |
[
|
3318 |
-
'label' =>
|
3319 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3320 |
'default' => 'default',
|
3321 |
'options' => $link_type,
|
@@ -3326,12 +3328,12 @@ class rtTPGElementorHelper {
|
|
3326 |
$ref->add_control(
|
3327 |
'link_target',
|
3328 |
[
|
3329 |
-
'label' =>
|
3330 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3331 |
'default' => '_self',
|
3332 |
'options' => [
|
3333 |
-
'_self' =>
|
3334 |
-
'_blank' =>
|
3335 |
],
|
3336 |
'condition' => [
|
3337 |
'post_link_type' => 'default',
|
@@ -3342,10 +3344,10 @@ class rtTPGElementorHelper {
|
|
3342 |
$ref->add_control(
|
3343 |
'is_thumb_linked',
|
3344 |
[
|
3345 |
-
'label' =>
|
3346 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3347 |
-
'label_on' =>
|
3348 |
-
'label_off' =>
|
3349 |
'return_value' => 'yes',
|
3350 |
'default' => 'yes',
|
3351 |
]
|
@@ -3419,19 +3421,19 @@ class rtTPGElementorHelper {
|
|
3419 |
$ref->add_control(
|
3420 |
'section_title_alignment',
|
3421 |
[
|
3422 |
-
'label' =>
|
3423 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
3424 |
'options' => [
|
3425 |
'left' => [
|
3426 |
-
'title' =>
|
3427 |
'icon' => 'eicon-text-align-left',
|
3428 |
],
|
3429 |
'center' => [
|
3430 |
-
'title' =>
|
3431 |
'icon' => 'eicon-text-align-center',
|
3432 |
],
|
3433 |
'right' => [
|
3434 |
-
'title' =>
|
3435 |
'icon' => 'eicon-text-align-right',
|
3436 |
],
|
3437 |
],
|
@@ -3445,7 +3447,7 @@ class rtTPGElementorHelper {
|
|
3445 |
$ref->add_responsive_control(
|
3446 |
'section_title_margin',
|
3447 |
[
|
3448 |
-
'label' =>
|
3449 |
'type' => Controls_Manager::DIMENSIONS,
|
3450 |
'size_units' => [ 'px' ],
|
3451 |
'allowed_dimensions' => 'vertical', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
|
@@ -3466,7 +3468,7 @@ class rtTPGElementorHelper {
|
|
3466 |
$ref->add_responsive_control(
|
3467 |
'section_title_padding',
|
3468 |
[
|
3469 |
-
'label' =>
|
3470 |
'type' => Controls_Manager::DIMENSIONS,
|
3471 |
'size_units' => [ 'px' ],
|
3472 |
'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
|
@@ -3488,7 +3490,7 @@ class rtTPGElementorHelper {
|
|
3488 |
\Elementor\Group_Control_Typography::get_type(),
|
3489 |
[
|
3490 |
'name' => 'section_title_typography',
|
3491 |
-
'label' =>
|
3492 |
'selector' => '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading',
|
3493 |
]
|
3494 |
);
|
@@ -3496,7 +3498,7 @@ class rtTPGElementorHelper {
|
|
3496 |
$ref->add_control(
|
3497 |
'section_title_color',
|
3498 |
[
|
3499 |
-
'label' =>
|
3500 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3501 |
'selectors' => [
|
3502 |
'{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading' => 'color: {{VALUE}}',
|
@@ -3507,7 +3509,7 @@ class rtTPGElementorHelper {
|
|
3507 |
$ref->add_control(
|
3508 |
'section_title_bg_color',
|
3509 |
[
|
3510 |
-
'label' =>
|
3511 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3512 |
'selectors' => [
|
3513 |
'{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, {{WRAPPER}} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading' => 'background-color: {{VALUE}}',
|
@@ -3523,7 +3525,7 @@ class rtTPGElementorHelper {
|
|
3523 |
$ref->add_control(
|
3524 |
'section_title_dot_color',
|
3525 |
[
|
3526 |
-
'label' =>
|
3527 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3528 |
'selectors' => [
|
3529 |
'{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading::before' => 'background-color: {{VALUE}}',
|
@@ -3537,7 +3539,7 @@ class rtTPGElementorHelper {
|
|
3537 |
$ref->add_control(
|
3538 |
'section_title_line_color',
|
3539 |
[
|
3540 |
-
'label' =>
|
3541 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3542 |
'selectors' => [
|
3543 |
'{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line' => 'border-color: {{VALUE}}',
|
@@ -3557,7 +3559,7 @@ class rtTPGElementorHelper {
|
|
3557 |
$ref->add_control(
|
3558 |
'prefix_text_color',
|
3559 |
[
|
3560 |
-
'label' =>
|
3561 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3562 |
'selectors' => [
|
3563 |
'{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .prefix-text' => 'color: {{VALUE}}',
|
@@ -3570,7 +3572,7 @@ class rtTPGElementorHelper {
|
|
3570 |
$ref->add_control(
|
3571 |
'suffix_text_color',
|
3572 |
[
|
3573 |
-
'label' =>
|
3574 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3575 |
'selectors' => [
|
3576 |
'{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .suffix-text' => 'color: {{VALUE}}',
|
@@ -3586,7 +3588,7 @@ class rtTPGElementorHelper {
|
|
3586 |
$ref->add_control(
|
3587 |
'cat_tag_description_heading',
|
3588 |
[
|
3589 |
-
'label' =>
|
3590 |
'type' => \Elementor\Controls_Manager::HEADING,
|
3591 |
'classes' => 'tpg-control-type-heading',
|
3592 |
'condition' => [
|
@@ -3599,7 +3601,7 @@ class rtTPGElementorHelper {
|
|
3599 |
\Elementor\Group_Control_Typography::get_type(),
|
3600 |
[
|
3601 |
'name' => 'taxonomy_des_typography',
|
3602 |
-
'label' =>
|
3603 |
'selector' => '{{WRAPPER}} .tpg-category-description',
|
3604 |
'condition' => [
|
3605 |
'show_cat_desc' => 'yes',
|
@@ -3610,19 +3612,19 @@ class rtTPGElementorHelper {
|
|
3610 |
$ref->add_responsive_control(
|
3611 |
'taxonomy_des_alignment',
|
3612 |
[
|
3613 |
-
'label' =>
|
3614 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
3615 |
'options' => [
|
3616 |
'left' => [
|
3617 |
-
'title' =>
|
3618 |
'icon' => 'eicon-text-align-left',
|
3619 |
],
|
3620 |
'center' => [
|
3621 |
-
'title' =>
|
3622 |
'icon' => 'eicon-text-align-center',
|
3623 |
],
|
3624 |
'right' => [
|
3625 |
-
'title' =>
|
3626 |
'icon' => 'eicon-text-align-right',
|
3627 |
],
|
3628 |
],
|
@@ -3638,7 +3640,7 @@ class rtTPGElementorHelper {
|
|
3638 |
$ref->add_control(
|
3639 |
'taxonomy_des_color',
|
3640 |
[
|
3641 |
-
'label' =>
|
3642 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3643 |
'selectors' => [
|
3644 |
'{{WRAPPER}} .tpg-category-description' => 'color: {{VALUE}}',
|
@@ -3652,7 +3654,7 @@ class rtTPGElementorHelper {
|
|
3652 |
$ref->add_responsive_control(
|
3653 |
'taxonomy_des_dimension',
|
3654 |
[
|
3655 |
-
'label' =>
|
3656 |
'type' => Controls_Manager::DIMENSIONS,
|
3657 |
'size_units' => [ 'px' ],
|
3658 |
'selectors' => [
|
@@ -3681,7 +3683,7 @@ class rtTPGElementorHelper {
|
|
3681 |
$ref->start_controls_section(
|
3682 |
'thumbnail_style',
|
3683 |
[
|
3684 |
-
'label' =>
|
3685 |
'tab' => Controls_Manager::TAB_STYLE,
|
3686 |
'condition' => [
|
3687 |
'show_thumb' => 'show',
|
@@ -3692,7 +3694,7 @@ class rtTPGElementorHelper {
|
|
3692 |
$ref->add_responsive_control(
|
3693 |
'img_border_radius',
|
3694 |
[
|
3695 |
-
'label' =>
|
3696 |
'type' => Controls_Manager::DIMENSIONS,
|
3697 |
'size_units' => [ 'px', '%', 'em' ],
|
3698 |
'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
|
@@ -3714,13 +3716,13 @@ class rtTPGElementorHelper {
|
|
3714 |
$ref->add_control(
|
3715 |
'image_width',
|
3716 |
[
|
3717 |
-
'label' =>
|
3718 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3719 |
'default' => 'inherit',
|
3720 |
'options' => [
|
3721 |
-
'inherit' =>
|
3722 |
-
'100%' =>
|
3723 |
-
'auto' =>
|
3724 |
],
|
3725 |
'selectors' => [
|
3726 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img' => 'width: {{VALUE}};',
|
@@ -3732,7 +3734,7 @@ class rtTPGElementorHelper {
|
|
3732 |
$ref->add_responsive_control(
|
3733 |
'thumbnail_spacing',
|
3734 |
[
|
3735 |
-
'label' =>
|
3736 |
'type' => Controls_Manager::DIMENSIONS,
|
3737 |
'size_units' => [ 'px' ],
|
3738 |
'selectors' => [
|
@@ -3769,7 +3771,7 @@ class rtTPGElementorHelper {
|
|
3769 |
$ref->add_responsive_control(
|
3770 |
'grid_hover_thumbnail_margin',
|
3771 |
[
|
3772 |
-
'label' =>
|
3773 |
'type' => Controls_Manager::DIMENSIONS,
|
3774 |
'size_units' => [ 'px' ],
|
3775 |
'selectors' => [
|
@@ -3786,7 +3788,7 @@ class rtTPGElementorHelper {
|
|
3786 |
$ref->add_control(
|
3787 |
'thumb_overlay_style_heading',
|
3788 |
[
|
3789 |
-
'label' =>
|
3790 |
'type' => \Elementor\Controls_Manager::HEADING,
|
3791 |
'classes' => 'tpg-control-type-heading',
|
3792 |
]
|
@@ -3800,7 +3802,7 @@ class rtTPGElementorHelper {
|
|
3800 |
$ref->start_controls_tab(
|
3801 |
'grid_hover_style_normal_tab',
|
3802 |
[
|
3803 |
-
'label' =>
|
3804 |
]
|
3805 |
);
|
3806 |
|
@@ -3808,7 +3810,7 @@ class rtTPGElementorHelper {
|
|
3808 |
\Elementor\Group_Control_Background::get_type(),
|
3809 |
[
|
3810 |
'name' => 'grid_hover_overlay_color',
|
3811 |
-
'label' =>
|
3812 |
'types' => [ 'classic', 'gradient' ],
|
3813 |
'selector' => '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content:before, {{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap .overlay',
|
3814 |
'exclude' => [ 'image' ],
|
@@ -3829,7 +3831,7 @@ class rtTPGElementorHelper {
|
|
3829 |
$ref->add_control(
|
3830 |
'thumb_lightbox_bg',
|
3831 |
[
|
3832 |
-
'label' =>
|
3833 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3834 |
'selectors' => [
|
3835 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}',
|
@@ -3843,7 +3845,7 @@ class rtTPGElementorHelper {
|
|
3843 |
$ref->add_control(
|
3844 |
'thumb_lightbox_color',
|
3845 |
[
|
3846 |
-
'label' =>
|
3847 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3848 |
'selectors' => [
|
3849 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}',
|
@@ -3860,7 +3862,7 @@ class rtTPGElementorHelper {
|
|
3860 |
$ref->start_controls_tab(
|
3861 |
'grid_hover_style_hover_tab',
|
3862 |
[
|
3863 |
-
'label' =>
|
3864 |
]
|
3865 |
);
|
3866 |
|
@@ -3868,7 +3870,7 @@ class rtTPGElementorHelper {
|
|
3868 |
\Elementor\Group_Control_Background::get_type(),
|
3869 |
[
|
3870 |
'name' => 'grid_hover_overlay_color_hover',
|
3871 |
-
'label' =>
|
3872 |
'types' => [ 'classic', 'gradient' ],
|
3873 |
'selector' => '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content:after, {{WRAPPER}} .tpg-el-main-wrapper .rt-holder:hover .tpg-el-image-wrap .overlay',
|
3874 |
'exclude' => [ 'image' ],
|
@@ -3890,7 +3892,7 @@ class rtTPGElementorHelper {
|
|
3890 |
$ref->add_control(
|
3891 |
'thumb_lightbox_bg_hover',
|
3892 |
[
|
3893 |
-
'label' =>
|
3894 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3895 |
'selectors' => [
|
3896 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}',
|
@@ -3904,7 +3906,7 @@ class rtTPGElementorHelper {
|
|
3904 |
$ref->add_control(
|
3905 |
'thumb_lightbox_color_hover',
|
3906 |
[
|
3907 |
-
'label' =>
|
3908 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3909 |
'selectors' => [
|
3910 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}',
|
@@ -3927,21 +3929,21 @@ class rtTPGElementorHelper {
|
|
3927 |
);
|
3928 |
|
3929 |
$overlay_type_opt = [
|
3930 |
-
'always' =>
|
3931 |
-
'fadein-on-hover' =>
|
3932 |
-
'fadeout-on-hover' =>
|
3933 |
-
'slidein-on-hover' =>
|
3934 |
-
'slideout-on-hover' =>
|
3935 |
-
'zoomin-on-hover' =>
|
3936 |
-
'zoomout-on-hover' =>
|
3937 |
-
'zoominall-on-hover' =>
|
3938 |
-
'zoomoutall-on-hover' =>
|
3939 |
];
|
3940 |
|
3941 |
if ( $ref->prefix == 'grid_hover' || $ref->prefix == 'slider' ) {
|
3942 |
$overlay_type_opt2 = [
|
3943 |
-
'flipin-on-hover' =>
|
3944 |
-
'flipout-on-hover' =>
|
3945 |
];
|
3946 |
$overlay_type_opt = array_merge( $overlay_type_opt, $overlay_type_opt2 );
|
3947 |
}
|
@@ -3949,11 +3951,11 @@ class rtTPGElementorHelper {
|
|
3949 |
$ref->add_control(
|
3950 |
'grid_hover_overlay_type',
|
3951 |
[
|
3952 |
-
'label' =>
|
3953 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3954 |
'default' => 'always',
|
3955 |
'options' => $overlay_type_opt,
|
3956 |
-
'description' =>
|
3957 |
'prefix_class' => 'grid-hover-overlay-type-',
|
3958 |
]
|
3959 |
);
|
@@ -3969,13 +3971,13 @@ class rtTPGElementorHelper {
|
|
3969 |
$ref->add_control(
|
3970 |
'grid_hover_overlay_height',
|
3971 |
[
|
3972 |
-
'label' =>
|
3973 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3974 |
'default' => 'default',
|
3975 |
'options' => [
|
3976 |
-
'default' =>
|
3977 |
-
'full' =>
|
3978 |
-
'auto' =>
|
3979 |
],
|
3980 |
'condition' => $overlay_height_condition,
|
3981 |
'prefix_class' => 'grid-hover-overlay-height-',
|
@@ -3985,13 +3987,13 @@ class rtTPGElementorHelper {
|
|
3985 |
$ref->add_control(
|
3986 |
'on_hover_overlay',
|
3987 |
[
|
3988 |
-
'label' =>
|
3989 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3990 |
'default' => 'default',
|
3991 |
'options' => [
|
3992 |
-
'default' =>
|
3993 |
-
'full' =>
|
3994 |
-
'auto' =>
|
3995 |
],
|
3996 |
'condition' => $overlay_height_condition,
|
3997 |
'prefix_class' => 'hover-overlay-height-',
|
@@ -4013,7 +4015,7 @@ class rtTPGElementorHelper {
|
|
4013 |
$ref->start_controls_section(
|
4014 |
'title_style',
|
4015 |
[
|
4016 |
-
'label' =>
|
4017 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
4018 |
'condition' => [
|
4019 |
'show_title' => 'show',
|
@@ -4025,7 +4027,7 @@ class rtTPGElementorHelper {
|
|
4025 |
$ref->add_responsive_control(
|
4026 |
'title_spacing',
|
4027 |
[
|
4028 |
-
'label' =>
|
4029 |
'type' => Controls_Manager::DIMENSIONS,
|
4030 |
'size_units' => [ 'px' ],
|
4031 |
'selectors' => [
|
@@ -4045,7 +4047,7 @@ class rtTPGElementorHelper {
|
|
4045 |
$ref->add_responsive_control(
|
4046 |
'title_padding',
|
4047 |
[
|
4048 |
-
'label' =>
|
4049 |
'type' => Controls_Manager::DIMENSIONS,
|
4050 |
'size_units' => [ 'px' ],
|
4051 |
'selectors' => [
|
@@ -4078,7 +4080,7 @@ class rtTPGElementorHelper {
|
|
4078 |
'name' => 'title_offset_typography',
|
4079 |
'label' => esc_html__( 'Offset Typography', 'the-post-grid' ),
|
4080 |
'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .offset-left .entry-title-wrapper .entry-title',
|
4081 |
-
'description' =>
|
4082 |
'condition' => [
|
4083 |
$prefix . '_layout' => [
|
4084 |
'grid-layout5',
|
@@ -4107,13 +4109,13 @@ class rtTPGElementorHelper {
|
|
4107 |
$ref->add_control(
|
4108 |
'title_border_visibility',
|
4109 |
[
|
4110 |
-
'label' =>
|
4111 |
'type' => \Elementor\Controls_Manager::SELECT,
|
4112 |
'default' => 'default',
|
4113 |
'options' => [
|
4114 |
-
'default' =>
|
4115 |
-
'show' =>
|
4116 |
-
'hide' =>
|
4117 |
],
|
4118 |
'prefix_class' => 'tpg-title-border-',
|
4119 |
'condition' => [
|
@@ -4125,23 +4127,23 @@ class rtTPGElementorHelper {
|
|
4125 |
$ref->add_responsive_control(
|
4126 |
'title_alignment',
|
4127 |
[
|
4128 |
-
'label' =>
|
4129 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
4130 |
'options' => [
|
4131 |
'left' => [
|
4132 |
-
'title' =>
|
4133 |
'icon' => 'eicon-text-align-left',
|
4134 |
],
|
4135 |
'center' => [
|
4136 |
-
'title' =>
|
4137 |
'icon' => 'eicon-text-align-center',
|
4138 |
],
|
4139 |
'right' => [
|
4140 |
-
'title' =>
|
4141 |
'icon' => 'eicon-text-align-right',
|
4142 |
],
|
4143 |
'justify' => [
|
4144 |
-
'title' =>
|
4145 |
'icon' => 'eicon-text-align-justify',
|
4146 |
],
|
4147 |
],
|
@@ -4161,14 +4163,14 @@ class rtTPGElementorHelper {
|
|
4161 |
$ref->start_controls_tab(
|
4162 |
'title_normal_tab',
|
4163 |
[
|
4164 |
-
'label' =>
|
4165 |
]
|
4166 |
);
|
4167 |
//TODO: Normal Tab
|
4168 |
$ref->add_control(
|
4169 |
'title_color',
|
4170 |
[
|
4171 |
-
'label' =>
|
4172 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4173 |
'selectors' => [
|
4174 |
'{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'color: {{VALUE}}',
|
@@ -4179,7 +4181,7 @@ class rtTPGElementorHelper {
|
|
4179 |
$ref->add_control(
|
4180 |
'title_bg_color',
|
4181 |
[
|
4182 |
-
'label' =>
|
4183 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4184 |
'selectors' => [
|
4185 |
'{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'background-color: {{VALUE}}',
|
@@ -4190,7 +4192,7 @@ class rtTPGElementorHelper {
|
|
4190 |
$ref->add_control(
|
4191 |
'title_border_color',
|
4192 |
[
|
4193 |
-
'label' =>
|
4194 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4195 |
'selectors' => [
|
4196 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}',
|
@@ -4205,7 +4207,7 @@ class rtTPGElementorHelper {
|
|
4205 |
$ref->add_control(
|
4206 |
'title_hover_border_color',
|
4207 |
[
|
4208 |
-
'label' =>
|
4209 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4210 |
'selectors' => [
|
4211 |
'{{WRAPPER}}' => '--tpg-primary-color: {{VALUE}}',
|
@@ -4221,7 +4223,7 @@ class rtTPGElementorHelper {
|
|
4221 |
$ref->start_controls_tab(
|
4222 |
'title_hover_tab',
|
4223 |
[
|
4224 |
-
'label' =>
|
4225 |
]
|
4226 |
);
|
4227 |
|
@@ -4229,7 +4231,7 @@ class rtTPGElementorHelper {
|
|
4229 |
$ref->add_control(
|
4230 |
'title_hover_color',
|
4231 |
[
|
4232 |
-
'label' =>
|
4233 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4234 |
'selectors' => [
|
4235 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .entry-title:hover, {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .entry-title a:hover' => 'color: {{VALUE}} !important',
|
@@ -4240,7 +4242,7 @@ class rtTPGElementorHelper {
|
|
4240 |
$ref->add_control(
|
4241 |
'title_bg_color_hover',
|
4242 |
[
|
4243 |
-
'label' =>
|
4244 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4245 |
'selectors' => [
|
4246 |
'{{WRAPPER}} .tpg-el-main-wrapper .entry-title:hover' => 'background-color: {{VALUE}} !important',
|
@@ -4253,7 +4255,7 @@ class rtTPGElementorHelper {
|
|
4253 |
$ref->start_controls_tab(
|
4254 |
'title_box_hover_tab',
|
4255 |
[
|
4256 |
-
'label' =>
|
4257 |
]
|
4258 |
);
|
4259 |
|
@@ -4261,7 +4263,7 @@ class rtTPGElementorHelper {
|
|
4261 |
$ref->add_control(
|
4262 |
'title_color_box_hover',
|
4263 |
[
|
4264 |
-
'label' =>
|
4265 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4266 |
'selectors' => [
|
4267 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title, {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title a' => 'color: {{VALUE}}',
|
@@ -4272,7 +4274,7 @@ class rtTPGElementorHelper {
|
|
4272 |
$ref->add_control(
|
4273 |
'title_bg_color_box_hover',
|
4274 |
[
|
4275 |
-
'label' =>
|
4276 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4277 |
'selectors' => [
|
4278 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title' => 'background-color: {{VALUE}}',
|
@@ -4283,7 +4285,7 @@ class rtTPGElementorHelper {
|
|
4283 |
$ref->add_control(
|
4284 |
'title_border_color_hover',
|
4285 |
[
|
4286 |
-
'label' =>
|
4287 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4288 |
'selectors' => [
|
4289 |
'{{WRAPPER}} .rt-tpg-container .rt-holder:hover .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}',
|
@@ -4313,7 +4315,7 @@ class rtTPGElementorHelper {
|
|
4313 |
$ref->start_controls_section(
|
4314 |
'excerpt_style',
|
4315 |
[
|
4316 |
-
'label' =>
|
4317 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
4318 |
'condition' => [
|
4319 |
'show_excerpt' => 'show',
|
@@ -4333,7 +4335,7 @@ class rtTPGElementorHelper {
|
|
4333 |
$ref->add_responsive_control(
|
4334 |
'excerpt_spacing',
|
4335 |
[
|
4336 |
-
'label' =>
|
4337 |
'type' => Controls_Manager::DIMENSIONS,
|
4338 |
'size_units' => [ 'px' ],
|
4339 |
'selectors' => [
|
@@ -4353,23 +4355,23 @@ class rtTPGElementorHelper {
|
|
4353 |
$ref->add_responsive_control(
|
4354 |
'content_alignment',
|
4355 |
[
|
4356 |
-
'label' =>
|
4357 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
4358 |
'options' => [
|
4359 |
'left' => [
|
4360 |
-
'title' =>
|
4361 |
'icon' => 'eicon-text-align-left',
|
4362 |
],
|
4363 |
'center' => [
|
4364 |
-
'title' =>
|
4365 |
'icon' => 'eicon-text-align-center',
|
4366 |
],
|
4367 |
'right' => [
|
4368 |
-
'title' =>
|
4369 |
'icon' => 'eicon-text-align-right',
|
4370 |
],
|
4371 |
'justify' => [
|
4372 |
-
'title' =>
|
4373 |
'icon' => 'eicon-text-align-justify',
|
4374 |
],
|
4375 |
],
|
@@ -4389,7 +4391,7 @@ class rtTPGElementorHelper {
|
|
4389 |
$ref->start_controls_tab(
|
4390 |
'excerpt_normal_tab',
|
4391 |
[
|
4392 |
-
'label' =>
|
4393 |
]
|
4394 |
);
|
4395 |
|
@@ -4397,7 +4399,7 @@ class rtTPGElementorHelper {
|
|
4397 |
$ref->add_control(
|
4398 |
'excerpt_color',
|
4399 |
[
|
4400 |
-
'label' =>
|
4401 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4402 |
'selectors' => [
|
4403 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}}',
|
@@ -4408,7 +4410,7 @@ class rtTPGElementorHelper {
|
|
4408 |
$ref->add_control(
|
4409 |
'excerpt_border',
|
4410 |
[
|
4411 |
-
'label' =>
|
4412 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4413 |
'selectors' => [
|
4414 |
'{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder .rt-el-post-meta::before' => 'background: {{VALUE}}',
|
@@ -4425,7 +4427,7 @@ class rtTPGElementorHelper {
|
|
4425 |
$ref->start_controls_tab(
|
4426 |
'excerpt_hover_tab',
|
4427 |
[
|
4428 |
-
'label' =>
|
4429 |
]
|
4430 |
);
|
4431 |
|
@@ -4433,7 +4435,7 @@ class rtTPGElementorHelper {
|
|
4433 |
$ref->add_control(
|
4434 |
'excerpt_hover_color',
|
4435 |
[
|
4436 |
-
'label' =>
|
4437 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4438 |
'selectors' => [
|
4439 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}} !important',
|
@@ -4444,7 +4446,7 @@ class rtTPGElementorHelper {
|
|
4444 |
$ref->add_control(
|
4445 |
'excerpt_border_hover',
|
4446 |
[
|
4447 |
-
'label' =>
|
4448 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4449 |
'selectors' => [
|
4450 |
'{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder:hover .rt-el-post-meta::before' => 'background: {{VALUE}}',
|
@@ -4474,7 +4476,7 @@ class rtTPGElementorHelper {
|
|
4474 |
$ref->start_controls_section(
|
4475 |
'post_meta_style',
|
4476 |
[
|
4477 |
-
'label' =>
|
4478 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
4479 |
'condition' => [
|
4480 |
'show_meta' => 'show',
|
@@ -4494,7 +4496,7 @@ class rtTPGElementorHelper {
|
|
4494 |
$ref->add_responsive_control(
|
4495 |
'meta_spacing',
|
4496 |
[
|
4497 |
-
'label' =>
|
4498 |
'type' => Controls_Manager::DIMENSIONS,
|
4499 |
'size_units' => [ 'px' ],
|
4500 |
'selectors' => [
|
@@ -4514,7 +4516,7 @@ class rtTPGElementorHelper {
|
|
4514 |
$ref->add_control(
|
4515 |
'separator_cat_heading',
|
4516 |
[
|
4517 |
-
'label' =>
|
4518 |
'type' => \Elementor\Controls_Manager::HEADING,
|
4519 |
'classes' => 'tpg-control-type-heading',
|
4520 |
'condition' => [
|
@@ -4537,7 +4539,7 @@ class rtTPGElementorHelper {
|
|
4537 |
$ref->add_control(
|
4538 |
'category_margin_bottom',
|
4539 |
[
|
4540 |
-
'label' =>
|
4541 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
4542 |
'min' => 0,
|
4543 |
'max' => 50,
|
@@ -4555,7 +4557,7 @@ class rtTPGElementorHelper {
|
|
4555 |
$ref->add_responsive_control(
|
4556 |
'category_radius',
|
4557 |
[
|
4558 |
-
'label' =>
|
4559 |
'type' => Controls_Manager::DIMENSIONS,
|
4560 |
'size_units' => [ 'px' ],
|
4561 |
'selectors' => [
|
@@ -4585,7 +4587,7 @@ class rtTPGElementorHelper {
|
|
4585 |
$ref->start_controls_tab(
|
4586 |
'meta_info_normal_tab',
|
4587 |
[
|
4588 |
-
'label' =>
|
4589 |
]
|
4590 |
);
|
4591 |
|
@@ -4594,7 +4596,7 @@ class rtTPGElementorHelper {
|
|
4594 |
$ref->add_control(
|
4595 |
'meta_info_color',
|
4596 |
[
|
4597 |
-
'label' =>
|
4598 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4599 |
'selectors' => [
|
4600 |
'{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags span' => 'color: {{VALUE}}',
|
@@ -4605,7 +4607,7 @@ class rtTPGElementorHelper {
|
|
4605 |
$ref->add_control(
|
4606 |
'meta_link_color',
|
4607 |
[
|
4608 |
-
'label' =>
|
4609 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4610 |
'selectors' => [
|
4611 |
'{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags a' => 'color: {{VALUE}}',
|
@@ -4616,7 +4618,7 @@ class rtTPGElementorHelper {
|
|
4616 |
$ref->add_control(
|
4617 |
'meta_separator_color',
|
4618 |
[
|
4619 |
-
'label' =>
|
4620 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4621 |
'selectors' => [
|
4622 |
'{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .separator' => 'color: {{VALUE}}',
|
@@ -4630,7 +4632,7 @@ class rtTPGElementorHelper {
|
|
4630 |
$ref->add_control(
|
4631 |
'meta_icon_color',
|
4632 |
[
|
4633 |
-
'label' =>
|
4634 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4635 |
'selectors' => [
|
4636 |
'{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags i' => 'color: {{VALUE}}',
|
@@ -4641,7 +4643,7 @@ class rtTPGElementorHelper {
|
|
4641 |
$ref->add_control(
|
4642 |
'separate_category_color',
|
4643 |
[
|
4644 |
-
'label' =>
|
4645 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4646 |
'separator' => 'before',
|
4647 |
'selectors' => [
|
@@ -4654,7 +4656,7 @@ class rtTPGElementorHelper {
|
|
4654 |
$ref->add_control(
|
4655 |
'separate_category_bg',
|
4656 |
[
|
4657 |
-
'label' =>
|
4658 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4659 |
'selectors' => [
|
4660 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links' => 'background-color: {{VALUE}};padding: 3px 8px 1px;',
|
@@ -4667,7 +4669,7 @@ class rtTPGElementorHelper {
|
|
4667 |
$ref->add_control(
|
4668 |
'separate_category_icon_color',
|
4669 |
[
|
4670 |
-
'label' =>
|
4671 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4672 |
'selectors' => [
|
4673 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links i' => 'color: {{VALUE}}',
|
@@ -4684,7 +4686,7 @@ class rtTPGElementorHelper {
|
|
4684 |
$ref->start_controls_tab(
|
4685 |
'meta_info_hover_tab',
|
4686 |
[
|
4687 |
-
'label' =>
|
4688 |
]
|
4689 |
);
|
4690 |
|
@@ -4694,7 +4696,7 @@ class rtTPGElementorHelper {
|
|
4694 |
$ref->add_control(
|
4695 |
'meta_link_colo_hover',
|
4696 |
[
|
4697 |
-
'label' =>
|
4698 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4699 |
'selectors' => [
|
4700 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .post-meta-tags a:hover' => 'color: {{VALUE}}',
|
@@ -4705,7 +4707,7 @@ class rtTPGElementorHelper {
|
|
4705 |
$ref->add_control(
|
4706 |
'separate_category_color_hover',
|
4707 |
[
|
4708 |
-
'label' =>
|
4709 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4710 |
'separator' => 'before',
|
4711 |
'selectors' => [
|
@@ -4718,7 +4720,7 @@ class rtTPGElementorHelper {
|
|
4718 |
$ref->add_control(
|
4719 |
'separate_category_bg_hover',
|
4720 |
[
|
4721 |
-
'label' =>
|
4722 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4723 |
'selectors' => [
|
4724 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links:hover' => 'background-color: {{VALUE}};padding: 3px 8px;',
|
@@ -4734,7 +4736,7 @@ class rtTPGElementorHelper {
|
|
4734 |
$ref->start_controls_tab(
|
4735 |
'meta_info_box_hover_tab',
|
4736 |
[
|
4737 |
-
'label' =>
|
4738 |
]
|
4739 |
);
|
4740 |
|
@@ -4744,7 +4746,7 @@ class rtTPGElementorHelper {
|
|
4744 |
$ref->add_control(
|
4745 |
'meta_link_colo_box_hover',
|
4746 |
[
|
4747 |
-
'label' =>
|
4748 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4749 |
'selectors' => [
|
4750 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags *' => 'color: {{VALUE}}',
|
@@ -4755,7 +4757,7 @@ class rtTPGElementorHelper {
|
|
4755 |
$ref->add_control(
|
4756 |
'separate_category_color_box_hover',
|
4757 |
[
|
4758 |
-
'label' =>
|
4759 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4760 |
'separator' => 'before',
|
4761 |
'selectors' => [
|
@@ -4767,7 +4769,7 @@ class rtTPGElementorHelper {
|
|
4767 |
$ref->add_control(
|
4768 |
'separate_category_bg_box_hover',
|
4769 |
[
|
4770 |
-
'label' =>
|
4771 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4772 |
'selectors' => [
|
4773 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category.style1 .categories-links' => 'background-color: {{VALUE}};padding: 3px 8px;',
|
@@ -4781,7 +4783,7 @@ class rtTPGElementorHelper {
|
|
4781 |
$ref->add_control(
|
4782 |
'separate_category_icon_color_box_hover',
|
4783 |
[
|
4784 |
-
'label' =>
|
4785 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4786 |
'selectors' => [
|
4787 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category .categories-links i' => 'color: {{VALUE}}',
|
@@ -4812,7 +4814,7 @@ class rtTPGElementorHelper {
|
|
4812 |
$ref->start_controls_section(
|
4813 |
'readmore_button_style',
|
4814 |
[
|
4815 |
-
'label' =>
|
4816 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
4817 |
'condition' => [
|
4818 |
'show_read_more' => 'show',
|
@@ -4833,7 +4835,7 @@ class rtTPGElementorHelper {
|
|
4833 |
$ref->add_responsive_control(
|
4834 |
'readmore_spacing',
|
4835 |
[
|
4836 |
-
'label' =>
|
4837 |
'type' => Controls_Manager::DIMENSIONS,
|
4838 |
'size_units' => [ 'px' ],
|
4839 |
'allowed_dimensions' => 'all',
|
@@ -4853,7 +4855,7 @@ class rtTPGElementorHelper {
|
|
4853 |
$ref->add_responsive_control(
|
4854 |
'readmore_padding',
|
4855 |
[
|
4856 |
-
'label' =>
|
4857 |
'type' => Controls_Manager::DIMENSIONS,
|
4858 |
'size_units' => [ 'px' ],
|
4859 |
'selectors' => [
|
@@ -4869,19 +4871,19 @@ class rtTPGElementorHelper {
|
|
4869 |
$ref->add_responsive_control(
|
4870 |
'readmore_btn_alignment',
|
4871 |
[
|
4872 |
-
'label' =>
|
4873 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
4874 |
'options' => [
|
4875 |
'left' => [
|
4876 |
-
'title' =>
|
4877 |
'icon' => 'eicon-text-align-left',
|
4878 |
],
|
4879 |
'center' => [
|
4880 |
-
'title' =>
|
4881 |
'icon' => 'eicon-text-align-center',
|
4882 |
],
|
4883 |
'right' => [
|
4884 |
-
'title' =>
|
4885 |
'icon' => 'eicon-text-align-right',
|
4886 |
],
|
4887 |
],
|
@@ -4895,12 +4897,12 @@ class rtTPGElementorHelper {
|
|
4895 |
$ref->add_control(
|
4896 |
'readmore_icon_position',
|
4897 |
[
|
4898 |
-
'label' =>
|
4899 |
'type' => \Elementor\Controls_Manager::SELECT,
|
4900 |
'default' => 'right',
|
4901 |
'options' => [
|
4902 |
-
'left' =>
|
4903 |
-
'right' =>
|
4904 |
],
|
4905 |
'separator' => 'before',
|
4906 |
'condition' => [
|
@@ -4912,7 +4914,7 @@ class rtTPGElementorHelper {
|
|
4912 |
$ref->add_responsive_control(
|
4913 |
'readmore_icon_size',
|
4914 |
[
|
4915 |
-
'label' =>
|
4916 |
'type' => Controls_Manager::SLIDER,
|
4917 |
'size_units' => [ 'px' ],
|
4918 |
'range' => [
|
@@ -4934,7 +4936,7 @@ class rtTPGElementorHelper {
|
|
4934 |
$ref->add_responsive_control(
|
4935 |
'readmore_icon_y_position',
|
4936 |
[
|
4937 |
-
'label' =>
|
4938 |
'type' => Controls_Manager::SLIDER,
|
4939 |
'size_units' => [ 'px' ],
|
4940 |
'range' => [
|
@@ -4961,14 +4963,14 @@ class rtTPGElementorHelper {
|
|
4961 |
$ref->start_controls_tab(
|
4962 |
'readmore_style_normal_tab',
|
4963 |
[
|
4964 |
-
'label' =>
|
4965 |
]
|
4966 |
);
|
4967 |
|
4968 |
$ref->add_control(
|
4969 |
'readmore_text_color',
|
4970 |
[
|
4971 |
-
'label' =>
|
4972 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4973 |
'selectors' => [
|
4974 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'color: {{VALUE}}',
|
@@ -4979,7 +4981,7 @@ class rtTPGElementorHelper {
|
|
4979 |
$ref->add_control(
|
4980 |
'readmore_icon_color',
|
4981 |
[
|
4982 |
-
'label' =>
|
4983 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4984 |
'selectors' => [
|
4985 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'color: {{VALUE}}',
|
@@ -4993,7 +4995,7 @@ class rtTPGElementorHelper {
|
|
4993 |
$ref->add_control(
|
4994 |
'readmore_bg',
|
4995 |
[
|
4996 |
-
'label' =>
|
4997 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4998 |
'selectors' => [
|
4999 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'background-color: {{VALUE}}',
|
@@ -5007,7 +5009,7 @@ class rtTPGElementorHelper {
|
|
5007 |
$ref->add_responsive_control(
|
5008 |
'readmore_icon_margin',
|
5009 |
[
|
5010 |
-
'label' =>
|
5011 |
'type' => Controls_Manager::DIMENSIONS,
|
5012 |
'size_units' => [ 'px' ],
|
5013 |
'allowed_dimensions' => 'horizontal',
|
@@ -5030,7 +5032,7 @@ class rtTPGElementorHelper {
|
|
5030 |
$ref->add_responsive_control(
|
5031 |
'border_radius',
|
5032 |
[
|
5033 |
-
'label' =>
|
5034 |
'type' => Controls_Manager::DIMENSIONS,
|
5035 |
'size_units' => [ 'px', '%', 'em' ],
|
5036 |
'allowed_dimensions' => 'all',
|
@@ -5047,7 +5049,7 @@ class rtTPGElementorHelper {
|
|
5047 |
\Elementor\Group_Control_Border::get_type(),
|
5048 |
[
|
5049 |
'name' => 'readmore_border',
|
5050 |
-
'label' =>
|
5051 |
'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a',
|
5052 |
'fields_options' => [
|
5053 |
'border' => [
|
@@ -5079,14 +5081,14 @@ class rtTPGElementorHelper {
|
|
5079 |
$ref->start_controls_tab(
|
5080 |
'readmore_style_hover_tab',
|
5081 |
[
|
5082 |
-
'label' =>
|
5083 |
]
|
5084 |
);
|
5085 |
|
5086 |
$ref->add_control(
|
5087 |
'readmore_text_color_hover',
|
5088 |
[
|
5089 |
-
'label' =>
|
5090 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5091 |
'selectors' => [
|
5092 |
'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'color: {{VALUE}}',
|
@@ -5097,7 +5099,7 @@ class rtTPGElementorHelper {
|
|
5097 |
$ref->add_control(
|
5098 |
'readmore_icon_color_hover',
|
5099 |
[
|
5100 |
-
'label' =>
|
5101 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5102 |
'selectors' => [
|
5103 |
'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover i' => 'color: {{VALUE}}',
|
@@ -5111,7 +5113,7 @@ class rtTPGElementorHelper {
|
|
5111 |
$ref->add_control(
|
5112 |
'readmore_bg_hover',
|
5113 |
[
|
5114 |
-
'label' =>
|
5115 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5116 |
'selectors' => [
|
5117 |
'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'background-color: {{VALUE}}',
|
@@ -5125,7 +5127,7 @@ class rtTPGElementorHelper {
|
|
5125 |
$ref->add_responsive_control(
|
5126 |
'readmore_icon_margin_hover',
|
5127 |
[
|
5128 |
-
'label' =>
|
5129 |
'type' => Controls_Manager::DIMENSIONS,
|
5130 |
'size_units' => [ 'px' ],
|
5131 |
'allowed_dimensions' => 'horizontal',
|
@@ -5148,7 +5150,7 @@ class rtTPGElementorHelper {
|
|
5148 |
$ref->add_responsive_control(
|
5149 |
'border_radius_hover',
|
5150 |
[
|
5151 |
-
'label' =>
|
5152 |
'type' => Controls_Manager::DIMENSIONS,
|
5153 |
'size_units' => [ 'px', '%', 'em' ],
|
5154 |
'allowed_dimensions' => 'all',
|
@@ -5165,7 +5167,7 @@ class rtTPGElementorHelper {
|
|
5165 |
\Elementor\Group_Control_Border::get_type(),
|
5166 |
[
|
5167 |
'name' => 'readmore_border_hover',
|
5168 |
-
'label' =>
|
5169 |
'selector' => 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover',
|
5170 |
'fields_options' => [
|
5171 |
'border' => [
|
@@ -5198,14 +5200,14 @@ class rtTPGElementorHelper {
|
|
5198 |
$ref->start_controls_tab(
|
5199 |
'readmore_style_box_hover_tab',
|
5200 |
[
|
5201 |
-
'label' =>
|
5202 |
]
|
5203 |
);
|
5204 |
|
5205 |
$ref->add_control(
|
5206 |
'readmore_text_color_box_hover',
|
5207 |
[
|
5208 |
-
'label' =>
|
5209 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5210 |
'selectors' => [
|
5211 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'color: {{VALUE}}',
|
@@ -5216,7 +5218,7 @@ class rtTPGElementorHelper {
|
|
5216 |
$ref->add_control(
|
5217 |
'readmore_icon_color_box_hover',
|
5218 |
[
|
5219 |
-
'label' =>
|
5220 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5221 |
'selectors' => [
|
5222 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a i' => 'color: {{VALUE}}',
|
@@ -5230,7 +5232,7 @@ class rtTPGElementorHelper {
|
|
5230 |
$ref->add_control(
|
5231 |
'readmore_bg_box_hover',
|
5232 |
[
|
5233 |
-
'label' =>
|
5234 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5235 |
'selectors' => [
|
5236 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'background-color: {{VALUE}}',
|
@@ -5245,7 +5247,7 @@ class rtTPGElementorHelper {
|
|
5245 |
\Elementor\Group_Control_Border::get_type(),
|
5246 |
[
|
5247 |
'name' => 'readmore_border_box_hover',
|
5248 |
-
'label' =>
|
5249 |
'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a',
|
5250 |
'condition' => [
|
5251 |
'readmore_btn_style' => 'default-style',
|
@@ -5271,7 +5273,7 @@ class rtTPGElementorHelper {
|
|
5271 |
$ref->start_controls_section(
|
5272 |
'pagination_loadmore_style',
|
5273 |
[
|
5274 |
-
'label' =>
|
5275 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
5276 |
'condition' => [
|
5277 |
'show_pagination' => 'show',
|
@@ -5318,7 +5320,7 @@ class rtTPGElementorHelper {
|
|
5318 |
$ref->add_responsive_control(
|
5319 |
'pagination_spacing',
|
5320 |
[
|
5321 |
-
'label' =>
|
5322 |
'type' => Controls_Manager::DIMENSIONS,
|
5323 |
'size_units' => [ 'px' ],
|
5324 |
'allowed_dimensions' => 'vertical',
|
@@ -5341,7 +5343,7 @@ class rtTPGElementorHelper {
|
|
5341 |
$ref->add_responsive_control(
|
5342 |
'pagination_padding',
|
5343 |
[
|
5344 |
-
'label' =>
|
5345 |
'type' => Controls_Manager::DIMENSIONS,
|
5346 |
'size_units' => [ 'px' ],
|
5347 |
'allowed_dimensions' => 'all',
|
@@ -5357,7 +5359,7 @@ class rtTPGElementorHelper {
|
|
5357 |
$ref->add_responsive_control(
|
5358 |
'pagination_border_radius',
|
5359 |
[
|
5360 |
-
'label' =>
|
5361 |
'type' => Controls_Manager::SLIDER,
|
5362 |
'size_units' => [ 'px', '%' ],
|
5363 |
'range' => [
|
@@ -5397,14 +5399,14 @@ class rtTPGElementorHelper {
|
|
5397 |
$ref->start_controls_tab(
|
5398 |
'pagination_style_normal_tab',
|
5399 |
[
|
5400 |
-
'label' =>
|
5401 |
]
|
5402 |
);
|
5403 |
|
5404 |
$ref->add_control(
|
5405 |
'pagination_color',
|
5406 |
[
|
5407 |
-
'label' =>
|
5408 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5409 |
'selectors' => [
|
5410 |
'{{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > a, {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'color: {{VALUE}}',
|
@@ -5418,7 +5420,7 @@ class rtTPGElementorHelper {
|
|
5418 |
$ref->add_control(
|
5419 |
'pagination_bg',
|
5420 |
[
|
5421 |
-
'label' =>
|
5422 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5423 |
'selectors' => [
|
5424 |
'{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'background-color: {{VALUE}}',
|
@@ -5432,7 +5434,7 @@ class rtTPGElementorHelper {
|
|
5432 |
$ref->add_control(
|
5433 |
'pagination_border_color',
|
5434 |
[
|
5435 |
-
'label' =>
|
5436 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5437 |
'selectors' => [
|
5438 |
'{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'border-color: {{VALUE}}',
|
@@ -5448,14 +5450,14 @@ class rtTPGElementorHelper {
|
|
5448 |
$ref->start_controls_tab(
|
5449 |
'pagination_style_hover_tab',
|
5450 |
[
|
5451 |
-
'label' =>
|
5452 |
]
|
5453 |
);
|
5454 |
|
5455 |
$ref->add_control(
|
5456 |
'pagination_color_hover',
|
5457 |
[
|
5458 |
-
'label' =>
|
5459 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5460 |
'selectors' => [
|
5461 |
'{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'color: {{VALUE}} !important',
|
@@ -5468,7 +5470,7 @@ class rtTPGElementorHelper {
|
|
5468 |
$ref->add_control(
|
5469 |
'pagination_bg_hover',
|
5470 |
[
|
5471 |
-
'label' =>
|
5472 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5473 |
'selectors' => [
|
5474 |
'{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'background-color: {{VALUE}} !important',
|
@@ -5481,7 +5483,7 @@ class rtTPGElementorHelper {
|
|
5481 |
$ref->add_control(
|
5482 |
'pagination_border_color_hover',
|
5483 |
[
|
5484 |
-
'label' =>
|
5485 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5486 |
'selectors' => [
|
5487 |
'{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'border-color: {{VALUE}} !important',
|
@@ -5498,21 +5500,21 @@ class rtTPGElementorHelper {
|
|
5498 |
$ref->start_controls_tab(
|
5499 |
'pagination_style_active_tab',
|
5500 |
[
|
5501 |
-
'label' =>
|
5502 |
]
|
5503 |
);
|
5504 |
|
5505 |
$ref->add_control(
|
5506 |
'pagination_color_active',
|
5507 |
[
|
5508 |
-
'label' =>
|
5509 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5510 |
'selectors' => [
|
5511 |
-
'{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
|
5512 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > span,
|
5513 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
|
5514 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
|
5515 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
|
5516 |
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'color: {{VALUE}} !important',
|
5517 |
'{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'color: {{VALUE}}',
|
5518 |
],
|
@@ -5523,14 +5525,14 @@ class rtTPGElementorHelper {
|
|
5523 |
$ref->add_control(
|
5524 |
'pagination_bg_active',
|
5525 |
[
|
5526 |
-
'label' =>
|
5527 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5528 |
'selectors' => [
|
5529 |
-
'{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
|
5530 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > span,
|
5531 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
|
5532 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
|
5533 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
|
5534 |
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'background-color: {{VALUE}} !important',
|
5535 |
'{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'background-color: {{VALUE}}',
|
5536 |
],
|
@@ -5540,14 +5542,14 @@ class rtTPGElementorHelper {
|
|
5540 |
$ref->add_control(
|
5541 |
'pagination_border_color_active',
|
5542 |
[
|
5543 |
-
'label' =>
|
5544 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5545 |
'selectors' => [
|
5546 |
-
'{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
|
5547 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > span,
|
5548 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
|
5549 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
|
5550 |
-
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
|
5551 |
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'border-color: {{VALUE}} !important',
|
5552 |
'{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'border-color: {{VALUE}}',
|
5553 |
],
|
@@ -5613,7 +5615,7 @@ class rtTPGElementorHelper {
|
|
5613 |
\Elementor\Group_Control_Typography::get_type(),
|
5614 |
[
|
5615 |
'name' => 'front_filter_typography',
|
5616 |
-
'label' =>
|
5617 |
'selector' => '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap, {{WRAPPER}} .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide',
|
5618 |
]
|
5619 |
);
|
@@ -5679,7 +5681,7 @@ class rtTPGElementorHelper {
|
|
5679 |
$ref->add_responsive_control(
|
5680 |
'filter_button_width',
|
5681 |
[
|
5682 |
-
'label' =>
|
5683 |
'type' => Controls_Manager::SLIDER,
|
5684 |
'size_units' => [ 'px', '%' ],
|
5685 |
'range' => [
|
@@ -5707,12 +5709,12 @@ class rtTPGElementorHelper {
|
|
5707 |
$ref->add_control(
|
5708 |
'border_style',
|
5709 |
[
|
5710 |
-
'label' =>
|
5711 |
'type' => \Elementor\Controls_Manager::SELECT,
|
5712 |
'default' => 'disable',
|
5713 |
'options' => [
|
5714 |
-
'disable' =>
|
5715 |
-
'enable' =>
|
5716 |
],
|
5717 |
'condition' => [
|
5718 |
'filter_type' => 'button',
|
@@ -5726,12 +5728,12 @@ class rtTPGElementorHelper {
|
|
5726 |
$ref->add_control(
|
5727 |
'filter_next_prev_btn',
|
5728 |
[
|
5729 |
-
'label' =>
|
5730 |
'type' => \Elementor\Controls_Manager::SELECT,
|
5731 |
'default' => 'visible',
|
5732 |
'options' => [
|
5733 |
-
'visible' =>
|
5734 |
-
'hidden' =>
|
5735 |
],
|
5736 |
'condition' => [
|
5737 |
'filter_type' => 'button',
|
@@ -5775,7 +5777,7 @@ class rtTPGElementorHelper {
|
|
5775 |
$ref->add_responsive_control(
|
5776 |
'filter_btn_radius',
|
5777 |
[
|
5778 |
-
'label' =>
|
5779 |
'type' => Controls_Manager::DIMENSIONS,
|
5780 |
'size_units' => [ 'px' ],
|
5781 |
'selectors' => [
|
@@ -5798,14 +5800,14 @@ class rtTPGElementorHelper {
|
|
5798 |
$ref->start_controls_tab(
|
5799 |
'frontend_filter_style_normal_tab',
|
5800 |
[
|
5801 |
-
'label' =>
|
5802 |
]
|
5803 |
);
|
5804 |
|
5805 |
$ref->add_control(
|
5806 |
'filter_color',
|
5807 |
[
|
5808 |
-
'label' =>
|
5809 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5810 |
'selectors' => [
|
5811 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'color: {{VALUE}}',
|
@@ -5819,7 +5821,7 @@ class rtTPGElementorHelper {
|
|
5819 |
$ref->add_control(
|
5820 |
'filter_bg_color',
|
5821 |
[
|
5822 |
-
'label' =>
|
5823 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5824 |
'selectors' => [
|
5825 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'background-color: {{VALUE}}',
|
@@ -5832,7 +5834,7 @@ class rtTPGElementorHelper {
|
|
5832 |
$ref->add_control(
|
5833 |
'filter_border_color',
|
5834 |
[
|
5835 |
-
'label' =>
|
5836 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5837 |
'selectors' => [
|
5838 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'border-color: {{VALUE}}',
|
@@ -5847,7 +5849,7 @@ class rtTPGElementorHelper {
|
|
5847 |
$ref->add_control(
|
5848 |
'filter_search_bg',
|
5849 |
[
|
5850 |
-
'label' =>
|
5851 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5852 |
'selectors' => [
|
5853 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'background-color: {{VALUE}}',
|
@@ -5862,7 +5864,7 @@ class rtTPGElementorHelper {
|
|
5862 |
$ref->add_control(
|
5863 |
'sub_menu_color_heading',
|
5864 |
[
|
5865 |
-
'label' =>
|
5866 |
'type' => \Elementor\Controls_Manager::HEADING,
|
5867 |
'separator' => 'before',
|
5868 |
'classes' => 'tpg-control-type-heading',
|
@@ -5875,7 +5877,7 @@ class rtTPGElementorHelper {
|
|
5875 |
$ref->add_control(
|
5876 |
'sub_menu_bg_color',
|
5877 |
[
|
5878 |
-
'label' =>
|
5879 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5880 |
'selectors' => [
|
5881 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown' => 'background-color: {{VALUE}}',
|
@@ -5889,7 +5891,7 @@ class rtTPGElementorHelper {
|
|
5889 |
$ref->add_control(
|
5890 |
'sub_menu_color',
|
5891 |
[
|
5892 |
-
'label' =>
|
5893 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5894 |
'selectors' => [
|
5895 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'color: {{VALUE}}',
|
@@ -5903,7 +5905,7 @@ class rtTPGElementorHelper {
|
|
5903 |
$ref->add_control(
|
5904 |
'sub_menu_border_bottom',
|
5905 |
[
|
5906 |
-
'label' =>
|
5907 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5908 |
'selectors' => [
|
5909 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'border-bottom-color: {{VALUE}}',
|
@@ -5917,7 +5919,7 @@ class rtTPGElementorHelper {
|
|
5917 |
$ref->add_control(
|
5918 |
'filter_nav_color',
|
5919 |
[
|
5920 |
-
'label' =>
|
5921 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5922 |
'selectors' => [
|
5923 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'color: {{VALUE}}',
|
@@ -5932,7 +5934,7 @@ class rtTPGElementorHelper {
|
|
5932 |
$ref->add_control(
|
5933 |
'filter_nav_bg',
|
5934 |
[
|
5935 |
-
'label' =>
|
5936 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5937 |
'selectors' => [
|
5938 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'background-color: {{VALUE}}',
|
@@ -5947,7 +5949,7 @@ class rtTPGElementorHelper {
|
|
5947 |
$ref->add_control(
|
5948 |
'filter_nav_border',
|
5949 |
[
|
5950 |
-
'label' =>
|
5951 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5952 |
'selectors' => [
|
5953 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'border-color: {{VALUE}}',
|
@@ -5965,14 +5967,14 @@ class rtTPGElementorHelper {
|
|
5965 |
$ref->start_controls_tab(
|
5966 |
'frontend_filter_style_hover_tab',
|
5967 |
[
|
5968 |
-
'label' =>
|
5969 |
]
|
5970 |
);
|
5971 |
|
5972 |
$ref->add_control(
|
5973 |
'filter_color_hover',
|
5974 |
[
|
5975 |
-
'label' =>
|
5976 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5977 |
'selectors' => [
|
5978 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'color: {{VALUE}}',
|
@@ -5985,7 +5987,7 @@ class rtTPGElementorHelper {
|
|
5985 |
$ref->add_control(
|
5986 |
'filter_bg_color_hover',
|
5987 |
[
|
5988 |
-
'label' =>
|
5989 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5990 |
'selectors' => [
|
5991 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'background-color: {{VALUE}}',
|
@@ -5998,7 +6000,7 @@ class rtTPGElementorHelper {
|
|
5998 |
$ref->add_control(
|
5999 |
'filter_border_color_hover',
|
6000 |
[
|
6001 |
-
'label' =>
|
6002 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6003 |
'selectors' => [
|
6004 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'border-color: {{VALUE}}',
|
@@ -6013,7 +6015,7 @@ class rtTPGElementorHelper {
|
|
6013 |
$ref->add_control(
|
6014 |
'filter_search_bg_hover',
|
6015 |
[
|
6016 |
-
'label' =>
|
6017 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6018 |
'selectors' => [
|
6019 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input:hover' => 'background-color: {{VALUE}}',
|
@@ -6028,7 +6030,7 @@ class rtTPGElementorHelper {
|
|
6028 |
$ref->add_control(
|
6029 |
'sub_menu_color_heading_hover',
|
6030 |
[
|
6031 |
-
'label' =>
|
6032 |
'type' => \Elementor\Controls_Manager::HEADING,
|
6033 |
'separator' => 'before',
|
6034 |
'classes' => 'tpg-control-type-heading',
|
@@ -6041,7 +6043,7 @@ class rtTPGElementorHelper {
|
|
6041 |
$ref->add_control(
|
6042 |
'sub_menu_bg_color_hover',
|
6043 |
[
|
6044 |
-
'label' =>
|
6045 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6046 |
'selectors' => [
|
6047 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'background-color: {{VALUE}}',
|
@@ -6055,7 +6057,7 @@ class rtTPGElementorHelper {
|
|
6055 |
$ref->add_control(
|
6056 |
'sub_menu_color_hover',
|
6057 |
[
|
6058 |
-
'label' =>
|
6059 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6060 |
'selectors' => [
|
6061 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'color: {{VALUE}}',
|
@@ -6069,7 +6071,7 @@ class rtTPGElementorHelper {
|
|
6069 |
$ref->add_control(
|
6070 |
'sub_menu_border_bottom_hover',
|
6071 |
[
|
6072 |
-
'label' =>
|
6073 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6074 |
'selectors' => [
|
6075 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'border-bottom-color: {{VALUE}}',
|
@@ -6083,7 +6085,7 @@ class rtTPGElementorHelper {
|
|
6083 |
$ref->add_control(
|
6084 |
'filter_nav_color_hover',
|
6085 |
[
|
6086 |
-
'label' =>
|
6087 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6088 |
'selectors' => [
|
6089 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'color: {{VALUE}}',
|
@@ -6098,7 +6100,7 @@ class rtTPGElementorHelper {
|
|
6098 |
$ref->add_control(
|
6099 |
'filter_nav_bg_hover',
|
6100 |
[
|
6101 |
-
'label' =>
|
6102 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6103 |
'selectors' => [
|
6104 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'background-color: {{VALUE}}',
|
@@ -6113,7 +6115,7 @@ class rtTPGElementorHelper {
|
|
6113 |
$ref->add_control(
|
6114 |
'filter_nav_border_hover',
|
6115 |
[
|
6116 |
-
'label' =>
|
6117 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6118 |
'selectors' => [
|
6119 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'border-color: {{VALUE}}',
|
@@ -6161,7 +6163,8 @@ class rtTPGElementorHelper {
|
|
6161 |
}
|
6162 |
|
6163 |
/**
|
6164 |
-
|
|
|
6165 |
*
|
6166 |
* @param $ref
|
6167 |
* @param $prefix
|
@@ -6170,15 +6173,15 @@ class rtTPGElementorHelper {
|
|
6170 |
$ref->add_control(
|
6171 |
'social_icon_style',
|
6172 |
[
|
6173 |
-
'label' =>
|
6174 |
'type' => \Elementor\Controls_Manager::SELECT,
|
6175 |
'default' => 'default',
|
6176 |
'options' => [
|
6177 |
-
'default' =>
|
6178 |
-
'different_color' =>
|
6179 |
-
'custom' =>
|
6180 |
],
|
6181 |
-
'description' =>
|
6182 |
]
|
6183 |
);
|
6184 |
|
@@ -6188,7 +6191,7 @@ class rtTPGElementorHelper {
|
|
6188 |
$ref->add_responsive_control(
|
6189 |
'social_icon_margin',
|
6190 |
[
|
6191 |
-
'label' =>
|
6192 |
'type' => Controls_Manager::DIMENSIONS,
|
6193 |
'size_units' => [ 'px' ],
|
6194 |
'allowed_dimensions' => 'all',
|
@@ -6201,7 +6204,7 @@ class rtTPGElementorHelper {
|
|
6201 |
$ref->add_responsive_control(
|
6202 |
'social_wrapper_margin',
|
6203 |
[
|
6204 |
-
'label' =>
|
6205 |
'type' => Controls_Manager::DIMENSIONS,
|
6206 |
'size_units' => [ 'px' ],
|
6207 |
'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
|
@@ -6221,7 +6224,7 @@ class rtTPGElementorHelper {
|
|
6221 |
$ref->add_responsive_control(
|
6222 |
'social_icon_radius',
|
6223 |
[
|
6224 |
-
'label' =>
|
6225 |
'type' => Controls_Manager::DIMENSIONS,
|
6226 |
'size_units' => [ 'px', '%', 'em' ],
|
6227 |
'allowed_dimensions' => 'all',
|
@@ -6241,7 +6244,7 @@ class rtTPGElementorHelper {
|
|
6241 |
$ref->add_control(
|
6242 |
'icon_width_height',
|
6243 |
[
|
6244 |
-
'label' =>
|
6245 |
'type' => \Elementor\Controls_Manager::IMAGE_DIMENSIONS,
|
6246 |
'default' => [
|
6247 |
'width' => '',
|
@@ -6250,7 +6253,7 @@ class rtTPGElementorHelper {
|
|
6250 |
'selectors' => [
|
6251 |
'{{WRAPPER}} .rt-tpg-social-share a i' => 'width:{{width}}px; height:{{height}}px; line-height:{{height}}px; text-align:center',
|
6252 |
],
|
6253 |
-
'description' =>
|
6254 |
'classes' => 'should-show-title',
|
6255 |
]
|
6256 |
);
|
@@ -6258,7 +6261,7 @@ class rtTPGElementorHelper {
|
|
6258 |
$ref->add_responsive_control(
|
6259 |
'icon_font_size',
|
6260 |
[
|
6261 |
-
'label' =>
|
6262 |
'type' => Controls_Manager::SLIDER,
|
6263 |
'size_units' => [ 'px' ],
|
6264 |
'range' => [
|
@@ -6282,7 +6285,7 @@ class rtTPGElementorHelper {
|
|
6282 |
$ref->start_controls_tab(
|
6283 |
'social_share_normal_tab',
|
6284 |
[
|
6285 |
-
'label' =>
|
6286 |
]
|
6287 |
);
|
6288 |
//TODO: Normal Tab
|
@@ -6291,7 +6294,7 @@ class rtTPGElementorHelper {
|
|
6291 |
$ref->add_control(
|
6292 |
'social_icon_color',
|
6293 |
[
|
6294 |
-
'label' =>
|
6295 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6296 |
'selectors' => [
|
6297 |
'{{WRAPPER}} .rt-tpg-social-share a i' => 'color: {{VALUE}}',
|
@@ -6305,7 +6308,7 @@ class rtTPGElementorHelper {
|
|
6305 |
$ref->add_control(
|
6306 |
'social_icon_bg_color',
|
6307 |
[
|
6308 |
-
'label' =>
|
6309 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6310 |
'selectors' => [
|
6311 |
'{{WRAPPER}} .rt-tpg-social-share a i' => 'background-color: {{VALUE}}',
|
@@ -6321,7 +6324,7 @@ class rtTPGElementorHelper {
|
|
6321 |
$ref->add_control(
|
6322 |
$ss . '_social_icon_color',
|
6323 |
[
|
6324 |
-
'label' => ucwords( $ss ) .
|
6325 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6326 |
'selectors' => [
|
6327 |
'{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'color: {{VALUE}}',
|
@@ -6335,7 +6338,7 @@ class rtTPGElementorHelper {
|
|
6335 |
$ref->add_control(
|
6336 |
$ss . '_social_icon_bg_color',
|
6337 |
[
|
6338 |
-
'label' =>
|
6339 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6340 |
'selectors' => [
|
6341 |
'{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'background-color: {{VALUE}}',
|
@@ -6352,7 +6355,7 @@ class rtTPGElementorHelper {
|
|
6352 |
\Elementor\Group_Control_Border::get_type(),
|
6353 |
[
|
6354 |
'name' => 'social_icon_border',
|
6355 |
-
'label' =>
|
6356 |
'selector' => '{{WRAPPER}} .rt-tpg-social-share a i',
|
6357 |
]
|
6358 |
);
|
@@ -6362,7 +6365,7 @@ class rtTPGElementorHelper {
|
|
6362 |
$ref->start_controls_tab(
|
6363 |
'socia_hover_tab',
|
6364 |
[
|
6365 |
-
'label' =>
|
6366 |
]
|
6367 |
);
|
6368 |
|
@@ -6371,7 +6374,7 @@ class rtTPGElementorHelper {
|
|
6371 |
$ref->add_control(
|
6372 |
'social_icon_color_hover',
|
6373 |
[
|
6374 |
-
'label' =>
|
6375 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6376 |
'selectors' => [
|
6377 |
'{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'color: {{VALUE}}',
|
@@ -6385,7 +6388,7 @@ class rtTPGElementorHelper {
|
|
6385 |
$ref->add_control(
|
6386 |
'social_icon_bg_color_hover',
|
6387 |
[
|
6388 |
-
'label' =>
|
6389 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6390 |
'selectors' => [
|
6391 |
'{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'background-color: {{VALUE}}',
|
@@ -6400,7 +6403,7 @@ class rtTPGElementorHelper {
|
|
6400 |
$ref->add_control(
|
6401 |
$ss . '_social_icon_color_hover',
|
6402 |
[
|
6403 |
-
'label' => ucwords( $ss ) .
|
6404 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6405 |
'selectors' => [
|
6406 |
'{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ':hover i' => 'color: {{VALUE}}',
|
@@ -6414,7 +6417,7 @@ class rtTPGElementorHelper {
|
|
6414 |
$ref->add_control(
|
6415 |
$ss . '_social_icon_bg_color_hover',
|
6416 |
[
|
6417 |
-
'label' =>
|
6418 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6419 |
'selectors' => [
|
6420 |
'{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ':hover i' => 'background-color: {{VALUE}}',
|
@@ -6430,7 +6433,7 @@ class rtTPGElementorHelper {
|
|
6430 |
\Elementor\Group_Control_Border::get_type(),
|
6431 |
[
|
6432 |
'name' => 'social_icon_border_hover',
|
6433 |
-
'label' =>
|
6434 |
'selector' => '{{WRAPPER}} .rt-tpg-social-share a:hover i',
|
6435 |
]
|
6436 |
);
|
@@ -6459,7 +6462,7 @@ class rtTPGElementorHelper {
|
|
6459 |
$ref->add_responsive_control(
|
6460 |
'box_margin',
|
6461 |
[
|
6462 |
-
'label' =>
|
6463 |
'type' => Controls_Manager::DIMENSIONS,
|
6464 |
'size_units' => [ 'px' ],
|
6465 |
'render_type' => 'template',
|
@@ -6517,7 +6520,7 @@ class rtTPGElementorHelper {
|
|
6517 |
$ref->add_responsive_control(
|
6518 |
'content_box_padding',
|
6519 |
[
|
6520 |
-
'label' =>
|
6521 |
'type' => Controls_Manager::DIMENSIONS,
|
6522 |
'size_units' => [ 'px' ],
|
6523 |
'allowed_dimensions' => 'all',
|
@@ -6534,7 +6537,7 @@ class rtTPGElementorHelper {
|
|
6534 |
$ref->add_responsive_control(
|
6535 |
'content_box_padding_offset',
|
6536 |
[
|
6537 |
-
'label' =>
|
6538 |
'type' => Controls_Manager::DIMENSIONS,
|
6539 |
'size_units' => [ 'px' ],
|
6540 |
'allowed_dimensions' => 'all',
|
@@ -6556,7 +6559,7 @@ class rtTPGElementorHelper {
|
|
6556 |
$ref->add_responsive_control(
|
6557 |
'content_box_padding_2',
|
6558 |
[
|
6559 |
-
'label' =>
|
6560 |
'type' => Controls_Manager::DIMENSIONS,
|
6561 |
'size_units' => [ 'px' ],
|
6562 |
'allowed_dimensions' => 'all',
|
@@ -6572,7 +6575,7 @@ class rtTPGElementorHelper {
|
|
6572 |
$ref->add_responsive_control(
|
6573 |
'box_radius',
|
6574 |
[
|
6575 |
-
'label' =>
|
6576 |
'type' => Controls_Manager::DIMENSIONS,
|
6577 |
'size_units' => [ 'px', '%' ],
|
6578 |
'selectors' => [
|
@@ -6601,12 +6604,12 @@ class rtTPGElementorHelper {
|
|
6601 |
$ref->add_control(
|
6602 |
'is_box_border',
|
6603 |
[
|
6604 |
-
'label' =>
|
6605 |
'type' => \Elementor\Controls_Manager::SELECT,
|
6606 |
'default' => 'enable',
|
6607 |
'options' => [
|
6608 |
-
'enable' =>
|
6609 |
-
'disable' =>
|
6610 |
],
|
6611 |
'prefix_class' => 'tpg-el-box-border-',
|
6612 |
'condition' => [
|
@@ -6630,7 +6633,7 @@ class rtTPGElementorHelper {
|
|
6630 |
$ref->start_controls_tab(
|
6631 |
'box_style_normal_tab',
|
6632 |
[
|
6633 |
-
'label' =>
|
6634 |
]
|
6635 |
);
|
6636 |
|
@@ -6638,7 +6641,7 @@ class rtTPGElementorHelper {
|
|
6638 |
\Elementor\Group_Control_Background::get_type(),
|
6639 |
[
|
6640 |
'name' => 'box_background',
|
6641 |
-
'label' =>
|
6642 |
'fields_options' => [
|
6643 |
'background' => [
|
6644 |
'label' => esc_html__( 'Card Background', 'the-post-grid' ),
|
@@ -6656,7 +6659,7 @@ class rtTPGElementorHelper {
|
|
6656 |
\Elementor\Group_Control_Background::get_type(),
|
6657 |
[
|
6658 |
'name' => 'box_background2',
|
6659 |
-
'label' =>
|
6660 |
'fields_options' => [
|
6661 |
'background' => [
|
6662 |
'label' => esc_html__( 'Card Background', 'the-post-grid' ),
|
@@ -6674,7 +6677,7 @@ class rtTPGElementorHelper {
|
|
6674 |
$ref->add_control(
|
6675 |
'box_border',
|
6676 |
[
|
6677 |
-
'label' =>
|
6678 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6679 |
'selectors' => [
|
6680 |
'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border: 1px solid {{VALUE}}',
|
@@ -6695,7 +6698,7 @@ class rtTPGElementorHelper {
|
|
6695 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
6696 |
[
|
6697 |
'name' => 'box_box_shadow',
|
6698 |
-
'label' =>
|
6699 |
'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder',
|
6700 |
'condition' => [
|
6701 |
'is_box_border' => 'enable',
|
@@ -6713,7 +6716,7 @@ class rtTPGElementorHelper {
|
|
6713 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
6714 |
[
|
6715 |
'name' => 'box_box_shadow2',
|
6716 |
-
'label' =>
|
6717 |
'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content',
|
6718 |
'condition' => [
|
6719 |
$prefix . '_layout' => [ 'slider-layout13' ],
|
@@ -6729,7 +6732,7 @@ class rtTPGElementorHelper {
|
|
6729 |
$ref->start_controls_tab(
|
6730 |
'box_style_hover_tab',
|
6731 |
[
|
6732 |
-
'label' =>
|
6733 |
]
|
6734 |
);
|
6735 |
|
@@ -6737,7 +6740,7 @@ class rtTPGElementorHelper {
|
|
6737 |
\Elementor\Group_Control_Background::get_type(),
|
6738 |
[
|
6739 |
'name' => 'box_background_hover',
|
6740 |
-
'label' =>
|
6741 |
'fields_options' => [
|
6742 |
'background' => [
|
6743 |
'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ),
|
@@ -6755,7 +6758,7 @@ class rtTPGElementorHelper {
|
|
6755 |
\Elementor\Group_Control_Background::get_type(),
|
6756 |
[
|
6757 |
'name' => 'box_background_hover2',
|
6758 |
-
'label' =>
|
6759 |
'fields_options' => [
|
6760 |
'background' => [
|
6761 |
'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ),
|
@@ -6773,7 +6776,7 @@ class rtTPGElementorHelper {
|
|
6773 |
$ref->add_control(
|
6774 |
'box_border_hover',
|
6775 |
[
|
6776 |
-
'label' =>
|
6777 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6778 |
'selectors' => [
|
6779 |
'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover' => 'border: 1px solid {{VALUE}}',
|
@@ -6793,7 +6796,7 @@ class rtTPGElementorHelper {
|
|
6793 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
6794 |
[
|
6795 |
'name' => 'box_box_shadow_hover',
|
6796 |
-
'label' =>
|
6797 |
'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover',
|
6798 |
'condition' => [
|
6799 |
'is_box_border' => 'enable',
|
@@ -6812,7 +6815,7 @@ class rtTPGElementorHelper {
|
|
6812 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
6813 |
[
|
6814 |
'name' => 'box_box_shadow_hover2',
|
6815 |
-
'label' =>
|
6816 |
'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content',
|
6817 |
'condition' => [
|
6818 |
$prefix . '_layout' => [ 'slider-layout13' ],
|
@@ -6858,7 +6861,7 @@ class rtTPGElementorHelper {
|
|
6858 |
$ref->add_responsive_control(
|
6859 |
'slider_gap',
|
6860 |
[
|
6861 |
-
'label' =>
|
6862 |
'type' => Controls_Manager::SLIDER,
|
6863 |
'size_units' => [ 'px' ],
|
6864 |
'range' => [
|
@@ -6887,10 +6890,10 @@ class rtTPGElementorHelper {
|
|
6887 |
$ref->add_control(
|
6888 |
'arrows',
|
6889 |
[
|
6890 |
-
'label' =>
|
6891 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6892 |
-
'label_on' =>
|
6893 |
-
'label_off' =>
|
6894 |
'return_value' => 'yes',
|
6895 |
'default' => 'yes',
|
6896 |
'condition' => [
|
@@ -6903,14 +6906,14 @@ class rtTPGElementorHelper {
|
|
6903 |
$ref->add_control(
|
6904 |
'arrow_position',
|
6905 |
[
|
6906 |
-
'label' =>
|
6907 |
'type' => \Elementor\Controls_Manager::SELECT,
|
6908 |
'default' => 'default',
|
6909 |
'options' => [
|
6910 |
-
'default' =>
|
6911 |
-
'top-right' =>
|
6912 |
-
'top-left' =>
|
6913 |
-
'show-hover' =>
|
6914 |
],
|
6915 |
'condition' => [
|
6916 |
'arrows' => 'yes',
|
@@ -6923,10 +6926,10 @@ class rtTPGElementorHelper {
|
|
6923 |
$ref->add_control(
|
6924 |
'dots',
|
6925 |
[
|
6926 |
-
'label' =>
|
6927 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6928 |
-
'label_on' =>
|
6929 |
-
'label_off' =>
|
6930 |
'return_value' => 'yes',
|
6931 |
'default' => 'yes',
|
6932 |
'prefix_class' => 'slider-dot-enable-',
|
@@ -6940,10 +6943,10 @@ class rtTPGElementorHelper {
|
|
6940 |
$ref->add_control(
|
6941 |
'dynamic_dots',
|
6942 |
[
|
6943 |
-
'label' =>
|
6944 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6945 |
-
'label_on' =>
|
6946 |
-
'label_off' =>
|
6947 |
'return_value' => 'yes',
|
6948 |
'default' => 'no',
|
6949 |
'render_type' => 'template',
|
@@ -6957,12 +6960,12 @@ class rtTPGElementorHelper {
|
|
6957 |
$ref->add_control(
|
6958 |
'dots_style',
|
6959 |
[
|
6960 |
-
'label' =>
|
6961 |
'type' => \Elementor\Controls_Manager::SELECT,
|
6962 |
'default' => 'default',
|
6963 |
'options' => [
|
6964 |
-
'default' =>
|
6965 |
-
'background' =>
|
6966 |
],
|
6967 |
'condition' => [
|
6968 |
'dots' => 'yes',
|
@@ -6975,10 +6978,10 @@ class rtTPGElementorHelper {
|
|
6975 |
$ref->add_control(
|
6976 |
'infinite',
|
6977 |
[
|
6978 |
-
'label' =>
|
6979 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6980 |
-
'label_on' =>
|
6981 |
-
'label_off' =>
|
6982 |
'return_value' => 'yes',
|
6983 |
'default' => 'yes',
|
6984 |
]
|
@@ -6987,10 +6990,10 @@ class rtTPGElementorHelper {
|
|
6987 |
$ref->add_control(
|
6988 |
'autoplay',
|
6989 |
[
|
6990 |
-
'label' =>
|
6991 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6992 |
-
'label_on' =>
|
6993 |
-
'label_off' =>
|
6994 |
'return_value' => 'yes',
|
6995 |
'default' => false,
|
6996 |
]
|
@@ -6999,7 +7002,7 @@ class rtTPGElementorHelper {
|
|
6999 |
$ref->add_control(
|
7000 |
'autoplaySpeed',
|
7001 |
[
|
7002 |
-
'label' =>
|
7003 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
7004 |
'min' => 1000,
|
7005 |
'max' => 10000,
|
@@ -7014,10 +7017,10 @@ class rtTPGElementorHelper {
|
|
7014 |
$ref->add_control(
|
7015 |
'stopOnHover',
|
7016 |
[
|
7017 |
-
'label' =>
|
7018 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7019 |
-
'label_on' =>
|
7020 |
-
'label_off' =>
|
7021 |
'return_value' => 'yes',
|
7022 |
'default' => 'yes',
|
7023 |
'condition' => [
|
@@ -7029,10 +7032,10 @@ class rtTPGElementorHelper {
|
|
7029 |
$ref->add_control(
|
7030 |
'grabCursor',
|
7031 |
[
|
7032 |
-
'label' =>
|
7033 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7034 |
-
'label_on' =>
|
7035 |
-
'label_off' =>
|
7036 |
'return_value' => 'yes',
|
7037 |
'default' => 'yes',
|
7038 |
]
|
@@ -7042,10 +7045,10 @@ class rtTPGElementorHelper {
|
|
7042 |
$ref->add_control(
|
7043 |
'autoHeight',
|
7044 |
[
|
7045 |
-
'label' =>
|
7046 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7047 |
-
'label_on' =>
|
7048 |
-
'label_off' =>
|
7049 |
'return_value' => 'yes',
|
7050 |
'default' => false,
|
7051 |
'condition' => [
|
@@ -7058,10 +7061,10 @@ class rtTPGElementorHelper {
|
|
7058 |
$ref->add_control(
|
7059 |
'lazyLoad',
|
7060 |
[
|
7061 |
-
'label' =>
|
7062 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7063 |
-
'label_on' =>
|
7064 |
-
'label_off' =>
|
7065 |
'return_value' => 'yes',
|
7066 |
'default' => false,
|
7067 |
'prefix_class' => 'is-lazy-load-',
|
@@ -7072,7 +7075,7 @@ class rtTPGElementorHelper {
|
|
7072 |
$ref->add_control(
|
7073 |
'speed',
|
7074 |
[
|
7075 |
-
'label' =>
|
7076 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
7077 |
'min' => 100,
|
7078 |
'max' => 3000,
|
@@ -7084,15 +7087,15 @@ class rtTPGElementorHelper {
|
|
7084 |
$ref->add_control(
|
7085 |
'enable_2_rows',
|
7086 |
[
|
7087 |
-
'label' =>
|
7088 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7089 |
-
'label_on' =>
|
7090 |
-
'label_off' =>
|
7091 |
'return_value' => 'yes',
|
7092 |
'default' => false,
|
7093 |
'prefix_class' => 'enable-two-rows-',
|
7094 |
'render_type' => 'template',
|
7095 |
-
'description' =>
|
7096 |
'condition' => [
|
7097 |
$prefix . '_layout!' => [ 'slider-layout13',
|
7098 |
'slider-layout11',
|
@@ -7106,12 +7109,12 @@ class rtTPGElementorHelper {
|
|
7106 |
$ref->add_control(
|
7107 |
'carousel_overflow',
|
7108 |
[
|
7109 |
-
'label' =>
|
7110 |
'type' => \Elementor\Controls_Manager::SELECT,
|
7111 |
'default' => 'hidden',
|
7112 |
'options' => [
|
7113 |
-
'hidden' =>
|
7114 |
-
'none' =>
|
7115 |
],
|
7116 |
'render_type' => 'template',
|
7117 |
'prefix_class' => 'is-carousel-overflow-',
|
@@ -7124,12 +7127,12 @@ class rtTPGElementorHelper {
|
|
7124 |
$ref->add_control(
|
7125 |
'slider_direction',
|
7126 |
[
|
7127 |
-
'label' =>
|
7128 |
'type' => \Elementor\Controls_Manager::SELECT,
|
7129 |
'default' => 'ltr',
|
7130 |
'options' => [
|
7131 |
-
'ltr' =>
|
7132 |
-
'rtl' =>
|
7133 |
],
|
7134 |
'prefix_class' => 'slider-direction-',
|
7135 |
'render_type' => 'template',
|
@@ -7170,7 +7173,7 @@ class rtTPGElementorHelper {
|
|
7170 |
$ref->add_control(
|
7171 |
'arrow_style_heading',
|
7172 |
[
|
7173 |
-
'label' =>
|
7174 |
'type' => \Elementor\Controls_Manager::HEADING,
|
7175 |
'separator' => 'before',
|
7176 |
'classes' => 'tpg-control-type-heading',
|
@@ -7183,7 +7186,7 @@ class rtTPGElementorHelper {
|
|
7183 |
$ref->add_responsive_control(
|
7184 |
'arrow_font_size',
|
7185 |
[
|
7186 |
-
'label' =>
|
7187 |
'type' => Controls_Manager::SLIDER,
|
7188 |
'size_units' => [ 'px' ],
|
7189 |
'range' => [
|
@@ -7205,7 +7208,7 @@ class rtTPGElementorHelper {
|
|
7205 |
$ref->add_responsive_control(
|
7206 |
'arrow_border_radius',
|
7207 |
[
|
7208 |
-
'label' =>
|
7209 |
'type' => Controls_Manager::SLIDER,
|
7210 |
'size_units' => [ 'px', '%' ],
|
7211 |
'range' => [
|
@@ -7232,7 +7235,7 @@ class rtTPGElementorHelper {
|
|
7232 |
$ref->add_responsive_control(
|
7233 |
'arrow_width',
|
7234 |
[
|
7235 |
-
'label' =>
|
7236 |
'type' => Controls_Manager::SLIDER,
|
7237 |
'size_units' => [ 'px' ],
|
7238 |
'range' => [
|
@@ -7254,7 +7257,7 @@ class rtTPGElementorHelper {
|
|
7254 |
$ref->add_responsive_control(
|
7255 |
'arrow_height',
|
7256 |
[
|
7257 |
-
'label' =>
|
7258 |
'type' => Controls_Manager::SLIDER,
|
7259 |
'size_units' => [ 'px' ],
|
7260 |
'range' => [
|
@@ -7276,7 +7279,7 @@ class rtTPGElementorHelper {
|
|
7276 |
$ref->add_responsive_control(
|
7277 |
'arrow_x_position',
|
7278 |
[
|
7279 |
-
'label' =>
|
7280 |
'type' => Controls_Manager::SLIDER,
|
7281 |
'size_units' => [ 'px' ],
|
7282 |
'range' => [
|
@@ -7301,7 +7304,7 @@ class rtTPGElementorHelper {
|
|
7301 |
$ref->add_responsive_control(
|
7302 |
'arrow_y_position',
|
7303 |
[
|
7304 |
-
'label' =>
|
7305 |
'type' => Controls_Manager::SLIDER,
|
7306 |
'size_units' => [ 'px', '%' ],
|
7307 |
'range' => [
|
@@ -7334,7 +7337,7 @@ class rtTPGElementorHelper {
|
|
7334 |
$ref->start_controls_tab(
|
7335 |
'arrow_style_normal_tab',
|
7336 |
[
|
7337 |
-
'label' =>
|
7338 |
]
|
7339 |
);
|
7340 |
|
@@ -7364,7 +7367,7 @@ class rtTPGElementorHelper {
|
|
7364 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
7365 |
[
|
7366 |
'name' => 'arrow_box_shadow',
|
7367 |
-
'label' =>
|
7368 |
'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn',
|
7369 |
]
|
7370 |
);
|
@@ -7383,7 +7386,7 @@ class rtTPGElementorHelper {
|
|
7383 |
$ref->start_controls_tab(
|
7384 |
'arrow_style_hover_tab',
|
7385 |
[
|
7386 |
-
'label' =>
|
7387 |
]
|
7388 |
);
|
7389 |
|
@@ -7413,7 +7416,7 @@ class rtTPGElementorHelper {
|
|
7413 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
7414 |
[
|
7415 |
'name' => 'arrow_box_shadow_hover',
|
7416 |
-
'label' =>
|
7417 |
'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover',
|
7418 |
]
|
7419 |
);
|
@@ -7438,7 +7441,7 @@ class rtTPGElementorHelper {
|
|
7438 |
$ref->add_control(
|
7439 |
'dot_style_heading',
|
7440 |
[
|
7441 |
-
'label' =>
|
7442 |
'type' => \Elementor\Controls_Manager::HEADING,
|
7443 |
'separator' => 'before',
|
7444 |
'classes' => 'tpg-control-type-heading',
|
@@ -7451,19 +7454,19 @@ class rtTPGElementorHelper {
|
|
7451 |
$ref->add_control(
|
7452 |
'dots_text_align',
|
7453 |
[
|
7454 |
-
'label' =>
|
7455 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
7456 |
'options' => [
|
7457 |
'left' => [
|
7458 |
-
'title' =>
|
7459 |
'icon' => 'eicon-text-align-left',
|
7460 |
],
|
7461 |
'center' => [
|
7462 |
-
'title' =>
|
7463 |
'icon' => 'eicon-text-align-center',
|
7464 |
],
|
7465 |
'right' => [
|
7466 |
-
'title' =>
|
7467 |
'icon' => 'eicon-text-align-right',
|
7468 |
],
|
7469 |
],
|
@@ -7479,7 +7482,7 @@ class rtTPGElementorHelper {
|
|
7479 |
$ref->add_responsive_control(
|
7480 |
'dot_wrapper_radius',
|
7481 |
[
|
7482 |
-
'label' =>
|
7483 |
'type' => Controls_Manager::SLIDER,
|
7484 |
'size_units' => [ 'px', '%' ],
|
7485 |
'range' => [
|
@@ -7502,7 +7505,7 @@ class rtTPGElementorHelper {
|
|
7502 |
$ref->add_responsive_control(
|
7503 |
'dots_border_radius',
|
7504 |
[
|
7505 |
-
'label' =>
|
7506 |
'type' => Controls_Manager::SLIDER,
|
7507 |
'size_units' => [ 'px', '%' ],
|
7508 |
'range' => [
|
@@ -7529,7 +7532,7 @@ class rtTPGElementorHelper {
|
|
7529 |
$ref->add_responsive_control(
|
7530 |
'dots_width',
|
7531 |
[
|
7532 |
-
'label' =>
|
7533 |
'type' => Controls_Manager::SLIDER,
|
7534 |
'size_units' => [ 'px' ],
|
7535 |
'range' => [
|
@@ -7552,7 +7555,7 @@ class rtTPGElementorHelper {
|
|
7552 |
$ref->add_responsive_control(
|
7553 |
'dots_height',
|
7554 |
[
|
7555 |
-
'label' =>
|
7556 |
'type' => Controls_Manager::SLIDER,
|
7557 |
'size_units' => [ 'px' ],
|
7558 |
'range' => [
|
@@ -7575,7 +7578,7 @@ class rtTPGElementorHelper {
|
|
7575 |
$ref->add_responsive_control(
|
7576 |
'dots_margin',
|
7577 |
[
|
7578 |
-
'label' =>
|
7579 |
'type' => Controls_Manager::SLIDER,
|
7580 |
'size_units' => [ 'px' ],
|
7581 |
'range' => [
|
@@ -7597,7 +7600,7 @@ class rtTPGElementorHelper {
|
|
7597 |
$ref->add_responsive_control(
|
7598 |
'dots_position',
|
7599 |
[
|
7600 |
-
'label' =>
|
7601 |
'type' => Controls_Manager::SLIDER,
|
7602 |
'size_units' => [ 'px' ],
|
7603 |
'range' => [
|
@@ -7630,7 +7633,7 @@ class rtTPGElementorHelper {
|
|
7630 |
$ref->start_controls_tab(
|
7631 |
'dots_style_normal_tab',
|
7632 |
[
|
7633 |
-
'label' =>
|
7634 |
]
|
7635 |
);
|
7636 |
|
@@ -7683,7 +7686,7 @@ class rtTPGElementorHelper {
|
|
7683 |
$ref->start_controls_tab(
|
7684 |
'dots_style_hover_tab',
|
7685 |
[
|
7686 |
-
'label' =>
|
7687 |
]
|
7688 |
);
|
7689 |
|
@@ -7730,7 +7733,7 @@ class rtTPGElementorHelper {
|
|
7730 |
$ref->add_control(
|
7731 |
'popup_head_bg',
|
7732 |
[
|
7733 |
-
'label' =>
|
7734 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7735 |
'selectors' => [
|
7736 |
'body .rt-popup-wrap .rt-popup-navigation-wrap' => 'background-color: {{VALUE}}',
|
@@ -7741,7 +7744,7 @@ class rtTPGElementorHelper {
|
|
7741 |
$ref->add_control(
|
7742 |
'popup_head_txt_color',
|
7743 |
[
|
7744 |
-
'label' =>
|
7745 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7746 |
'selectors' => [
|
7747 |
'body #rt-popup-wrap .rt-popup-singlePage-counter' => 'color: {{VALUE}}',
|
@@ -7752,7 +7755,7 @@ class rtTPGElementorHelper {
|
|
7752 |
$ref->add_control(
|
7753 |
'popup_title_color',
|
7754 |
[
|
7755 |
-
'label' =>
|
7756 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7757 |
'selectors' => [
|
7758 |
'body .md-content .rt-md-content-holder > .md-header .entry-title' => 'color: {{VALUE}}',
|
@@ -7766,7 +7769,7 @@ class rtTPGElementorHelper {
|
|
7766 |
$ref->add_control(
|
7767 |
'popup_meta_color',
|
7768 |
[
|
7769 |
-
'label' =>
|
7770 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7771 |
'selectors' => [
|
7772 |
'body .md-content .rt-md-content-holder > .md-header .post-meta-user *' => 'color: {{VALUE}}',
|
@@ -7779,7 +7782,7 @@ class rtTPGElementorHelper {
|
|
7779 |
$ref->add_control(
|
7780 |
'popup_content_color',
|
7781 |
[
|
7782 |
-
'label' =>
|
7783 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7784 |
'selectors' => [
|
7785 |
'body .md-content .rt-md-content *' => 'color: {{VALUE}}',
|
@@ -7792,7 +7795,7 @@ class rtTPGElementorHelper {
|
|
7792 |
$ref->add_control(
|
7793 |
'popup_bg',
|
7794 |
[
|
7795 |
-
'label' =>
|
7796 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7797 |
'selectors' => [
|
7798 |
'body .md-content, body #rt-popup-wrap .rt-popup-content' => 'background-color: {{VALUE}}',
|
@@ -7893,7 +7896,7 @@ class rtTPGElementorHelper {
|
|
7893 |
\Elementor\Group_Control_Background::get_type(),
|
7894 |
[
|
7895 |
'name' => 'thumb_wrapper_bg',
|
7896 |
-
'label' =>
|
7897 |
'fields_options' => [
|
7898 |
'background' => [
|
7899 |
'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ),
|
@@ -7944,7 +7947,7 @@ class rtTPGElementorHelper {
|
|
7944 |
\Elementor\Group_Control_Typography::get_type(),
|
7945 |
[
|
7946 |
'name' => 'acf_group_title_typography',
|
7947 |
-
'label' =>
|
7948 |
'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-group-title',
|
7949 |
]
|
7950 |
);
|
@@ -7953,7 +7956,7 @@ class rtTPGElementorHelper {
|
|
7953 |
\Elementor\Group_Control_Typography::get_type(),
|
7954 |
[
|
7955 |
'name' => 'acf_typography',
|
7956 |
-
'label' =>
|
7957 |
'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-fields',
|
7958 |
]
|
7959 |
);
|
@@ -7961,13 +7964,13 @@ class rtTPGElementorHelper {
|
|
7961 |
$ref->add_control(
|
7962 |
'acf_label_style',
|
7963 |
[
|
7964 |
-
'label' =>
|
7965 |
'type' => \Elementor\Controls_Manager::SELECT,
|
7966 |
'default' => 'inline',
|
7967 |
'options' => [
|
7968 |
-
'default' =>
|
7969 |
-
'inline' =>
|
7970 |
-
'block' =>
|
7971 |
],
|
7972 |
'condition' => [
|
7973 |
'cf_show_only_value' => 'yes',
|
@@ -7980,7 +7983,7 @@ class rtTPGElementorHelper {
|
|
7980 |
$ref->add_responsive_control(
|
7981 |
'acf_label_width',
|
7982 |
[
|
7983 |
-
'label' =>
|
7984 |
'type' => Controls_Manager::SLIDER,
|
7985 |
'size_units' => [ 'px' ],
|
7986 |
'range' => [
|
@@ -8038,14 +8041,14 @@ class rtTPGElementorHelper {
|
|
8038 |
$ref->start_controls_tab(
|
8039 |
'acf_style_normal_tab',
|
8040 |
[
|
8041 |
-
'label' =>
|
8042 |
]
|
8043 |
);
|
8044 |
}
|
8045 |
$ref->add_control(
|
8046 |
'acf_group_title_color',
|
8047 |
[
|
8048 |
-
'label' =>
|
8049 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8050 |
'selectors' => [
|
8051 |
'{{WRAPPER}} .acf-custom-field-wrap .tpg-cf-group-title' => 'color: {{VALUE}}',
|
@@ -8059,7 +8062,7 @@ class rtTPGElementorHelper {
|
|
8059 |
$ref->add_control(
|
8060 |
'acf_label_color',
|
8061 |
[
|
8062 |
-
'label' =>
|
8063 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8064 |
'selectors' => [
|
8065 |
'{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-label' => 'color: {{VALUE}}',
|
@@ -8073,7 +8076,7 @@ class rtTPGElementorHelper {
|
|
8073 |
$ref->add_control(
|
8074 |
'acf_value_color',
|
8075 |
[
|
8076 |
-
'label' =>
|
8077 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8078 |
'selectors' => [
|
8079 |
'{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-value' => 'color: {{VALUE}}',
|
@@ -8089,14 +8092,14 @@ class rtTPGElementorHelper {
|
|
8089 |
$ref->start_controls_tab(
|
8090 |
'acf_style_hover_tab',
|
8091 |
[
|
8092 |
-
'label' =>
|
8093 |
]
|
8094 |
);
|
8095 |
|
8096 |
$ref->add_control(
|
8097 |
'acf_group_title_color_hover',
|
8098 |
[
|
8099 |
-
'label' =>
|
8100 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8101 |
'selectors' => [
|
8102 |
'{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tpg-cf-group-title' => 'color: {{VALUE}}',
|
@@ -8110,7 +8113,7 @@ class rtTPGElementorHelper {
|
|
8110 |
$ref->add_control(
|
8111 |
'acf_label_color_hover',
|
8112 |
[
|
8113 |
-
'label' =>
|
8114 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8115 |
'selectors' => [
|
8116 |
'{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-label' => 'color: {{VALUE}}',
|
@@ -8124,7 +8127,7 @@ class rtTPGElementorHelper {
|
|
8124 |
$ref->add_control(
|
8125 |
'acf_value_color_hover',
|
8126 |
[
|
8127 |
-
'label' =>
|
8128 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8129 |
'selectors' => [
|
8130 |
'{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-value' => 'color: {{VALUE}}',
|
@@ -8138,7 +8141,4 @@ class rtTPGElementorHelper {
|
|
8138 |
//End Tab
|
8139 |
}
|
8140 |
}
|
8141 |
-
|
8142 |
-
|
8143 |
-
//End the class
|
8144 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Elementor Helper Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
|
|
|
|
|
|
|
|
8 |
use Elementor\Controls_Manager;
|
9 |
use RT\ThePostGrid\Helpers\Fns;
|
10 |
use RT\ThePostGrid\Helpers\Options;
|
11 |
|
12 |
+
// Do not allow directly accessing this file.
|
13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
14 |
+
exit( 'This script cannot be accessed directly.' );
|
15 |
+
}
|
16 |
+
|
17 |
require_once( RT_THE_POST_GRID_PLUGIN_PATH . '/app/Widgets/elementor/rtTPGElementorQuery.php' );
|
18 |
|
19 |
+
/**
|
20 |
+
* Elementor Helper Class
|
21 |
+
*/
|
22 |
class rtTPGElementorHelper {
|
|
|
|
|
23 |
/**
|
24 |
* Post Query Settings
|
25 |
*
|
55 |
$ref->add_control(
|
56 |
'common_filters_heading',
|
57 |
[
|
58 |
+
'label' => esc_html__( 'Common Filters:', 'the-post-grid' ),
|
59 |
'type' => \Elementor\Controls_Manager::HEADING,
|
60 |
'separator' => 'before',
|
61 |
'classes' => 'tpg-control-type-heading',
|
65 |
$ref->add_control(
|
66 |
'post_id',
|
67 |
[
|
68 |
+
'label' => esc_html__( 'Include only', 'the-post-grid' ),
|
69 |
'type' => \Elementor\Controls_Manager::TEXT,
|
70 |
+
'description' => esc_html__( 'Enter the post IDs separated by comma for include', 'the-post-grid' ),
|
71 |
+
'placeholder' => 'Eg. 10, 15, 17',
|
72 |
]
|
73 |
);
|
74 |
|
75 |
$ref->add_control(
|
76 |
'exclude',
|
77 |
[
|
78 |
+
'label' => esc_html__( 'Exclude', 'the-post-grid' ),
|
79 |
'type' => \Elementor\Controls_Manager::TEXT,
|
80 |
+
'description' => esc_html__( 'Enter the post IDs separated by comma for exclude', 'the-post-grid' ),
|
81 |
+
'placeholder' => 'Eg. 12, 13',
|
82 |
]
|
83 |
);
|
84 |
|
85 |
$ref->add_control(
|
86 |
'post_limit',
|
87 |
[
|
88 |
+
'label' => esc_html__( 'Limit', 'the-post-grid' ),
|
89 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
90 |
+
'description' => esc_html__( 'The number of posts to show. Enter -1 to show all found posts.', 'the-post-grid' ),
|
91 |
]
|
92 |
);
|
93 |
|
94 |
$ref->add_control(
|
95 |
'offset',
|
96 |
[
|
97 |
+
'label' => esc_html__( 'Offset', 'the-post-grid' ),
|
98 |
'type' => \Elementor\Controls_Manager::TEXT,
|
99 |
+
'placeholder' => esc_html__( 'Enter Post offset', 'the-post-grid' ),
|
100 |
+
'description' => esc_html__( 'Number of posts to skip. The offset parameter is ignored when post limit => -1 is used.', 'the-post-grid' ),
|
101 |
]
|
102 |
);
|
103 |
|
104 |
+
//TODO: Advance Filter.
|
|
|
105 |
$ref->add_control(
|
106 |
'advanced_filters_heading',
|
107 |
[
|
108 |
+
'label' => esc_html__( 'Advanced Filters:', 'the-post-grid' ),
|
109 |
'type' => \Elementor\Controls_Manager::HEADING,
|
110 |
'separator' => 'before',
|
111 |
'classes' => 'tpg-control-type-heading',
|
114 |
|
115 |
foreach ( $taxonomies as $taxonomy => $object ) {
|
116 |
if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) )
|
117 |
+
|| in_array( $taxonomy, Custom_Widget_Base::get_excluded_taxonomy() )
|
118 |
) {
|
119 |
continue;
|
120 |
}
|
121 |
$ref->add_control(
|
122 |
$taxonomy . '_ids',
|
123 |
[
|
124 |
+
'label' => esc_html__( "By ", 'the-post-grid' ) . $object->label,
|
125 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
126 |
'label_block' => true,
|
127 |
'multiple' => true,
|
136 |
$ref->add_control(
|
137 |
'relation',
|
138 |
[
|
139 |
+
'label' => esc_html__( 'Taxonomies Relation', 'the-post-grid' ),
|
140 |
'type' => \Elementor\Controls_Manager::SELECT,
|
141 |
'default' => 'OR',
|
142 |
'options' => [
|
143 |
+
'OR' => esc_html__( 'OR', 'the-post-grid' ),
|
144 |
+
'AND' => esc_html__( 'AND', 'the-post-grid' ),
|
145 |
+
'NOT IN' => esc_html__( 'NOT IN', 'the-post-grid' ),
|
146 |
],
|
147 |
]
|
148 |
);
|
150 |
$ref->add_control(
|
151 |
'author',
|
152 |
[
|
153 |
+
'label' => esc_html__( 'By Author', 'the-post-grid' ),
|
154 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
155 |
'multiple' => true,
|
156 |
'label_block' => true,
|
161 |
$ref->add_control(
|
162 |
'post_keyword',
|
163 |
[
|
164 |
+
'label' => esc_html__( 'By Keyword', 'the-post-grid' ),
|
165 |
'type' => \Elementor\Controls_Manager::TEXT,
|
166 |
'label_block' => true,
|
167 |
+
'placeholder' => esc_html__( 'Search by keyword', 'the-post-grid' ),
|
168 |
+
'description' => esc_html__( 'Search by post title or content keyword', 'the-post-grid' ),
|
169 |
]
|
170 |
);
|
171 |
|
172 |
$ref->add_control(
|
173 |
'date_range',
|
174 |
[
|
175 |
+
'label' => esc_html__( 'Date Range (Start to End)', 'the-post-grid' ) . $ref->pro_label,
|
176 |
'type' => \Elementor\Controls_Manager::DATE_TIME,
|
177 |
+
'placeholder' => 'Choose date...',
|
178 |
+
'description' => esc_html__( 'NB: Enter DEL button for delete date range', 'the-post-grid' ),
|
179 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
180 |
'picker_options' => [
|
181 |
'enableTime' => false,
|
182 |
+
'mode' => 'range',
|
183 |
+
'dateFormat' => 'M j, Y',
|
184 |
],
|
185 |
]
|
186 |
);
|
187 |
|
188 |
|
189 |
$orderby_opt = [
|
190 |
+
'date' => esc_html__( 'Date', 'the-post-grid' ),
|
191 |
+
'ID' => esc_html__( 'Order by post ID', 'the-post-grid' ),
|
192 |
+
'author' => esc_html__( 'Author', 'the-post-grid' ),
|
193 |
+
'title' => esc_html__( 'Title', 'the-post-grid' ),
|
194 |
+
'modified' => esc_html__( 'Last modified date', 'the-post-grid' ),
|
195 |
+
'parent' => esc_html__( 'Post parent ID', 'the-post-grid' ),
|
196 |
+
'comment_count' => esc_html__( 'Number of comments', 'the-post-grid' ),
|
197 |
+
'menu_order' => esc_html__( 'Menu order', 'the-post-grid' ),
|
198 |
|
199 |
];
|
200 |
+
|
201 |
if ( rtTPG()->hasPro() ) {
|
202 |
$prderby_pro_opt = [
|
203 |
+
'rand' => esc_html__( 'Random order', 'the-post-grid' ),
|
204 |
];
|
205 |
$orderby_opt = array_merge( $orderby_opt, $prderby_pro_opt );
|
206 |
}
|
208 |
$ref->add_control(
|
209 |
'orderby',
|
210 |
[
|
211 |
+
'label' => esc_html__( 'Order by', 'the-post-grid' ),
|
212 |
'type' => \Elementor\Controls_Manager::SELECT,
|
213 |
'options' => $orderby_opt,
|
214 |
'default' => 'date',
|
219 |
$ref->add_control(
|
220 |
'order',
|
221 |
[
|
222 |
+
'label' => esc_html__( 'Sort order', 'the-post-grid' ),
|
223 |
'type' => \Elementor\Controls_Manager::SELECT,
|
224 |
'options' => [
|
225 |
+
'ASC' => esc_html__( 'ASC', 'the-post-grid' ),
|
226 |
+
'DESC' => esc_html__( 'DESC', 'the-post-grid' ),
|
227 |
],
|
228 |
'default' => 'DESC',
|
229 |
'condition' => [
|
246 |
$ref->add_control(
|
247 |
'ignore_sticky_posts',
|
248 |
[
|
249 |
+
'label' => esc_html__( 'Ignore sticky posts at the top', 'the-post-grid' ) . $ref->pro_label,
|
250 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
251 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
252 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
253 |
'return_value' => 'yes',
|
254 |
'default' => 'no',
|
255 |
'disabled' => true,
|
260 |
$ref->add_control(
|
261 |
'no_posts_found_text',
|
262 |
[
|
263 |
+
'label' => esc_html__( 'No post found Text', 'the-post-grid' ),
|
264 |
'type' => \Elementor\Controls_Manager::TEXT,
|
265 |
+
'default' => esc_html__( 'No posts found.', 'the-post-grid' ),
|
266 |
+
'placeholder' => esc_html__( 'Enter No post found', 'the-post-grid' ),
|
267 |
'separator' => 'before',
|
268 |
]
|
269 |
);
|
296 |
$ref->add_control(
|
297 |
'post_limit',
|
298 |
[
|
299 |
+
'label' => esc_html__( 'Posts per page', 'the-post-grid' ),
|
300 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
301 |
+
'description' => esc_html__( 'The number of posts to show. Enter -1 to show all found posts.', 'the-post-grid' ),
|
302 |
]
|
303 |
);
|
304 |
|
307 |
$get_all_taxonomy = [];
|
308 |
foreach ( $taxonomies as $taxonomy => $object ) {
|
309 |
if ( ! isset( $object->object_type[0] ) || ! in_array( $object->object_type[0], array_keys( $post_types ) )
|
310 |
+
|| in_array( $taxonomy, Custom_Widget_Base::get_excluded_taxonomy() )
|
311 |
) {
|
312 |
continue;
|
313 |
}
|
317 |
$ref->add_control(
|
318 |
'taxonomy_lists',
|
319 |
[
|
320 |
+
'label' => esc_html__( 'Select a Taxonomy for relation', 'the-post-grid' ),
|
321 |
'type' => \Elementor\Controls_Manager::SELECT,
|
322 |
'default' => 'category',
|
323 |
'options' => $get_all_taxonomy,
|
325 |
);
|
326 |
|
327 |
$orderby_opt = [
|
328 |
+
'date' => esc_html__( 'Date', 'the-post-grid' ),
|
329 |
+
'ID' => esc_html__( 'Order by post ID', 'the-post-grid' ),
|
330 |
+
'author' => esc_html__( 'Author', 'the-post-grid' ),
|
331 |
+
'title' => esc_html__( 'Title', 'the-post-grid' ),
|
332 |
+
'modified' => esc_html__( 'Last modified date', 'the-post-grid' ),
|
333 |
+
'parent' => esc_html__( 'Post parent ID', 'the-post-grid' ),
|
334 |
+
'comment_count' => esc_html__( 'Number of comments', 'the-post-grid' ),
|
335 |
+
'menu_order' => esc_html__( 'Menu order', 'the-post-grid' ),
|
336 |
+
'rand' => esc_html__( 'Random order', 'the-post-grid' ),
|
337 |
|
338 |
];
|
339 |
|
340 |
$ref->add_control(
|
341 |
'orderby',
|
342 |
[
|
343 |
+
'label' => esc_html__( 'Order by', 'the-post-grid' ),
|
344 |
'type' => \Elementor\Controls_Manager::SELECT,
|
345 |
'options' => $orderby_opt,
|
346 |
'default' => 'date',
|
350 |
$ref->add_control(
|
351 |
'order',
|
352 |
[
|
353 |
+
'label' => esc_html__( 'Sort order', 'the-post-grid' ),
|
354 |
'type' => \Elementor\Controls_Manager::SELECT,
|
355 |
'options' => [
|
356 |
+
'ASC' => esc_html__( 'ASC', 'the-post-grid' ),
|
357 |
+
'DESC' => esc_html__( 'DESC', 'the-post-grid' ),
|
358 |
],
|
359 |
'default' => 'DESC',
|
360 |
'condition' => [
|
366 |
$ref->add_control(
|
367 |
'post_id',
|
368 |
[
|
369 |
+
'label' => esc_html__( 'Include only', 'the-post-grid' ),
|
370 |
'type' => \Elementor\Controls_Manager::TEXT,
|
371 |
+
'description' => esc_html__( 'Enter the post IDs separated by comma for include', 'the-post-grid' ),
|
372 |
+
'placeholder' => 'Eg. 10, 15, 17',
|
373 |
]
|
374 |
);
|
375 |
|
376 |
$ref->add_control(
|
377 |
'exclude',
|
378 |
[
|
379 |
+
'label' => esc_html__( 'Exclude', 'the-post-grid' ),
|
380 |
'type' => \Elementor\Controls_Manager::TEXT,
|
381 |
+
'description' => esc_html__( 'Enter the post IDs separated by comma for exclude', 'the-post-grid' ),
|
382 |
+
'placeholder' => 'Eg. 12, 13',
|
383 |
]
|
384 |
);
|
385 |
|
386 |
$ref->add_control(
|
387 |
'offset',
|
388 |
[
|
389 |
+
'label' => esc_html__( 'Offset', 'the-post-grid' ),
|
390 |
'type' => \Elementor\Controls_Manager::TEXT,
|
391 |
+
'placeholder' => esc_html__( 'Enter Post offset', 'the-post-grid' ),
|
392 |
+
'description' => esc_html__( 'Number of posts to skip. The offset parameter is ignored when post limit => -1 is used.', 'the-post-grid' ),
|
393 |
]
|
394 |
);
|
395 |
|
396 |
$ref->add_control(
|
397 |
'no_posts_found_text_archive',
|
398 |
[
|
399 |
+
'label' => esc_html__( 'No post found Text', 'the-post-grid' ),
|
400 |
'type' => \Elementor\Controls_Manager::TEXT,
|
401 |
+
'default' => esc_html__( 'No posts found.', 'the-post-grid' ),
|
402 |
+
'placeholder' => esc_html__( 'Enter No post found', 'the-post-grid' ),
|
403 |
'separator' => 'before',
|
404 |
]
|
405 |
);
|
418 |
$ref->start_controls_section(
|
419 |
$prefix . '_layout_settings',
|
420 |
[
|
421 |
+
'label' => esc_html__( 'Layout', 'the-post-grid' ),
|
422 |
'tab' => Controls_Manager::TAB_CONTENT,
|
423 |
]
|
424 |
);
|
427 |
$layout_class = 'grid-layout';
|
428 |
$layout_options = [
|
429 |
$prefix . '-layout1' => [
|
430 |
+
'title' => esc_html__( 'Layout 1', 'the-post-grid' ),
|
431 |
],
|
432 |
$prefix . '-layout3' => [
|
433 |
+
'title' => esc_html__( 'Layout 2', 'the-post-grid' ),
|
434 |
],
|
435 |
$prefix . '-layout4' => [
|
436 |
+
'title' => esc_html__( 'Layout 3', 'the-post-grid' ),
|
437 |
],
|
438 |
$prefix . '-layout2' => [
|
439 |
+
'title' => esc_html__( 'Layout 4', 'the-post-grid' ),
|
440 |
],
|
441 |
$prefix . '-layout5' => [
|
442 |
+
'title' => esc_html__( 'Layout 5', 'the-post-grid' ),
|
443 |
],
|
444 |
$prefix . '-layout5-2' => [
|
445 |
+
'title' => esc_html__( 'Layout 6', 'the-post-grid' ),
|
446 |
],
|
447 |
$prefix . '-layout6' => [
|
448 |
+
'title' => esc_html__( 'Layout 7', 'the-post-grid' ),
|
449 |
],
|
450 |
$prefix . '-layout6-2' => [
|
451 |
+
'title' => esc_html__( 'Layout 8', 'the-post-grid' ),
|
452 |
],
|
453 |
$prefix . '-layout7' => [
|
454 |
+
'title' => esc_html__( 'Gallery', 'the-post-grid' ),
|
455 |
],
|
456 |
];
|
457 |
}
|
460 |
$layout_class = 'grid-hover-layout';
|
461 |
$layout_options = [
|
462 |
$prefix . '-layout1' => [
|
463 |
+
'title' => esc_html__( 'Layout 1', 'the-post-grid' ),
|
464 |
],
|
465 |
$prefix . '-layout2' => [
|
466 |
+
'title' => esc_html__( 'Layout 2', 'the-post-grid' ),
|
467 |
],
|
468 |
$prefix . '-layout3' => [
|
469 |
+
'title' => esc_html__( 'Layout 3', 'the-post-grid' ),
|
470 |
],
|
471 |
$prefix . '-layout4' => [
|
472 |
+
'title' => esc_html__( 'Layout 4', 'the-post-grid' ),
|
473 |
],
|
474 |
$prefix . '-layout4-2' => [
|
475 |
+
'title' => esc_html__( 'Layout 5', 'the-post-grid' ),
|
476 |
],
|
477 |
$prefix . '-layout5' => [
|
478 |
+
'title' => esc_html__( 'Layout 6', 'the-post-grid' ),
|
479 |
],
|
480 |
$prefix . '-layout5-2' => [
|
481 |
+
'title' => esc_html__( 'Layout 7', 'the-post-grid' ),
|
482 |
],
|
483 |
$prefix . '-layout6' => [
|
484 |
+
'title' => esc_html__( 'Layout 8', 'the-post-grid' ),
|
485 |
],
|
486 |
$prefix . '-layout6-2' => [
|
487 |
+
'title' => esc_html__( 'Layout 9', 'the-post-grid' ),
|
488 |
],
|
489 |
$prefix . '-layout7' => [
|
490 |
+
'title' => esc_html__( 'Layout 10', 'the-post-grid' ),
|
491 |
],
|
492 |
$prefix . '-layout7-2' => [
|
493 |
+
'title' => esc_html__( 'Layout 11', 'the-post-grid' ),
|
494 |
],
|
495 |
$prefix . '-layout8' => [
|
496 |
+
'title' => esc_html__( 'Layout 12', 'the-post-grid' ),
|
497 |
],
|
498 |
$prefix . '-layout9' => [
|
499 |
+
'title' => esc_html__( 'Layout 13', 'the-post-grid' ),
|
500 |
],
|
501 |
$prefix . '-layout9-2' => [
|
502 |
+
'title' => esc_html__( 'Layout 14', 'the-post-grid' ),
|
503 |
],
|
504 |
$prefix . '-layout10' => [
|
505 |
+
'title' => esc_html__( 'Layout 15', 'the-post-grid' ),
|
506 |
],
|
507 |
$prefix . '-layout11' => [
|
508 |
+
'title' => esc_html__( 'Layout 16', 'the-post-grid' ),
|
509 |
],
|
510 |
];
|
511 |
}
|
514 |
$layout_class = 'slider-layout';
|
515 |
$layout_options = [
|
516 |
$prefix . '-layout1' => [
|
517 |
+
'title' => esc_html__( 'Layout 1', 'the-post-grid' ),
|
518 |
],
|
519 |
$prefix . '-layout2' => [
|
520 |
+
'title' => esc_html__( 'Layout 2', 'the-post-grid' ),
|
521 |
],
|
522 |
$prefix . '-layout3' => [
|
523 |
+
'title' => esc_html__( 'Layout 3', 'the-post-grid' ),
|
524 |
],
|
525 |
$prefix . '-layout4' => [
|
526 |
+
'title' => esc_html__( 'Layout 4', 'the-post-grid' ),
|
527 |
],
|
528 |
$prefix . '-layout5' => [
|
529 |
+
'title' => esc_html__( 'Layout 5', 'the-post-grid' ),
|
530 |
],
|
531 |
$prefix . '-layout6' => [
|
532 |
+
'title' => esc_html__( 'Layout 6', 'the-post-grid' ),
|
533 |
],
|
534 |
$prefix . '-layout7' => [
|
535 |
+
'title' => esc_html__( 'Layout 7', 'the-post-grid' ),
|
536 |
],
|
537 |
$prefix . '-layout8' => [
|
538 |
+
'title' => esc_html__( 'Layout 8', 'the-post-grid' ),
|
539 |
],
|
540 |
$prefix . '-layout9' => [
|
541 |
+
'title' => esc_html__( 'Layout 9', 'the-post-grid' ),
|
542 |
],
|
543 |
$prefix . '-layout10' => [
|
544 |
+
'title' => esc_html__( 'Layout 10', 'the-post-grid' ),
|
545 |
],
|
546 |
$prefix . '-layout11' => [
|
547 |
+
'title' => esc_html__( 'Layout 11', 'the-post-grid' ),
|
548 |
],
|
549 |
$prefix . '-layout12' => [
|
550 |
+
'title' => esc_html__( 'Layout 12', 'the-post-grid' ),
|
551 |
],
|
552 |
$prefix . '-layout13' => [
|
553 |
+
'title' => esc_html__( 'Layout 13', 'the-post-grid' ),
|
554 |
],
|
555 |
];
|
556 |
|
562 |
$ref->add_control(
|
563 |
$prefix . '_layout',
|
564 |
[
|
565 |
+
'label' => esc_html__( 'Choose Layout', 'the-post-grid' ),
|
566 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
567 |
'label_block' => true,
|
568 |
'options' => $layout_options,
|
576 |
$ref->add_control(
|
577 |
'layout_options_heading',
|
578 |
[
|
579 |
+
'label' => esc_html__( 'Layout Options:', 'the-post-grid' ),
|
580 |
'type' => \Elementor\Controls_Manager::HEADING,
|
581 |
'classes' => 'tpg-control-type-heading',
|
582 |
]
|
584 |
|
585 |
|
586 |
$column_options = [
|
587 |
+
'0' => esc_html__( 'Default from layout', 'the-post-grid' ),
|
588 |
+
'12' => esc_html__( '1 Columns', 'the-post-grid' ),
|
589 |
+
'6' => esc_html__( '2 Columns', 'the-post-grid' ),
|
590 |
+
'4' => esc_html__( '3 Columns', 'the-post-grid' ),
|
591 |
+
'3' => esc_html__( '4 Columns', 'the-post-grid' ),
|
592 |
];
|
593 |
|
594 |
if ( 'grid' === $prefix ) {
|
605 |
|
606 |
if ( 'slider' === $prefix ) {
|
607 |
$column_options = [
|
608 |
+
'0' => esc_html__( 'Default from layout', 'the-post-grid' ),
|
609 |
+
'1' => esc_html__( '1 Columns', 'the-post-grid' ),
|
610 |
+
'2' => esc_html__( '2 Columns', 'the-post-grid' ),
|
611 |
+
'3' => esc_html__( '3 Columns', 'the-post-grid' ),
|
612 |
+
'4' => esc_html__( '4 Columns', 'the-post-grid' ),
|
613 |
+
'5' => esc_html__( '5 Columns', 'the-post-grid' ),
|
614 |
+
'6' => esc_html__( '6 Columns', 'the-post-grid' ),
|
615 |
];
|
616 |
$grid_column_condition = [
|
617 |
'slider_layout!' => [ 'slider-layout10', 'slider-layout11', 'slider-layout13' ],
|
627 |
'default' => '0',
|
628 |
'tablet_default' => '0',
|
629 |
'mobile_default' => '0',
|
630 |
+
'description' => esc_html__( 'Choose Column for layout.', 'the-post-grid' ),
|
631 |
'condition' => $grid_column_condition,
|
632 |
]
|
633 |
);
|
636 |
$ref->add_control(
|
637 |
'enable_related_slider',
|
638 |
[
|
639 |
+
'label' => esc_html__( 'Enable Slider', 'the-post-grid' ),
|
640 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
641 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
642 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
643 |
'return_value' => 'yes',
|
644 |
'default' => 'yes',
|
645 |
]
|
648 |
$ref->add_responsive_control(
|
649 |
'slider_gap_2',
|
650 |
[
|
651 |
+
'label' => esc_html__( 'Grid Gap', 'the-post-grid' ),
|
652 |
'type' => Controls_Manager::SLIDER,
|
653 |
'size_units' => [ 'px' ],
|
654 |
'range' => [
|
672 |
$ref->add_responsive_control(
|
673 |
$prefix . '_offset_col_width',
|
674 |
[
|
675 |
+
'label' => esc_html__( 'Offset Column Width', 'the-post-grid' ),
|
676 |
'type' => Controls_Manager::SLIDER,
|
677 |
'size_units' => [ '%' ],
|
678 |
'range' => [
|
715 |
|
716 |
if ( 'grid' === $prefix ) {
|
717 |
$layout_style_opt = [
|
718 |
+
'tpg-even' => esc_html__( 'Grid', 'the-post-grid' ),
|
719 |
+
'tpg-full-height' => esc_html__( 'Grid Equal Height', 'the-post-grid' ),
|
720 |
];
|
721 |
if ( rtTPG()->hasPro() ) {
|
722 |
$layout_style_new_opt = [
|
723 |
+
'masonry' => esc_html__( 'Masonry', 'the-post-grid' ),
|
724 |
];
|
725 |
$layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt );
|
726 |
}
|
728 |
$ref->add_control(
|
729 |
$prefix . '_layout_style',
|
730 |
[
|
731 |
+
'label' => esc_html__( 'Layout Style', 'the-post-grid' ),
|
732 |
'type' => \Elementor\Controls_Manager::SELECT,
|
733 |
'default' => 'tpg-full-height',
|
734 |
'options' => $layout_style_opt,
|
735 |
+
'description' => esc_html__( 'If you use card border then equal height will work. ', 'the-post-grid' ) . $ref->get_pro_message( "masonry layout" ),
|
736 |
'classes' => rtTPG()->hasPro() ? '' : 'tpg-should-hide-field',
|
737 |
'condition' => [
|
738 |
$prefix . '_layout!' => [ 'grid-layout2',
|
763 |
$ref->add_control(
|
764 |
$prefix . '_layout_alignment',
|
765 |
[
|
766 |
+
'label' => esc_html__( 'Vertical Align', 'the-post-grid' ),
|
767 |
'type' => \Elementor\Controls_Manager::SELECT,
|
768 |
'options' => [
|
769 |
+
'' => esc_html__( 'Default', 'the-post-grid' ),
|
770 |
+
'flex-start' => esc_html__( 'Start', 'the-post-grid' ),
|
771 |
+
'center' => esc_html__( 'Center', 'the-post-grid' ),
|
772 |
+
'flex-end' => esc_html__( 'End', 'the-post-grid' ),
|
773 |
+
'space-around' => esc_html__( 'Space Around', 'the-post-grid' ),
|
774 |
+
'space-between' => esc_html__( 'Space Between', 'the-post-grid' ),
|
775 |
],
|
776 |
'condition' => [
|
777 |
$prefix . '_layout!' => [
|
798 |
$ref->add_control(
|
799 |
$prefix . '_layout_alignment_2',
|
800 |
[
|
801 |
+
'label' => esc_html__( 'Vertical Align', 'the-post-grid' ),
|
802 |
'type' => \Elementor\Controls_Manager::SELECT,
|
803 |
'options' => [
|
804 |
+
'' => esc_html__( 'Default', 'the-post-grid' ),
|
805 |
+
'flex-start' => esc_html__( 'Start', 'the-post-grid' ),
|
806 |
+
'center' => esc_html__( 'Center', 'the-post-grid' ),
|
807 |
+
'flex-end' => esc_html__( 'End', 'the-post-grid' ),
|
808 |
+
'space-around' => esc_html__( 'Space Around', 'the-post-grid' ),
|
809 |
+
'space-between' => esc_html__( 'Space Between', 'the-post-grid' ),
|
810 |
],
|
811 |
'condition' => [
|
812 |
$prefix . '_layout!' => [ 'slider-layout1',
|
875 |
$ref->start_controls_section(
|
876 |
$prefix . '_filter_settings',
|
877 |
[
|
878 |
+
'label' => esc_html__( 'Filter (Front-end)', 'the-post-grid' ),
|
879 |
'tab' => Controls_Manager::TAB_CONTENT,
|
880 |
]
|
881 |
);
|
883 |
$ref->add_control(
|
884 |
'show_taxonomy_filter',
|
885 |
[
|
886 |
+
'label' => esc_html__( 'Taxonomy Filter', 'the-post-grid' ),
|
887 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
888 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
889 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
890 |
'return_value' => 'show',
|
891 |
'default' => 'hide',
|
892 |
]
|
895 |
$ref->add_control(
|
896 |
'show_author_filter',
|
897 |
[
|
898 |
+
'label' => esc_html__( 'Author filter', 'the-post-grid' ),
|
899 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
900 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
901 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
902 |
'return_value' => 'show',
|
903 |
'default' => 'hide',
|
904 |
]
|
907 |
$ref->add_control(
|
908 |
'show_order_by',
|
909 |
[
|
910 |
+
'label' => esc_html__( 'Order By Filter', 'the-post-grid' ),
|
911 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
912 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
913 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
914 |
'return_value' => 'show',
|
915 |
'default' => 'hide',
|
916 |
]
|
919 |
$ref->add_control(
|
920 |
'show_sort_order',
|
921 |
[
|
922 |
+
'label' => esc_html__( 'Sort Order Filter', 'the-post-grid' ),
|
923 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
924 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
925 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
926 |
'return_value' => 'show',
|
927 |
'default' => 'hide',
|
928 |
]
|
931 |
$ref->add_control(
|
932 |
'show_search',
|
933 |
[
|
934 |
+
'label' => esc_html__( 'Search filter', 'the-post-grid' ),
|
935 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
936 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
937 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
938 |
'return_value' => 'show',
|
939 |
'default' => 'hide',
|
940 |
]
|
978 |
$ref->add_control(
|
979 |
'filter_type',
|
980 |
[
|
981 |
+
'label' => esc_html__( 'Filter Type', 'the-post-grid' ),
|
982 |
'type' => \Elementor\Controls_Manager::SELECT,
|
983 |
'default' => 'dropdown',
|
984 |
'options' => [
|
985 |
+
'dropdown' => esc_html__( 'Dropdown', 'the-post-grid' ),
|
986 |
+
'button' => esc_html__( 'Button', 'the-post-grid' ),
|
987 |
],
|
988 |
'render_type' => 'template',
|
989 |
'prefix_class' => 'tpg-filter-type-',
|
995 |
$ref->add_control(
|
996 |
'filter_btn_style',
|
997 |
[
|
998 |
+
'label' => esc_html__( 'Filter Style', 'the-post-grid' ),
|
999 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1000 |
'default' => 'default',
|
1001 |
'options' => [
|
1002 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
1003 |
+
'carousel' => esc_html__( 'Collapsable', 'the-post-grid' ),
|
1004 |
],
|
1005 |
'condition' => [
|
1006 |
'filter_type' => 'button',
|
1007 |
],
|
1008 |
'conditions' => $front_end_filter_condition,
|
1009 |
+
'description' => esc_html__( 'If you use collapsable then only category section show on the filter', 'the-post-grid' ),
|
1010 |
]
|
1011 |
);
|
1012 |
|
1013 |
$ref->add_responsive_control(
|
1014 |
'filter_btn_item_per_page',
|
1015 |
[
|
1016 |
+
'label' => esc_html__( 'Button Item Per Slider', 'the-post-grid' ),
|
1017 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1018 |
'options' => [
|
1019 |
+
'auto' => esc_html__( 'Auto', 'the-post-grid' ),
|
1020 |
+
'2' => esc_html__( '2', 'the-post-grid' ),
|
1021 |
+
'3' => esc_html__( '3', 'the-post-grid' ),
|
1022 |
+
'4' => esc_html__( '4', 'the-post-grid' ),
|
1023 |
+
'5' => esc_html__( '5', 'the-post-grid' ),
|
1024 |
+
'6' => esc_html__( '6', 'the-post-grid' ),
|
1025 |
+
'7' => esc_html__( '7', 'the-post-grid' ),
|
1026 |
+
'8' => esc_html__( '8', 'the-post-grid' ),
|
1027 |
+
'9' => esc_html__( '9', 'the-post-grid' ),
|
1028 |
+
'10' => esc_html__( '10', 'the-post-grid' ),
|
1029 |
+
'11' => esc_html__( '11', 'the-post-grid' ),
|
1030 |
+
'12' => esc_html__( '12', 'the-post-grid' ),
|
1031 |
],
|
1032 |
'default' => 'auto',
|
1033 |
'tablet_default' => 'auto',
|
1037 |
'filter_btn_style' => 'carousel',
|
1038 |
],
|
1039 |
'conditions' => $front_end_filter_condition,
|
1040 |
+
'description' => esc_html__( 'If you use carousel then only category section show on the filter', 'the-post-grid' ),
|
1041 |
]
|
1042 |
);
|
1043 |
|
1087 |
$ref->add_control(
|
1088 |
$post_type . '_filter_taxonomy',
|
1089 |
[
|
1090 |
+
'label' => esc_html__( 'Choose Taxonomy', 'the-post-grid' ),
|
1091 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1092 |
'default' => $default_cat,
|
1093 |
'options' => $taxonomies_list,
|
1095 |
'post_type' => $post_type,
|
1096 |
'show_taxonomy_filter' => 'show',
|
1097 |
],
|
1098 |
+
'description' => esc_html__( 'Select a taxonomy for showing in filter', 'the-post-grid' ),
|
1099 |
]
|
1100 |
);
|
1101 |
|
1108 |
continue;
|
1109 |
}
|
1110 |
|
1111 |
+
$term_first = [ '0' => esc_html__( '--Select--', 'the-post-grid' ) ];
|
1112 |
$term_lists = get_terms(
|
1113 |
[
|
1114 |
'taxonomy' => $tax->name, //Custom taxonomy name
|
1122 |
$ref->add_control(
|
1123 |
$tax->name . '_default_terms',
|
1124 |
[
|
1125 |
+
'label' => esc_html__( 'Default ', 'the-post-grid' ) . $tax->label,
|
1126 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1127 |
'default' => '0',
|
1128 |
'options' => $term_lists,
|
1155 |
$ref->add_control(
|
1156 |
'filter_post_count',
|
1157 |
[
|
1158 |
+
'label' => esc_html__( 'Filter Post Count', 'the-post-grid' ),
|
1159 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1160 |
'default' => 'no',
|
1161 |
'options' => [
|
1162 |
+
'yes' => esc_html__( 'Yes', 'the-post-grid' ),
|
1163 |
+
'no' => esc_html__( 'No', 'the-post-grid' ),
|
1164 |
],
|
1165 |
'conditions' => $front_end_filter_tax_condition,
|
1166 |
]
|
1170 |
$ref->add_control(
|
1171 |
'tgp_filter_taxonomy_hierarchical',
|
1172 |
[
|
1173 |
+
'label' => esc_html__( 'Tax Hierarchical', 'the-post-grid' ),
|
1174 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1175 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
1176 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
1177 |
'return_value' => 'yes',
|
1178 |
'default' => 'yes',
|
1179 |
'conditions' => $front_end_filter_tax_condition,
|
1187 |
$ref->add_control(
|
1188 |
'tpg_hide_all_button',
|
1189 |
[
|
1190 |
+
'label' => esc_html__( 'Hide Show all button', 'the-post-grid' ),
|
1191 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1192 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1193 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1194 |
'return_value' => 'yes',
|
1195 |
'default' => 'yes',
|
1196 |
'conditions' => $front_end_filter_tax_condition,
|
1203 |
$ref->add_control(
|
1204 |
'tax_filter_all_text',
|
1205 |
[
|
1206 |
+
'label' => esc_html__( 'All Taxonomy Text', 'the-post-grid' ),
|
1207 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1208 |
+
'placeholder' => esc_html__( 'Enter All Category Text Here..', 'the-post-grid' ),
|
1209 |
'conditions' => $front_end_filter_tax_condition,
|
1210 |
]
|
1211 |
);
|
1212 |
$ref->add_control(
|
1213 |
'author_filter_all_text',
|
1214 |
[
|
1215 |
+
'label' => esc_html__( 'All Users Text', 'the-post-grid' ),
|
1216 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1217 |
+
'placeholder' => esc_html__( 'Enter All Users Text Here..', 'the-post-grid' ),
|
1218 |
'condition' => [
|
1219 |
'show_author_filter' => 'show',
|
1220 |
'filter_btn_style' => 'default',
|
1245 |
$ref->add_control(
|
1246 |
'list_layout',
|
1247 |
[
|
1248 |
+
'label' => esc_html__( 'Choose Layout', 'the-post-grid' ),
|
1249 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
1250 |
'label_block' => true,
|
1251 |
'options' => [
|
1252 |
'list-layout1' => [
|
1253 |
+
'title' => esc_html__( 'Layout 1', 'the-post-grid' ),
|
1254 |
],
|
1255 |
'list-layout2' => [
|
1256 |
+
'title' => esc_html__( 'Layout 2', 'the-post-grid' ),
|
1257 |
],
|
1258 |
'list-layout2-2' => [
|
1259 |
+
'title' => esc_html__( 'Layout 3', 'the-post-grid' ),
|
1260 |
],
|
1261 |
'list-layout3' => [
|
1262 |
+
'title' => esc_html__( 'Layout 4', 'the-post-grid' ),
|
1263 |
],
|
1264 |
'list-layout3-2' => [
|
1265 |
+
'title' => esc_html__( 'Layout 5', 'the-post-grid' ),
|
1266 |
],
|
1267 |
'list-layout4' => [
|
1268 |
+
'title' => esc_html__( 'Layout 6', 'the-post-grid' ),
|
1269 |
],
|
1270 |
'list-layout5' => [
|
1271 |
+
'title' => esc_html__( 'Layout 7', 'the-post-grid' ),
|
1272 |
],
|
1273 |
],
|
1274 |
'toggle' => false,
|
1281 |
$ref->add_control(
|
1282 |
'layout_options_heading2',
|
1283 |
[
|
1284 |
+
'label' => esc_html__( 'Layout Options:', 'the-post-grid' ),
|
1285 |
'type' => \Elementor\Controls_Manager::HEADING,
|
1286 |
'classes' => 'tpg-control-type-heading',
|
1287 |
]
|
1293 |
'label' => esc_html__( 'Column', 'the-post-grid' ),
|
1294 |
'type' => Controls_Manager::SELECT,
|
1295 |
'options' => [
|
1296 |
+
'0' => esc_html__( 'Default from layout', 'the-post-grid' ),
|
1297 |
+
'12' => esc_html__( '1 Columns', 'the-post-grid' ),
|
1298 |
+
'6' => esc_html__( '2 Columns', 'the-post-grid' ),
|
1299 |
+
'4' => esc_html__( '3 Columns', 'the-post-grid' ),
|
1300 |
+
'3' => esc_html__( '4 Columns', 'the-post-grid' ),
|
1301 |
],
|
1302 |
'default' => '0',
|
1303 |
'tablet_default' => '0',
|
1304 |
'mobile_default' => '0',
|
1305 |
+
'description' => esc_html__( 'Choose Column for layout', 'the-post-grid' ),
|
1306 |
'condition' => [
|
1307 |
'list_layout!' => [ 'list-layout2', 'list-layout2-2', 'list-layout4' ],
|
1308 |
],
|
1313 |
$ref->add_responsive_control(
|
1314 |
'list_layout_alignment',
|
1315 |
[
|
1316 |
+
'label' => esc_html__( 'Vertical Alignment', 'the-post-grid' ),
|
1317 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1318 |
'options' => [
|
1319 |
+
'' => esc_html__( 'Default', 'the-post-grid' ),
|
1320 |
+
'flex-start' => esc_html__( 'Start', 'the-post-grid' ),
|
1321 |
+
'center' => esc_html__( 'Center', 'the-post-grid' ),
|
1322 |
+
'flex-end' => esc_html__( 'End', 'the-post-grid' ),
|
1323 |
+
'space-around' => esc_html__( 'Space Around', 'the-post-grid' ),
|
1324 |
+
'space-between' => esc_html__( 'Space Between', 'the-post-grid' ),
|
1325 |
],
|
1326 |
'selectors' => [
|
1327 |
'{{WRAPPER}} .tpg-el-main-wrapper .list-behaviour .rt-holder .rt-el-content-wrapper' => 'align-items: {{VALUE}};',
|
1335 |
$ref->add_responsive_control(
|
1336 |
'list_left_side_width',
|
1337 |
[
|
1338 |
+
'label' => esc_html__( 'Offset Width', 'the-post-grid' ),
|
1339 |
'type' => Controls_Manager::SLIDER,
|
1340 |
'size_units' => [ '%' ],
|
1341 |
'range' => [
|
1361 |
|
1362 |
|
1363 |
$layout_style_opt = [
|
1364 |
+
'tpg-even' => esc_html__( ucwords( $ref->prefix ) . ' Default', 'the-post-grid' ),
|
1365 |
];
|
1366 |
if ( rtTPG()->hasPro() ) {
|
1367 |
$layout_style_new_opt = [
|
1368 |
+
'masonry' => esc_html__( 'Masonry', 'the-post-grid' ),
|
1369 |
];
|
1370 |
$layout_style_opt = array_merge( $layout_style_opt, $layout_style_new_opt );
|
1371 |
}
|
1373 |
$ref->add_control(
|
1374 |
'list_layout_style',
|
1375 |
[
|
1376 |
+
'label' => esc_html__( 'Layout Style', 'the-post-grid' ),
|
1377 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1378 |
'default' => 'tpg-even',
|
1379 |
'options' => $layout_style_opt,
|
1426 |
$ref->start_controls_section(
|
1427 |
'pagination_settings',
|
1428 |
[
|
1429 |
+
'label' => esc_html__( 'Pagination', 'the-post-grid' ),
|
1430 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
|
1431 |
]
|
1432 |
);
|
1434 |
$ref->add_control(
|
1435 |
'show_pagination',
|
1436 |
[
|
1437 |
+
'label' => esc_html__( 'Show Pagination', 'the-post-grid' ),
|
1438 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1439 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1440 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1441 |
'return_value' => 'show',
|
1442 |
'default' => 'default',
|
1443 |
'render_type' => 'template',
|
1450 |
$ref->add_control(
|
1451 |
'display_per_page',
|
1452 |
[
|
1453 |
+
'label' => esc_html__( 'Display Per Page', 'the-post-grid' ),
|
1454 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
1455 |
'default' => 6,
|
1456 |
+
'description' => esc_html__( 'Enter how may posts will display per page', 'the-post-grid' ),
|
1457 |
'condition' => [
|
1458 |
'show_pagination' => 'show',
|
1459 |
],
|
1468 |
$default_pagination = 'pagination_ajax';
|
1469 |
} else {
|
1470 |
$pagination_type = [
|
1471 |
+
'pagination' => esc_html__( 'Default Pagination', 'the-post-grid' ),
|
1472 |
];
|
1473 |
}
|
1474 |
|
1475 |
if ( rtTPG()->hasPro() ) {
|
1476 |
$pagination_type_pro = [
|
1477 |
+
'pagination_ajax' => esc_html__( 'Ajax Pagination ( Only for Grid )', 'the-post-grid' ),
|
1478 |
+
'load_more' => esc_html__( 'Load More - On Click', 'the-post-grid' ),
|
1479 |
+
'load_on_scroll' => esc_html__( 'Load On Scroll', 'the-post-grid' ),
|
1480 |
];
|
1481 |
$pagination_type = array_merge( $pagination_type, $pagination_type_pro );
|
1482 |
}
|
1484 |
$ref->add_control(
|
1485 |
'pagination_type',
|
1486 |
[
|
1487 |
+
'label' => esc_html__( 'Pagination Type', 'the-post-grid' ),
|
1488 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1489 |
'default' => $default_pagination,
|
1490 |
'options' => $pagination_type,
|
1498 |
$ref->add_control(
|
1499 |
'ajax_pagination_type',
|
1500 |
[
|
1501 |
+
'label' => esc_html__( 'Enable Ajax Next Previous', 'the-post-grid' ),
|
1502 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1503 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
1504 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
1505 |
'return_value' => 'yes',
|
1506 |
'default' => false,
|
1507 |
'condition' => [
|
1516 |
$ref->add_control(
|
1517 |
'load_more_button_text',
|
1518 |
[
|
1519 |
+
'label' => esc_html__( 'Button Text', 'the-post-grid' ),
|
1520 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1521 |
+
'default' => esc_html__( 'Load More', 'the-post-grid' ),
|
1522 |
'condition' => [
|
1523 |
'pagination_type' => 'load_more',
|
1524 |
'show_pagination' => 'show',
|
1549 |
$ref->add_control(
|
1550 |
'show_section_title',
|
1551 |
[
|
1552 |
+
'label' => esc_html__( 'Section Title', 'the-post-grid' ),
|
1553 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1554 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1555 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1556 |
'return_value' => 'show',
|
1557 |
'default' => 'show',
|
1558 |
'render_type' => 'template',
|
1563 |
$ref->add_control(
|
1564 |
'show_title',
|
1565 |
[
|
1566 |
+
'label' => esc_html__( 'Post Title', 'the-post-grid' ),
|
1567 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1568 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1569 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1570 |
'return_value' => 'show',
|
1571 |
'default' => 'show',
|
1572 |
'render_type' => 'template',
|
1581 |
$ref->add_control(
|
1582 |
'show_thumb',
|
1583 |
[
|
1584 |
+
'label' => esc_html__( 'Post Thumbnail', 'the-post-grid' ),
|
1585 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1586 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1587 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1588 |
'return_value' => 'show',
|
1589 |
'default' => 'show',
|
1590 |
'render_type' => 'template',
|
1595 |
$ref->add_control(
|
1596 |
'show_excerpt',
|
1597 |
[
|
1598 |
+
'label' => esc_html__( 'Post Excerpt', 'the-post-grid' ),
|
1599 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1600 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1601 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1602 |
'return_value' => 'show',
|
1603 |
'default' => 'show',
|
1604 |
'render_type' => 'template',
|
1612 |
$ref->add_control(
|
1613 |
'show_meta',
|
1614 |
[
|
1615 |
+
'label' => esc_html__( 'Post Meta', 'the-post-grid' ),
|
1616 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1617 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1618 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1619 |
'return_value' => 'show',
|
1620 |
'default' => 'show',
|
1621 |
'render_type' => 'template',
|
1629 |
$ref->add_control(
|
1630 |
'show_date',
|
1631 |
[
|
1632 |
+
'label' => esc_html__( 'Post Date', 'the-post-grid' ),
|
1633 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1634 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1635 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1636 |
'return_value' => 'show',
|
1637 |
'default' => 'show',
|
1638 |
'render_type' => 'template',
|
1648 |
$ref->add_control(
|
1649 |
'show_category',
|
1650 |
[
|
1651 |
+
'label' => esc_html__( 'Post Categories', 'the-post-grid' ),
|
1652 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1653 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1654 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1655 |
'return_value' => 'show',
|
1656 |
'default' => 'show',
|
1657 |
'render_type' => 'template',
|
1667 |
$ref->add_control(
|
1668 |
'show_author',
|
1669 |
[
|
1670 |
+
'label' => esc_html__( 'Post Author', 'the-post-grid' ),
|
1671 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1672 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1673 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1674 |
'return_value' => 'show',
|
1675 |
'default' => 'show',
|
1676 |
'classes' => 'tpg-padding-left',
|
1684 |
$ref->add_control(
|
1685 |
'show_tags',
|
1686 |
[
|
1687 |
+
'label' => esc_html__( 'Post Tags', 'the-post-grid' ),
|
1688 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1689 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1690 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1691 |
'return_value' => 'show',
|
1692 |
'default' => false,
|
1693 |
'classes' => 'tpg-padding-left',
|
1701 |
$ref->add_control(
|
1702 |
'show_comment_count',
|
1703 |
[
|
1704 |
+
'label' => esc_html__( 'Post Comment Count', 'the-post-grid' ),
|
1705 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1706 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1707 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1708 |
'return_value' => 'show',
|
1709 |
'default' => false,
|
1710 |
'classes' => 'tpg-padding-left',
|
1718 |
$ref->add_control(
|
1719 |
'show_post_count',
|
1720 |
[
|
1721 |
+
'label' => esc_html__( 'Post View Count', 'the-post-grid' ) . $ref->pro_label,
|
1722 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1723 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1724 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1725 |
'return_value' => 'show',
|
1726 |
'default' => false,
|
1727 |
'classes' => rtTPG()->hasPro() ? 'tpg-padding-left' : 'the-post-grid-field-hide tpg-padding-left',
|
1736 |
$ref->add_control(
|
1737 |
'show_read_more',
|
1738 |
[
|
1739 |
+
'label' => esc_html__( 'Read More Button', 'the-post-grid' ),
|
1740 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1741 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1742 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1743 |
'return_value' => 'show',
|
1744 |
'default' => false,
|
1745 |
'condition' => [
|
1751 |
$ref->add_control(
|
1752 |
'show_social_share',
|
1753 |
[
|
1754 |
+
'label' => esc_html__( 'Social Share', 'the-post-grid' ) . $ref->pro_label,
|
1755 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1756 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1757 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1758 |
'return_value' => 'show',
|
1759 |
'default' => 'default',
|
1760 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
1767 |
$ref->add_control(
|
1768 |
'show_woocommerce_rating',
|
1769 |
[
|
1770 |
+
'label' => esc_html__( 'Rating (WooCommerce)', 'the-post-grid' ),
|
1771 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1772 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1773 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1774 |
'return_value' => 'show',
|
1775 |
'default' => 'default',
|
1776 |
'condition' => [
|
1784 |
$ref->add_control(
|
1785 |
'show_acf',
|
1786 |
[
|
1787 |
+
'label' => esc_html__( 'Advanced Custom Field', 'the-post-grid' ) . $ref->pro_label,
|
1788 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1789 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1790 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1791 |
'return_value' => 'show',
|
1792 |
'default' => false,
|
1793 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
1825 |
$ref->add_control(
|
1826 |
'section_title_style',
|
1827 |
[
|
1828 |
+
'label' => esc_html__( 'Section Title Style', 'the-post-grid' ),
|
1829 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1830 |
'default' => 'style1',
|
1831 |
'options' => [
|
1832 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
1833 |
+
'style1' => esc_html__( 'Style 1', 'the-post-grid' ),
|
1834 |
+
'style2' => esc_html__( 'Style 2', 'the-post-grid' ),
|
1835 |
+
'style3' => esc_html__( 'Style 3', 'the-post-grid' ),
|
1836 |
],
|
1837 |
'prefix_class' => 'section-title-style-',
|
1838 |
'render_type' => 'template',
|
1855 |
$ref->add_control(
|
1856 |
'section_title_source',
|
1857 |
[
|
1858 |
+
'label' => esc_html__( 'Title Source', 'the-post-grid' ),
|
1859 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1860 |
'default' => 'custom_title',
|
1861 |
'options' => [
|
1862 |
+
'page_title' => esc_html__( 'Page Title', 'the-post-grid' ),
|
1863 |
+
'custom_title' => esc_html__( 'Custom Title', 'the-post-grid' ),
|
1864 |
],
|
1865 |
'condition' => [
|
1866 |
'show_section_title' => 'show',
|
1872 |
$ref->add_control(
|
1873 |
'section_title_text',
|
1874 |
[
|
1875 |
+
'label' => esc_html__( 'Title', 'the-post-grid' ),
|
1876 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1877 |
+
'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ),
|
1878 |
+
'default' => esc_html__( $default, 'the-post-grid' ),
|
1879 |
'label_block' => true,
|
1880 |
'condition' => [
|
1881 |
'section_title_source' => 'custom_title',
|
1888 |
$ref->add_control(
|
1889 |
'title_prefix',
|
1890 |
[
|
1891 |
+
'label' => esc_html__( 'Title Prefix Text', 'the-post-grid' ),
|
1892 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1893 |
+
'placeholder' => esc_html__( 'Title prefix text', 'the-post-grid' ),
|
1894 |
'condition' => [
|
1895 |
'section_title_source' => 'page_title',
|
1896 |
],
|
1900 |
$ref->add_control(
|
1901 |
'title_suffix',
|
1902 |
[
|
1903 |
+
'label' => esc_html__( 'Title Suffix Text', 'the-post-grid' ),
|
1904 |
'type' => \Elementor\Controls_Manager::TEXT,
|
1905 |
+
'placeholder' => esc_html__( 'Title suffix text', 'the-post-grid' ),
|
1906 |
'condition' => [
|
1907 |
'section_title_source' => 'page_title',
|
1908 |
],
|
1912 |
$ref->add_control(
|
1913 |
'section_title_tag',
|
1914 |
[
|
1915 |
+
'label' => esc_html__( 'Title Tag', 'the-post-grid' ),
|
1916 |
'type' => Controls_Manager::SELECT,
|
1917 |
'default' => 'h2',
|
1918 |
'options' => [
|
1919 |
+
'h1' => esc_html__( 'H1', 'the-post-grid' ),
|
1920 |
+
'h2' => esc_html__( 'H2', 'the-post-grid' ),
|
1921 |
+
'h3' => esc_html__( 'H3', 'the-post-grid' ),
|
1922 |
+
'h4' => esc_html__( 'H4', 'the-post-grid' ),
|
1923 |
+
'h5' => esc_html__( 'H5', 'the-post-grid' ),
|
1924 |
+
'h6' => esc_html__( 'H6', 'the-post-grid' ),
|
1925 |
],
|
1926 |
'condition' => [
|
1927 |
'show_section_title' => 'show',
|
1933 |
$ref->add_control(
|
1934 |
'show_cat_desc',
|
1935 |
[
|
1936 |
+
'label' => esc_html__( 'Show Archive Description', 'the-post-grid' ),
|
1937 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
1938 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
1939 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
1940 |
'return_value' => 'yes',
|
1941 |
'default' => false,
|
1942 |
]
|
1970 |
$ref->add_control(
|
1971 |
'media_source',
|
1972 |
[
|
1973 |
+
'label' => esc_html__( 'Media Source', 'the-post-grid' ),
|
1974 |
'type' => \Elementor\Controls_Manager::SELECT,
|
1975 |
'default' => 'feature_image',
|
1976 |
'options' => [
|
1977 |
+
'feature_image' => esc_html__( 'Feature Image', 'the-post-grid' ),
|
1978 |
+
'first_image' => esc_html__( 'First Image from content', 'the-post-grid' ),
|
1979 |
],
|
1980 |
]
|
1981 |
);
|
2003 |
$ref->add_control(
|
2004 |
'img_crop_style',
|
2005 |
[
|
2006 |
+
'label' => esc_html__( 'Image Crop Style', 'the-post-grid' ),
|
2007 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2008 |
'default' => 'hard',
|
2009 |
'options' => [
|
2010 |
+
'soft' => esc_html__( 'Soft Crop', 'the-post-grid' ),
|
2011 |
+
'hard' => esc_html__( 'Hard Crop', 'the-post-grid' ),
|
2012 |
],
|
2013 |
'condition' => [
|
2014 |
'image_size' => 'custom',
|
2070 |
$ref->add_responsive_control(
|
2071 |
'list_image_side_width',
|
2072 |
[
|
2073 |
+
'label' => esc_html__( 'List Image Width', 'the-post-grid' ),
|
2074 |
'type' => Controls_Manager::SLIDER,
|
2075 |
'size_units' => [ 'px', '%' ],
|
2076 |
'range' => [
|
2098 |
$ref->add_responsive_control(
|
2099 |
'image_height',
|
2100 |
[
|
2101 |
+
'label' => esc_html__( 'Image Height', 'the-post-grid' ),
|
2102 |
'type' => Controls_Manager::SLIDER,
|
2103 |
'size_units' => [ '%', 'px' ],
|
2104 |
'range' => [
|
2124 |
$ref->add_responsive_control(
|
2125 |
'offset_image_height',
|
2126 |
[
|
2127 |
+
'label' => esc_html__( 'Offset Image Height', 'the-post-grid' ),
|
2128 |
'type' => Controls_Manager::SLIDER,
|
2129 |
'size_units' => [ '%', 'px' ],
|
2130 |
'range' => [
|
2150 |
$ref->add_control(
|
2151 |
'hover_animation',
|
2152 |
[
|
2153 |
+
'label' => esc_html__( 'Image Hover Animation', 'the-post-grid' ),
|
2154 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2155 |
'default' => 'default',
|
2156 |
'options' => [
|
2157 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
2158 |
+
'img_zoom_in' => esc_html__( 'Zoom In', 'the-post-grid' ),
|
2159 |
+
'img_zoom_out' => esc_html__( 'Zoom Out', 'the-post-grid' ),
|
2160 |
+
'slide_to_right' => esc_html__( 'Slide to Right', 'the-post-grid' ),
|
2161 |
+
'slide_to_left' => esc_html__( 'Slide to Left', 'the-post-grid' ),
|
2162 |
+
'img_no_effect' => esc_html__( 'None', 'the-post-grid' ),
|
2163 |
],
|
2164 |
'render_type' => 'template',
|
2165 |
'prefix_class' => 'img_hover_animation_',
|
2169 |
$ref->add_control(
|
2170 |
'is_thumb_lightbox',
|
2171 |
[
|
2172 |
+
'label' => esc_html__( 'Light Box', 'the-post-grid' ) . $ref->pro_label,
|
2173 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2174 |
'default' => 'default',
|
2175 |
'options' => [
|
2176 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
2177 |
+
'show' => esc_html__( 'Show', 'the-post-grid' ),
|
2178 |
+
'hide' => esc_html__( 'Hide', 'the-post-grid' ),
|
2179 |
],
|
2180 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
2181 |
]
|
2184 |
$ref->add_control(
|
2185 |
'light_box_icon',
|
2186 |
[
|
2187 |
+
'label' => esc_html__( 'Light Box Icon', 'the-post-grid' ),
|
2188 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2189 |
'default' => [
|
2190 |
'value' => 'fas fa-plus',
|
2199 |
$ref->add_control(
|
2200 |
'is_default_img',
|
2201 |
[
|
2202 |
+
'label' => esc_html__( 'Enable Default Image', 'the-post-grid' ) . $ref->pro_label,
|
2203 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2204 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
2205 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
2206 |
'return_value' => 'yes',
|
2207 |
'default' => false,
|
2208 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
2213 |
$ref->add_control(
|
2214 |
'default_image',
|
2215 |
[
|
2216 |
+
'label' => esc_html__( 'Default Image', 'the-post-grid' ) . $ref->pro_label,
|
2217 |
'type' => \Elementor\Controls_Manager::MEDIA,
|
2218 |
'default' => [
|
2219 |
'url' => rtTPG()->get_assets_uri( 'images/placeholder.png' ),
|
2253 |
$ref->add_control(
|
2254 |
'title_tag',
|
2255 |
[
|
2256 |
+
'label' => esc_html__( 'Title Tag', 'the-post-grid' ),
|
2257 |
'type' => Controls_Manager::SELECT,
|
2258 |
'default' => 'h3',
|
2259 |
'options' => [
|
2260 |
+
'h1' => esc_html__( 'H1', 'the-post-grid' ),
|
2261 |
+
'h2' => esc_html__( 'H2', 'the-post-grid' ),
|
2262 |
+
'h3' => esc_html__( 'H3', 'the-post-grid' ),
|
2263 |
+
'h4' => esc_html__( 'H4', 'the-post-grid' ),
|
2264 |
+
'h5' => esc_html__( 'H5', 'the-post-grid' ),
|
2265 |
+
'h6' => esc_html__( 'H6', 'the-post-grid' ),
|
2266 |
],
|
2267 |
]
|
2268 |
);
|
2270 |
$ref->add_control(
|
2271 |
'title_visibility_style',
|
2272 |
[
|
2273 |
+
'label' => esc_html__( 'Title Visibility Style', 'the-post-grid' ),
|
2274 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2275 |
'default' => 'default',
|
2276 |
'options' => [
|
2277 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
2278 |
+
'one-line' => esc_html__( 'Show in 1 line', 'the-post-grid' ),
|
2279 |
+
'two-line' => esc_html__( 'Show in 2 lines', 'the-post-grid' ),
|
2280 |
+
'three-line' => esc_html__( 'Show in 3 lines', 'the-post-grid' ),
|
2281 |
+
'custom' => esc_html__( 'Custom', 'the-post-grid' ),
|
2282 |
],
|
2283 |
'render_type' => 'template',
|
2284 |
'prefix_class' => 'title-',
|
2288 |
$ref->add_control(
|
2289 |
'title_limit',
|
2290 |
[
|
2291 |
+
'label' => esc_html__( 'Title Length', 'the-post-grid' ),
|
2292 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
2293 |
'step' => 1,
|
2294 |
'classes' => 'tpg-padding-left',
|
2301 |
$ref->add_control(
|
2302 |
'title_limit_type',
|
2303 |
[
|
2304 |
+
'label' => esc_html__( 'Title Crop by', 'the-post-grid' ),
|
2305 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2306 |
'default' => 'word',
|
2307 |
'options' => [
|
2308 |
+
'word' => esc_html__( 'Words', 'the-post-grid' ),
|
2309 |
+
'character' => esc_html__( 'Characters', 'the-post-grid' ),
|
2310 |
],
|
2311 |
'classes' => 'tpg-padding-left',
|
2312 |
'conditions' => [
|
2329 |
);
|
2330 |
|
2331 |
$title_position = [
|
2332 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
2333 |
];
|
2334 |
if ( rtTPG()->hasPro() ) {
|
2335 |
$title_position_pro = [
|
2336 |
+
'above_image' => esc_html__( 'Above Image', 'the-post-grid' ),
|
2337 |
+
'below_image' => esc_html__( 'Below Image', 'the-post-grid' ),
|
2338 |
];
|
2339 |
$title_position = array_merge( $title_position, $title_position_pro );
|
2340 |
}
|
2342 |
$ref->add_control(
|
2343 |
'title_position',
|
2344 |
[
|
2345 |
+
'label' => esc_html__( 'Title Position', 'the-post-grid' ) . $ref->pro_label,
|
2346 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2347 |
'default' => 'default',
|
2348 |
'prefix_class' => 'title_position_',
|
2367 |
$ref->add_control(
|
2368 |
'title_position_hidden',
|
2369 |
[
|
2370 |
+
'label' => esc_html__( 'Title Position', 'the-post-grid' ),
|
2371 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2372 |
'default' => 'default',
|
2373 |
'prefix_class' => 'title_position_',
|
2374 |
'render_type' => 'template',
|
2375 |
'classes' => 'tpg-should-hide-field',
|
2376 |
'options' => [
|
2377 |
+
'default' => esc_html__( 'Default', 'the-post-grid' )
|
2378 |
],
|
2379 |
'condition' => [
|
2380 |
$prefix . '_layout!' => [
|
2393 |
$ref->add_control(
|
2394 |
'title_hover_underline',
|
2395 |
[
|
2396 |
+
'label' => esc_html__( 'Title Hover Underline', 'the-post-grid' ),
|
2397 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2398 |
'default' => 'default',
|
2399 |
'prefix_class' => 'title_hover_border_',
|
2400 |
'render_type' => 'template',
|
2401 |
'options' => [
|
2402 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
2403 |
+
'enable' => esc_html__( 'Enable', 'the-post-grid' ),
|
2404 |
+
'disable' => esc_html__( 'Disable', 'the-post-grid' ),
|
2405 |
],
|
2406 |
]
|
2407 |
);
|
2433 |
);
|
2434 |
|
2435 |
$excerpt_type = [
|
2436 |
+
'character' => esc_html__( 'Character', 'the-post-grid' ),
|
2437 |
+
'word' => esc_html__( 'Word', 'the-post-grid' ),
|
2438 |
];
|
2439 |
|
2440 |
|
2441 |
if ( in_array( $prefix, [ 'grid', 'list' ] ) ) {
|
2442 |
+
$excerpt_type['full'] = esc_html__( 'Full Content', 'the-post-grid' );
|
2443 |
}
|
2444 |
|
2445 |
$ref->add_control(
|
2446 |
'excerpt_type',
|
2447 |
[
|
2448 |
+
'label' => esc_html__( 'Excerpt Type', 'the-post-grid' ),
|
2449 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2450 |
'default' => 'character',
|
2451 |
'options' => $excerpt_type,
|
2460 |
$ref->add_control(
|
2461 |
'excerpt_limit',
|
2462 |
[
|
2463 |
+
'label' => esc_html__( 'Excerpt Limit', 'the-post-grid' ),
|
2464 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
2465 |
'step' => 1,
|
2466 |
'default' => $default_excerpt_limit,
|
2473 |
$ref->add_control(
|
2474 |
'excerpt_more_text',
|
2475 |
[
|
2476 |
+
'label' => esc_html__( 'Expansion Indicator', 'the-post-grid' ),
|
2477 |
'type' => \Elementor\Controls_Manager::TEXT,
|
2478 |
'default' => '...',
|
2479 |
'condition' => [
|
2542 |
);
|
2543 |
|
2544 |
$meta_position = [
|
2545 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
2546 |
];
|
2547 |
if ( rtTPG()->hasPro() ) {
|
2548 |
$meta_position_pro = [
|
2549 |
+
'above_title' => esc_html__( 'Above Title', 'the-post-grid' ),
|
2550 |
+
'below_title' => esc_html__( 'Below Title', 'the-post-grid' ),
|
2551 |
+
'above_excerpt' => esc_html__( 'Above excerpt', 'the-post-grid' ),
|
2552 |
+
'below_excerpt' => esc_html__( 'Below excerpt', 'the-post-grid' ),
|
2553 |
];
|
2554 |
$meta_position = array_merge( $meta_position, $meta_position_pro );
|
2555 |
}
|
2557 |
$ref->add_control(
|
2558 |
'meta_position',
|
2559 |
[
|
2560 |
+
'label' => esc_html__( 'Meta Position', 'the-post-grid' ) . $ref->pro_label,
|
2561 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2562 |
'default' => 'default',
|
2563 |
'prefix_class' => 'meta_position_',
|
2570 |
$ref->add_control(
|
2571 |
'show_meta_icon',
|
2572 |
[
|
2573 |
+
'label' => esc_html__( 'Show Meta Icon', 'the-post-grid' ),
|
2574 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2575 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
2576 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
2577 |
'return_value' => 'yes',
|
2578 |
'default' => 'yes',
|
2579 |
]
|
2582 |
$ref->add_control(
|
2583 |
'meta_separator',
|
2584 |
[
|
2585 |
+
'label' => esc_html__( 'Meta Separator', 'the-post-grid' ),
|
2586 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2587 |
'default' => 'default',
|
2588 |
'options' => [
|
2589 |
+
'default' => esc_html__( 'Default - None', 'the-post-grid' ),
|
2590 |
+
'.' => esc_html__( 'Dot ( . )', 'the-post-grid' ),
|
2591 |
+
'/' => esc_html__( 'Single Slash ( / )', 'the-post-grid' ),
|
2592 |
+
'//' => esc_html__( 'Double Slash ( // )', 'the-post-grid' ),
|
2593 |
+
'-' => esc_html__( 'Hyphen ( - )', 'the-post-grid' ),
|
2594 |
+
'|' => esc_html__( 'Vertical Pipe ( | )', 'the-post-grid' ),
|
2595 |
],
|
2596 |
]
|
2597 |
);
|
2600 |
$ref->add_control(
|
2601 |
'meta_popover_toggle',
|
2602 |
[
|
2603 |
+
'label' => esc_html__( 'Change Meta Icon', 'the-post-grid' ),
|
2604 |
'type' => \Elementor\Controls_Manager::POPOVER_TOGGLE,
|
2605 |
+
'label_off' => esc_html__( 'Default', 'the-post-grid' ),
|
2606 |
+
'label_on' => esc_html__( 'Custom', 'the-post-grid' ),
|
2607 |
'return_value' => 'yes',
|
2608 |
'condition' => [
|
2609 |
'show_meta_icon' => 'yes',
|
2616 |
$ref->add_control(
|
2617 |
'user_icon',
|
2618 |
[
|
2619 |
+
'label' => esc_html__( 'Author Icon', 'the-post-grid' ),
|
2620 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2621 |
'default' => [
|
2622 |
'value' => 'fas fa-user',
|
2631 |
$ref->add_control(
|
2632 |
'cat_icon',
|
2633 |
[
|
2634 |
+
'label' => esc_html__( 'Category Icon', 'the-post-grid' ),
|
2635 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2636 |
'default' => [
|
2637 |
'value' => 'fas fa-folder-open',
|
2646 |
$ref->add_control(
|
2647 |
'date_icon',
|
2648 |
[
|
2649 |
+
'label' => esc_html__( 'Date Icon', 'the-post-grid' ),
|
2650 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2651 |
'default' => [
|
2652 |
'value' => 'far fa-calendar-alt',
|
2661 |
$ref->add_control(
|
2662 |
'tag_icon',
|
2663 |
[
|
2664 |
+
'label' => esc_html__( 'Tags Icon', 'the-post-grid' ),
|
2665 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2666 |
'default' => [
|
2667 |
'value' => 'fa fa-tags',
|
2676 |
$ref->add_control(
|
2677 |
'comment_icon',
|
2678 |
[
|
2679 |
+
'label' => esc_html__( 'Comment Icon', 'the-post-grid' ),
|
2680 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2681 |
'default' => [
|
2682 |
'value' => 'fas fa-comments',
|
2691 |
$ref->add_control(
|
2692 |
'post_count_icon',
|
2693 |
[
|
2694 |
+
'label' => esc_html__( 'Post Count Icon', 'the-post-grid' ),
|
2695 |
'type' => \Elementor\Controls_Manager::ICONS,
|
2696 |
'default' => [
|
2697 |
'value' => 'fas fa-eye',
|
2724 |
$ref->add_control(
|
2725 |
'meta_author_heading',
|
2726 |
[
|
2727 |
+
'label' => esc_html__( 'Author Setting:', 'the-post-grid' ),
|
2728 |
'type' => \Elementor\Controls_Manager::HEADING,
|
2729 |
'classes' => 'tpg-control-type-heading',
|
2730 |
'condition' => [
|
2736 |
$ref->add_control(
|
2737 |
'author_prefix',
|
2738 |
[
|
2739 |
+
'label' => esc_html__( 'Author Prefix', 'the-post-grid' ),
|
2740 |
'type' => \Elementor\Controls_Manager::TEXT,
|
2741 |
+
'placeholder' => esc_html__( 'By', 'the-post-grid' ),
|
2742 |
'condition' => [
|
2743 |
'show_author!' => '',
|
2744 |
],
|
2748 |
$ref->add_control(
|
2749 |
'author_icon_visibility',
|
2750 |
[
|
2751 |
+
'label' => esc_html__( 'Author Icon Visibility', 'the-post-grid' ),
|
2752 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2753 |
'default' => 'default',
|
2754 |
'options' => [
|
2755 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
2756 |
+
'hide' => esc_html__( 'Hide', 'the-post-grid' ),
|
2757 |
+
'show' => esc_html__( 'Show', 'the-post-grid' ),
|
2758 |
],
|
2759 |
'condition' => [
|
2760 |
'show_author!' => '',
|
2766 |
$ref->add_control(
|
2767 |
'show_author_image',
|
2768 |
[
|
2769 |
+
'label' => esc_html__( 'Author Image / Icon', 'the-post-grid' ),
|
2770 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2771 |
+
'label_on' => esc_html__( 'Image', 'the-post-grid' ),
|
2772 |
+
'label_off' => esc_html__( 'Icon', 'the-post-grid' ),
|
2773 |
'return_value' => 'show',
|
2774 |
'default' => 'show',
|
2775 |
'render_type' => 'template',
|
2785 |
$ref->add_responsive_control(
|
2786 |
'author_icon_width',
|
2787 |
[
|
2788 |
+
'label' => esc_html__( 'Author Image Width', 'the-post-grid' ),
|
2789 |
'type' => Controls_Manager::SLIDER,
|
2790 |
'size_units' => [ 'px' ],
|
2791 |
'range' => [
|
2813 |
$ref->add_control(
|
2814 |
'category_heading',
|
2815 |
[
|
2816 |
+
'label' => esc_html__( 'Category and Tags Setting:', 'the-post-grid' ),
|
2817 |
'type' => \Elementor\Controls_Manager::HEADING,
|
2818 |
'classes' => 'tpg-control-type-heading',
|
2819 |
'conditions' => [
|
2838 |
$ref->add_control(
|
2839 |
'category_position',
|
2840 |
[
|
2841 |
+
'label' => esc_html__( 'Category Position', 'the-post-grid' ) . $ref->pro_label,
|
2842 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2843 |
'default' => 'default',
|
2844 |
'options' => [
|
2845 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
2846 |
+
'above_title' => esc_html__( 'Above Title', 'the-post-grid' ),
|
2847 |
+
'with_meta' => esc_html__( 'With Meta', 'the-post-grid' ),
|
2848 |
+
'top_left' => esc_html__( 'Over image (Top Left)', 'the-post-grid' ),
|
2849 |
+
'top_right' => esc_html__( 'Over image (Top Right)', 'the-post-grid' ),
|
2850 |
+
'bottom_left' => esc_html__( 'Over image (Bottom Left)', 'the-post-grid' ),
|
2851 |
+
'bottom_right' => esc_html__( 'Over image (Bottom Right)', 'the-post-grid' ),
|
2852 |
+
'image_center' => esc_html__( 'Over image (Center)', 'the-post-grid' ),
|
2853 |
],
|
2854 |
'condition' => [
|
2855 |
'show_category' => 'show',
|
2864 |
$ref->add_control(
|
2865 |
'category_style',
|
2866 |
[
|
2867 |
+
'label' => esc_html__( 'Category Style', 'the-post-grid' ) . $ref->pro_label,
|
2868 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2869 |
'default' => 'style1',
|
2870 |
'options' => [
|
2871 |
+
'style1' => esc_html__( 'Style 1', 'the-post-grid' ),
|
2872 |
+
'style2' => esc_html__( 'Style 2', 'the-post-grid' ),
|
2873 |
+
'style3' => esc_html__( 'Style 3', 'the-post-grid' ),
|
2874 |
],
|
2875 |
'classes' => rtTPG()->hasPro() ? '' : 'the-post-grid-field-hide',
|
2876 |
'condition' => [
|
2883 |
$ref->add_control(
|
2884 |
'show_cat_icon',
|
2885 |
[
|
2886 |
+
'label' => esc_html__( 'Show Over Image Category Icon', 'the-post-grid' ),
|
2887 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2888 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
2889 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
2890 |
'return_value' => 'yes',
|
2891 |
'default' => false,
|
2892 |
'condition' => [
|
2951 |
$ref->add_control(
|
2952 |
$post_type . '_taxonomy',
|
2953 |
[
|
2954 |
+
'label' => esc_html__( 'Category Source', 'the-post-grid' ),
|
2955 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2956 |
'default' => $default_cat,
|
2957 |
'options' => $term_options,
|
2959 |
'show_category' => 'show',
|
2960 |
'post_type' => $post_type,
|
2961 |
],
|
2962 |
+
'description' => esc_html__( 'Select which taxonomy should sit in the place of categories. Default: Category', 'the-post-grid' ),
|
2963 |
]
|
2964 |
);
|
2965 |
|
2966 |
$ref->add_control(
|
2967 |
$post_type . '_tags',
|
2968 |
[
|
2969 |
+
'label' => esc_html__( 'Tags Source', 'the-post-grid' ),
|
2970 |
'type' => \Elementor\Controls_Manager::SELECT,
|
2971 |
'default' => $default_tag,
|
2972 |
'options' => $term_options,
|
2974 |
'show_category' => 'show',
|
2975 |
'post_type' => $post_type,
|
2976 |
],
|
2977 |
+
'description' => esc_html__( 'Select which taxonomy should sit in the place of tags. Default: Tags', 'the-post-grid' ),
|
2978 |
]
|
2979 |
);
|
2980 |
}
|
2982 |
$ref->add_control(
|
2983 |
'comment_count_heading',
|
2984 |
[
|
2985 |
+
'label' => esc_html__( 'Comment Count ', 'the-post-grid' ),
|
2986 |
'type' => \Elementor\Controls_Manager::HEADING,
|
2987 |
'classes' => 'tpg-control-type-heading',
|
2988 |
'condition' => [
|
2994 |
$ref->add_control(
|
2995 |
'show_comment_count_label',
|
2996 |
[
|
2997 |
+
'label' => esc_html__( 'Show Comment Label', 'the-post-grid' ),
|
2998 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
2999 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
3000 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
3001 |
'return_value' => 'yes',
|
3002 |
'default' => 'yes',
|
3003 |
'condition' => [
|
3009 |
$ref->add_control(
|
3010 |
'comment_count_label_singular',
|
3011 |
[
|
3012 |
+
'label' => esc_html__( 'Comment Label Singular', 'the-post-grid' ),
|
3013 |
'type' => \Elementor\Controls_Manager::TEXT,
|
3014 |
+
'default' => esc_html__( 'Comment', 'the-post-grid' ),
|
3015 |
+
'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ),
|
3016 |
'condition' => [
|
3017 |
'show_comment_count' => 'show',
|
3018 |
'show_comment_count_label' => 'yes',
|
3023 |
$ref->add_control(
|
3024 |
'comment_count_label_plural',
|
3025 |
[
|
3026 |
+
'label' => esc_html__( 'Comment Label Plural', 'the-post-grid' ),
|
3027 |
'type' => \Elementor\Controls_Manager::TEXT,
|
3028 |
+
'default' => esc_html__( 'Comments', 'the-post-grid' ),
|
3029 |
+
'placeholder' => esc_html__( 'Type your title here', 'the-post-grid' ),
|
3030 |
'condition' => [
|
3031 |
'show_comment_count' => 'show',
|
3032 |
'show_comment_count_label' => 'yes',
|
3037 |
$ref->add_control(
|
3038 |
'meta_ordering_heading',
|
3039 |
[
|
3040 |
+
'label' => esc_html__( 'Meta Ordering', 'the-post-grid' ),
|
3041 |
'type' => \Elementor\Controls_Manager::HEADING,
|
3042 |
'classes' => 'tpg-control-type-heading',
|
3043 |
]
|
3122 |
$ref->add_control(
|
3123 |
'readmore_btn_style',
|
3124 |
[
|
3125 |
+
'label' => esc_html__( 'Button Style', 'the-post-grid' ),
|
3126 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3127 |
'default' => 'default-style',
|
3128 |
'options' => [
|
3129 |
+
'default-style' => esc_html__( 'Default from style', 'the-post-grid' ),
|
3130 |
+
'only-text' => esc_html__( 'Only Text Button', 'the-post-grid' ),
|
3131 |
],
|
3132 |
'prefix_class' => 'readmore-btn-',
|
3133 |
]
|
3136 |
$ref->add_control(
|
3137 |
'read_more_label',
|
3138 |
[
|
3139 |
+
'label' => esc_html__( 'Read More Label', 'the-post-grid' ),
|
3140 |
'type' => \Elementor\Controls_Manager::TEXT,
|
3141 |
+
'default' => esc_html__( 'Read More', 'the-post-grid' ),
|
3142 |
+
'placeholder' => esc_html__( 'Type Read More Label here', 'the-post-grid' ),
|
3143 |
]
|
3144 |
);
|
3145 |
|
3147 |
$ref->add_control(
|
3148 |
'show_btn_icon',
|
3149 |
[
|
3150 |
+
'label' => esc_html__( 'Show Button Icon', 'the-post-grid' ),
|
3151 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3152 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
3153 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
3154 |
'return_value' => 'yes',
|
3155 |
'default' => false,
|
3156 |
]
|
3159 |
$ref->add_control(
|
3160 |
'readmore_btn_icon',
|
3161 |
[
|
3162 |
+
'label' => esc_html__( 'Choose Icon', 'the-post-grid' ),
|
3163 |
'type' => \Elementor\Controls_Manager::ICONS,
|
3164 |
'default' => [
|
3165 |
'value' => 'fas fa-angle-right',
|
3210 |
// $ref->add_control(
|
3211 |
// 'cf_group',
|
3212 |
// [
|
3213 |
+
// 'label' => esc_html__( 'Choose Advanced Custom Field (ACF)', 'the-post-grid' ),
|
3214 |
// 'type' => \Elementor\Controls_Manager::SELECT2,
|
3215 |
// 'multiple' => true,
|
3216 |
// 'label_block' => true,
|
3234 |
$ref->add_control(
|
3235 |
$post_type . '_cf_group',
|
3236 |
[
|
3237 |
+
'label' => esc_html__( "Choose Advanced Custom Field (ACF)", 'the-post-grid' ),
|
3238 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
3239 |
'label_block' => true,
|
3240 |
'multiple' => true,
|
3250 |
$ref->add_control(
|
3251 |
'cf_hide_empty_value',
|
3252 |
[
|
3253 |
+
'label' => esc_html__( 'Hide field with empty value?', 'the-post-grid' ),
|
3254 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3255 |
+
'label_on' => esc_html__( 'No', 'the-post-grid' ),
|
3256 |
+
'label_off' => esc_html__( 'Yes', 'the-post-grid' ),
|
3257 |
'return_value' => 'yes',
|
3258 |
'default' => 'yes',
|
3259 |
]
|
3262 |
$ref->add_control(
|
3263 |
'cf_hide_group_title',
|
3264 |
[
|
3265 |
+
'label' => esc_html__( 'Show group title?', 'the-post-grid' ),
|
3266 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3267 |
+
'label_on' => esc_html__( 'No', 'the-post-grid' ),
|
3268 |
+
'label_off' => esc_html__( 'Yes', 'the-post-grid' ),
|
3269 |
'return_value' => 'yes',
|
3270 |
'default' => 'yes',
|
3271 |
]
|
3274 |
$ref->add_control(
|
3275 |
'cf_show_only_value',
|
3276 |
[
|
3277 |
+
'label' => esc_html__( 'Show label?', 'the-post-grid' ),
|
3278 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3279 |
+
'label_on' => esc_html__( 'No', 'the-post-grid' ),
|
3280 |
+
'label_off' => esc_html__( 'Yes', 'the-post-grid' ),
|
3281 |
'return_value' => 'yes',
|
3282 |
'default' => 'yes',
|
3283 |
]
|
3306 |
);
|
3307 |
|
3308 |
$link_type = [
|
3309 |
+
'default' => esc_html__( 'Link to details page', 'the-post-grid' ),
|
3310 |
];
|
3311 |
if ( rtTPG()->hasPro() ) {
|
3312 |
+
$link_type['popup'] = esc_html__( 'Single Popup', 'the-post-grid' );
|
3313 |
+
$link_type['multi_popup'] = esc_html__( 'Multi Popup', 'the-post-grid' );
|
3314 |
}
|
3315 |
+
$link_type['none'] = esc_html__( 'No Link', 'the-post-grid' );
|
3316 |
|
3317 |
$ref->add_control(
|
3318 |
'post_link_type',
|
3319 |
[
|
3320 |
+
'label' => esc_html__( 'Post link type', 'the-post-grid' ),
|
3321 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3322 |
'default' => 'default',
|
3323 |
'options' => $link_type,
|
3328 |
$ref->add_control(
|
3329 |
'link_target',
|
3330 |
[
|
3331 |
+
'label' => esc_html__( 'Link Target', 'the-post-grid' ),
|
3332 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3333 |
'default' => '_self',
|
3334 |
'options' => [
|
3335 |
+
'_self' => esc_html__( 'Same Window', 'the-post-grid' ),
|
3336 |
+
'_blank' => esc_html__( 'New Window', 'the-post-grid' ),
|
3337 |
],
|
3338 |
'condition' => [
|
3339 |
'post_link_type' => 'default',
|
3344 |
$ref->add_control(
|
3345 |
'is_thumb_linked',
|
3346 |
[
|
3347 |
+
'label' => esc_html__( 'Thumbnail Link', 'the-post-grid' ),
|
3348 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
3349 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
3350 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
3351 |
'return_value' => 'yes',
|
3352 |
'default' => 'yes',
|
3353 |
]
|
3421 |
$ref->add_control(
|
3422 |
'section_title_alignment',
|
3423 |
[
|
3424 |
+
'label' => esc_html__( 'Alignment', 'the-post-grid' ),
|
3425 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
3426 |
'options' => [
|
3427 |
'left' => [
|
3428 |
+
'title' => esc_html__( 'Left', 'the-post-grid' ),
|
3429 |
'icon' => 'eicon-text-align-left',
|
3430 |
],
|
3431 |
'center' => [
|
3432 |
+
'title' => esc_html__( 'Center', 'the-post-grid' ),
|
3433 |
'icon' => 'eicon-text-align-center',
|
3434 |
],
|
3435 |
'right' => [
|
3436 |
+
'title' => esc_html__( 'Right', 'the-post-grid' ),
|
3437 |
'icon' => 'eicon-text-align-right',
|
3438 |
],
|
3439 |
],
|
3447 |
$ref->add_responsive_control(
|
3448 |
'section_title_margin',
|
3449 |
[
|
3450 |
+
'label' => esc_html__( 'Margin Y axis', 'the-post-grid' ),
|
3451 |
'type' => Controls_Manager::DIMENSIONS,
|
3452 |
'size_units' => [ 'px' ],
|
3453 |
'allowed_dimensions' => 'vertical', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
|
3468 |
$ref->add_responsive_control(
|
3469 |
'section_title_padding',
|
3470 |
[
|
3471 |
+
'label' => esc_html__( 'Padding', 'the-post-grid' ),
|
3472 |
'type' => Controls_Manager::DIMENSIONS,
|
3473 |
'size_units' => [ 'px' ],
|
3474 |
'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
|
3490 |
\Elementor\Group_Control_Typography::get_type(),
|
3491 |
[
|
3492 |
'name' => 'section_title_typography',
|
3493 |
+
'label' => esc_html__( 'Typography', 'the-post-grid' ),
|
3494 |
'selector' => '{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading',
|
3495 |
]
|
3496 |
);
|
3498 |
$ref->add_control(
|
3499 |
'section_title_color',
|
3500 |
[
|
3501 |
+
'label' => esc_html__( 'Title Color', 'the-post-grid' ),
|
3502 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3503 |
'selectors' => [
|
3504 |
'{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading' => 'color: {{VALUE}}',
|
3509 |
$ref->add_control(
|
3510 |
'section_title_bg_color',
|
3511 |
[
|
3512 |
+
'label' => esc_html__( 'Title Background Color', 'the-post-grid' ),
|
3513 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3514 |
'selectors' => [
|
3515 |
'{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style2 .tpg-widget-heading, {{WRAPPER}} .tpg-widget-heading-wrapper.heading-style3 .tpg-widget-heading' => 'background-color: {{VALUE}}',
|
3525 |
$ref->add_control(
|
3526 |
'section_title_dot_color',
|
3527 |
[
|
3528 |
+
'label' => esc_html__( 'Dot Color', 'the-post-grid' ),
|
3529 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3530 |
'selectors' => [
|
3531 |
'{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading::before' => 'background-color: {{VALUE}}',
|
3539 |
$ref->add_control(
|
3540 |
'section_title_line_color',
|
3541 |
[
|
3542 |
+
'label' => esc_html__( 'Line / Border Color', 'the-post-grid' ),
|
3543 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3544 |
'selectors' => [
|
3545 |
'{{WRAPPER}} .tpg-widget-heading-wrapper.heading-style1 .tpg-widget-heading-line' => 'border-color: {{VALUE}}',
|
3559 |
$ref->add_control(
|
3560 |
'prefix_text_color',
|
3561 |
[
|
3562 |
+
'label' => esc_html__( 'Prefix Color', 'the-post-grid' ),
|
3563 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3564 |
'selectors' => [
|
3565 |
'{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .prefix-text' => 'color: {{VALUE}}',
|
3572 |
$ref->add_control(
|
3573 |
'suffix_text_color',
|
3574 |
[
|
3575 |
+
'label' => esc_html__( 'Suffix Color', 'the-post-grid' ),
|
3576 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3577 |
'selectors' => [
|
3578 |
'{{WRAPPER}} .tpg-widget-heading-wrapper .tpg-widget-heading .suffix-text' => 'color: {{VALUE}}',
|
3588 |
$ref->add_control(
|
3589 |
'cat_tag_description_heading',
|
3590 |
[
|
3591 |
+
'label' => esc_html__( 'Category / Tag Description', 'the-post-grid' ),
|
3592 |
'type' => \Elementor\Controls_Manager::HEADING,
|
3593 |
'classes' => 'tpg-control-type-heading',
|
3594 |
'condition' => [
|
3601 |
\Elementor\Group_Control_Typography::get_type(),
|
3602 |
[
|
3603 |
'name' => 'taxonomy_des_typography',
|
3604 |
+
'label' => esc_html__( 'Description Typography', 'the-post-grid' ),
|
3605 |
'selector' => '{{WRAPPER}} .tpg-category-description',
|
3606 |
'condition' => [
|
3607 |
'show_cat_desc' => 'yes',
|
3612 |
$ref->add_responsive_control(
|
3613 |
'taxonomy_des_alignment',
|
3614 |
[
|
3615 |
+
'label' => esc_html__( 'Alignment', 'the-post-grid' ),
|
3616 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
3617 |
'options' => [
|
3618 |
'left' => [
|
3619 |
+
'title' => esc_html__( 'Left', 'the-post-grid' ),
|
3620 |
'icon' => 'eicon-text-align-left',
|
3621 |
],
|
3622 |
'center' => [
|
3623 |
+
'title' => esc_html__( 'Center', 'the-post-grid' ),
|
3624 |
'icon' => 'eicon-text-align-center',
|
3625 |
],
|
3626 |
'right' => [
|
3627 |
+
'title' => esc_html__( 'Right', 'the-post-grid' ),
|
3628 |
'icon' => 'eicon-text-align-right',
|
3629 |
],
|
3630 |
],
|
3640 |
$ref->add_control(
|
3641 |
'taxonomy_des_color',
|
3642 |
[
|
3643 |
+
'label' => esc_html__( 'Title Color', 'the-post-grid' ),
|
3644 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3645 |
'selectors' => [
|
3646 |
'{{WRAPPER}} .tpg-category-description' => 'color: {{VALUE}}',
|
3654 |
$ref->add_responsive_control(
|
3655 |
'taxonomy_des_dimension',
|
3656 |
[
|
3657 |
+
'label' => esc_html__( 'Padding', 'the-post-grid' ),
|
3658 |
'type' => Controls_Manager::DIMENSIONS,
|
3659 |
'size_units' => [ 'px' ],
|
3660 |
'selectors' => [
|
3683 |
$ref->start_controls_section(
|
3684 |
'thumbnail_style',
|
3685 |
[
|
3686 |
+
'label' => esc_html__( 'Thumbnail', 'the-post-grid' ),
|
3687 |
'tab' => Controls_Manager::TAB_STYLE,
|
3688 |
'condition' => [
|
3689 |
'show_thumb' => 'show',
|
3694 |
$ref->add_responsive_control(
|
3695 |
'img_border_radius',
|
3696 |
[
|
3697 |
+
'label' => esc_html__( 'Border Radius', 'the-post-grid' ) . $ref->pro_label,
|
3698 |
'type' => Controls_Manager::DIMENSIONS,
|
3699 |
'size_units' => [ 'px', '%', 'em' ],
|
3700 |
'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
|
3716 |
$ref->add_control(
|
3717 |
'image_width',
|
3718 |
[
|
3719 |
+
'label' => esc_html__( 'Image Width (Optional)', 'the-post-grid' ),
|
3720 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3721 |
'default' => 'inherit',
|
3722 |
'options' => [
|
3723 |
+
'inherit' => esc_html__( 'Default', 'the-post-grid' ),
|
3724 |
+
'100%' => esc_html__( '100%', 'the-post-grid' ),
|
3725 |
+
'auto' => esc_html__( 'Auto', 'the-post-grid' ),
|
3726 |
],
|
3727 |
'selectors' => [
|
3728 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap img' => 'width: {{VALUE}};',
|
3734 |
$ref->add_responsive_control(
|
3735 |
'thumbnail_spacing',
|
3736 |
[
|
3737 |
+
'label' => esc_html__( 'Thumbnail Margin', 'the-post-grid' ),
|
3738 |
'type' => Controls_Manager::DIMENSIONS,
|
3739 |
'size_units' => [ 'px' ],
|
3740 |
'selectors' => [
|
3771 |
$ref->add_responsive_control(
|
3772 |
'grid_hover_thumbnail_margin',
|
3773 |
[
|
3774 |
+
'label' => esc_html__( 'Thumbnail padding', 'the-post-grid' ),
|
3775 |
'type' => Controls_Manager::DIMENSIONS,
|
3776 |
'size_units' => [ 'px' ],
|
3777 |
'selectors' => [
|
3788 |
$ref->add_control(
|
3789 |
'thumb_overlay_style_heading',
|
3790 |
[
|
3791 |
+
'label' => esc_html__( 'Overlay Style:', 'the-post-grid' ),
|
3792 |
'type' => \Elementor\Controls_Manager::HEADING,
|
3793 |
'classes' => 'tpg-control-type-heading',
|
3794 |
]
|
3802 |
$ref->start_controls_tab(
|
3803 |
'grid_hover_style_normal_tab',
|
3804 |
[
|
3805 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
3806 |
]
|
3807 |
);
|
3808 |
|
3810 |
\Elementor\Group_Control_Background::get_type(),
|
3811 |
[
|
3812 |
'name' => 'grid_hover_overlay_color',
|
3813 |
+
'label' => esc_html__( 'Overlay BG', 'the-post-grid' ),
|
3814 |
'types' => [ 'classic', 'gradient' ],
|
3815 |
'selector' => '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content:before, {{WRAPPER}} .tpg-el-main-wrapper .tpg-el-image-wrap .overlay',
|
3816 |
'exclude' => [ 'image' ],
|
3831 |
$ref->add_control(
|
3832 |
'thumb_lightbox_bg',
|
3833 |
[
|
3834 |
+
'label' => esc_html__( 'Light Box Background', 'the-post-grid' ),
|
3835 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3836 |
'selectors' => [
|
3837 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}',
|
3845 |
$ref->add_control(
|
3846 |
'thumb_lightbox_color',
|
3847 |
[
|
3848 |
+
'label' => esc_html__( 'Light Box Color', 'the-post-grid' ),
|
3849 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3850 |
'selectors' => [
|
3851 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}',
|
3862 |
$ref->start_controls_tab(
|
3863 |
'grid_hover_style_hover_tab',
|
3864 |
[
|
3865 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
3866 |
]
|
3867 |
);
|
3868 |
|
3870 |
\Elementor\Group_Control_Background::get_type(),
|
3871 |
[
|
3872 |
'name' => 'grid_hover_overlay_color_hover',
|
3873 |
+
'label' => esc_html__( 'Overlay BG - Hover', 'the-post-grid' ),
|
3874 |
'types' => [ 'classic', 'gradient' ],
|
3875 |
'selector' => '{{WRAPPER}} .rt-tpg-container .rt-grid-hover-item .rt-holder .grid-hover-content:after, {{WRAPPER}} .tpg-el-main-wrapper .rt-holder:hover .tpg-el-image-wrap .overlay',
|
3876 |
'exclude' => [ 'image' ],
|
3892 |
$ref->add_control(
|
3893 |
'thumb_lightbox_bg_hover',
|
3894 |
[
|
3895 |
+
'label' => esc_html__( 'Light Box Background - Hover', 'the-post-grid' ),
|
3896 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3897 |
'selectors' => [
|
3898 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'background-color: {{VALUE}}',
|
3906 |
$ref->add_control(
|
3907 |
'thumb_lightbox_color_hover',
|
3908 |
[
|
3909 |
+
'label' => esc_html__( 'Light Box Color - Hover', 'the-post-grid' ),
|
3910 |
'type' => \Elementor\Controls_Manager::COLOR,
|
3911 |
'selectors' => [
|
3912 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .rt-img-holder .tpg-zoom .fa' => 'color: {{VALUE}}',
|
3929 |
);
|
3930 |
|
3931 |
$overlay_type_opt = [
|
3932 |
+
'always' => esc_html__( 'Show Always', 'the-post-grid' ),
|
3933 |
+
'fadein-on-hover' => esc_html__( 'FadeIn on hover', 'the-post-grid' ),
|
3934 |
+
'fadeout-on-hover' => esc_html__( 'FadeOut on hover', 'the-post-grid' ),
|
3935 |
+
'slidein-on-hover' => esc_html__( 'SlideIn on hover', 'the-post-grid' ),
|
3936 |
+
'slideout-on-hover' => esc_html__( 'SlideOut on hover', 'the-post-grid' ),
|
3937 |
+
'zoomin-on-hover' => esc_html__( 'ZoomIn on hover', 'the-post-grid' ),
|
3938 |
+
'zoomout-on-hover' => esc_html__( 'ZoomOut on hover', 'the-post-grid' ),
|
3939 |
+
'zoominall-on-hover' => esc_html__( 'ZoomIn Content on hover', 'the-post-grid' ),
|
3940 |
+
'zoomoutall-on-hover' => esc_html__( 'ZoomOut Content on hover', 'the-post-grid' ),
|
3941 |
];
|
3942 |
|
3943 |
if ( $ref->prefix == 'grid_hover' || $ref->prefix == 'slider' ) {
|
3944 |
$overlay_type_opt2 = [
|
3945 |
+
'flipin-on-hover' => esc_html__( 'FlipIn on hover', 'the-post-grid' ),
|
3946 |
+
'flipout-on-hover' => esc_html__( 'FlipOut on hover', 'the-post-grid' ),
|
3947 |
];
|
3948 |
$overlay_type_opt = array_merge( $overlay_type_opt, $overlay_type_opt2 );
|
3949 |
}
|
3951 |
$ref->add_control(
|
3952 |
'grid_hover_overlay_type',
|
3953 |
[
|
3954 |
+
'label' => esc_html__( 'Overlay Interaction', 'the-post-grid' ),
|
3955 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3956 |
'default' => 'always',
|
3957 |
'options' => $overlay_type_opt,
|
3958 |
+
'description' => esc_html__( 'If you don\'t choose overlay background then it will work only for some selected layout ', 'the-post-grid' ),
|
3959 |
'prefix_class' => 'grid-hover-overlay-type-',
|
3960 |
]
|
3961 |
);
|
3971 |
$ref->add_control(
|
3972 |
'grid_hover_overlay_height',
|
3973 |
[
|
3974 |
+
'label' => esc_html__( 'Overlay Height', 'the-post-grid' ),
|
3975 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3976 |
'default' => 'default',
|
3977 |
'options' => [
|
3978 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
3979 |
+
'full' => esc_html__( '100%', 'the-post-grid' ),
|
3980 |
+
'auto' => esc_html__( 'Auto', 'the-post-grid' ),
|
3981 |
],
|
3982 |
'condition' => $overlay_height_condition,
|
3983 |
'prefix_class' => 'grid-hover-overlay-height-',
|
3987 |
$ref->add_control(
|
3988 |
'on_hover_overlay',
|
3989 |
[
|
3990 |
+
'label' => esc_html__( 'Overlay Height on hover', 'the-post-grid' ),
|
3991 |
'type' => \Elementor\Controls_Manager::SELECT,
|
3992 |
'default' => 'default',
|
3993 |
'options' => [
|
3994 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
3995 |
+
'full' => esc_html__( '100%', 'the-post-grid' ),
|
3996 |
+
'auto' => esc_html__( 'Auto', 'the-post-grid' ),
|
3997 |
],
|
3998 |
'condition' => $overlay_height_condition,
|
3999 |
'prefix_class' => 'hover-overlay-height-',
|
4015 |
$ref->start_controls_section(
|
4016 |
'title_style',
|
4017 |
[
|
4018 |
+
'label' => esc_html__( 'Post Title', 'the-post-grid' ),
|
4019 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
4020 |
'condition' => [
|
4021 |
'show_title' => 'show',
|
4027 |
$ref->add_responsive_control(
|
4028 |
'title_spacing',
|
4029 |
[
|
4030 |
+
'label' => esc_html__( 'Title Margin', 'the-post-grid' ),
|
4031 |
'type' => Controls_Manager::DIMENSIONS,
|
4032 |
'size_units' => [ 'px' ],
|
4033 |
'selectors' => [
|
4047 |
$ref->add_responsive_control(
|
4048 |
'title_padding',
|
4049 |
[
|
4050 |
+
'label' => esc_html__( 'Title Padding', 'the-post-grid' ),
|
4051 |
'type' => Controls_Manager::DIMENSIONS,
|
4052 |
'size_units' => [ 'px' ],
|
4053 |
'selectors' => [
|
4080 |
'name' => 'title_offset_typography',
|
4081 |
'label' => esc_html__( 'Offset Typography', 'the-post-grid' ),
|
4082 |
'selector' => '{{WRAPPER}} .tpg-el-main-wrapper .offset-left .entry-title-wrapper .entry-title',
|
4083 |
+
'description' => esc_html__( 'You can overwrite offset title font style', 'the-post-grid' ),
|
4084 |
'condition' => [
|
4085 |
$prefix . '_layout' => [
|
4086 |
'grid-layout5',
|
4109 |
$ref->add_control(
|
4110 |
'title_border_visibility',
|
4111 |
[
|
4112 |
+
'label' => esc_html__( 'Title Border Bottom', 'the-post-grid' ),
|
4113 |
'type' => \Elementor\Controls_Manager::SELECT,
|
4114 |
'default' => 'default',
|
4115 |
'options' => [
|
4116 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
4117 |
+
'show' => esc_html__( 'Show', 'the-post-grid' ),
|
4118 |
+
'hide' => esc_html__( 'Hide', 'the-post-grid' ),
|
4119 |
],
|
4120 |
'prefix_class' => 'tpg-title-border-',
|
4121 |
'condition' => [
|
4127 |
$ref->add_responsive_control(
|
4128 |
'title_alignment',
|
4129 |
[
|
4130 |
+
'label' => esc_html__( 'Alignment', 'the-post-grid' ),
|
4131 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
4132 |
'options' => [
|
4133 |
'left' => [
|
4134 |
+
'title' => esc_html__( 'Left', 'the-post-grid' ),
|
4135 |
'icon' => 'eicon-text-align-left',
|
4136 |
],
|
4137 |
'center' => [
|
4138 |
+
'title' => esc_html__( 'Center', 'the-post-grid' ),
|
4139 |
'icon' => 'eicon-text-align-center',
|
4140 |
],
|
4141 |
'right' => [
|
4142 |
+
'title' => esc_html__( 'Right', 'the-post-grid' ),
|
4143 |
'icon' => 'eicon-text-align-right',
|
4144 |
],
|
4145 |
'justify' => [
|
4146 |
+
'title' => esc_html__( 'Justify', 'the-post-grid' ),
|
4147 |
'icon' => 'eicon-text-align-justify',
|
4148 |
],
|
4149 |
],
|
4163 |
$ref->start_controls_tab(
|
4164 |
'title_normal_tab',
|
4165 |
[
|
4166 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
4167 |
]
|
4168 |
);
|
4169 |
//TODO: Normal Tab
|
4170 |
$ref->add_control(
|
4171 |
'title_color',
|
4172 |
[
|
4173 |
+
'label' => esc_html__( 'Title Color', 'the-post-grid' ),
|
4174 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4175 |
'selectors' => [
|
4176 |
'{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'color: {{VALUE}}',
|
4181 |
$ref->add_control(
|
4182 |
'title_bg_color',
|
4183 |
[
|
4184 |
+
'label' => esc_html__( 'Title Background', 'the-post-grid' ),
|
4185 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4186 |
'selectors' => [
|
4187 |
'{{WRAPPER}} .tpg-el-main-wrapper .entry-title' => 'background-color: {{VALUE}}',
|
4192 |
$ref->add_control(
|
4193 |
'title_border_color',
|
4194 |
[
|
4195 |
+
'label' => esc_html__( 'Title Separator Color', 'the-post-grid' ),
|
4196 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4197 |
'selectors' => [
|
4198 |
'{{WRAPPER}} .rt-tpg-container .rt-holder .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}',
|
4207 |
$ref->add_control(
|
4208 |
'title_hover_border_color',
|
4209 |
[
|
4210 |
+
'label' => esc_html__( 'Title Hover Border Color', 'the-post-grid' ),
|
4211 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4212 |
'selectors' => [
|
4213 |
'{{WRAPPER}}' => '--tpg-primary-color: {{VALUE}}',
|
4223 |
$ref->start_controls_tab(
|
4224 |
'title_hover_tab',
|
4225 |
[
|
4226 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
4227 |
]
|
4228 |
);
|
4229 |
|
4231 |
$ref->add_control(
|
4232 |
'title_hover_color',
|
4233 |
[
|
4234 |
+
'label' => esc_html__( 'Title Color on Hover', 'the-post-grid' ),
|
4235 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4236 |
'selectors' => [
|
4237 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .entry-title:hover, {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .entry-title a:hover' => 'color: {{VALUE}} !important',
|
4242 |
$ref->add_control(
|
4243 |
'title_bg_color_hover',
|
4244 |
[
|
4245 |
+
'label' => esc_html__( 'Title Background on hover', 'the-post-grid' ),
|
4246 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4247 |
'selectors' => [
|
4248 |
'{{WRAPPER}} .tpg-el-main-wrapper .entry-title:hover' => 'background-color: {{VALUE}} !important',
|
4255 |
$ref->start_controls_tab(
|
4256 |
'title_box_hover_tab',
|
4257 |
[
|
4258 |
+
'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
|
4259 |
]
|
4260 |
);
|
4261 |
|
4263 |
$ref->add_control(
|
4264 |
'title_color_box_hover',
|
4265 |
[
|
4266 |
+
'label' => esc_html__( 'Title color on boxhover', 'the-post-grid' ),
|
4267 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4268 |
'selectors' => [
|
4269 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title, {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title a' => 'color: {{VALUE}}',
|
4274 |
$ref->add_control(
|
4275 |
'title_bg_color_box_hover',
|
4276 |
[
|
4277 |
+
'label' => esc_html__( 'Title Background on boxhover', 'the-post-grid' ),
|
4278 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4279 |
'selectors' => [
|
4280 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .entry-title' => 'background-color: {{VALUE}}',
|
4285 |
$ref->add_control(
|
4286 |
'title_border_color_hover',
|
4287 |
[
|
4288 |
+
'label' => esc_html__( 'Title Separator color - boxhover', 'the-post-grid' ),
|
4289 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4290 |
'selectors' => [
|
4291 |
'{{WRAPPER}} .rt-tpg-container .rt-holder:hover .entry-title-wrapper .entry-title::before' => 'background-color: {{VALUE}}',
|
4315 |
$ref->start_controls_section(
|
4316 |
'excerpt_style',
|
4317 |
[
|
4318 |
+
'label' => esc_html__( 'Excerpt / Content', 'the-post-grid' ),
|
4319 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
4320 |
'condition' => [
|
4321 |
'show_excerpt' => 'show',
|
4335 |
$ref->add_responsive_control(
|
4336 |
'excerpt_spacing',
|
4337 |
[
|
4338 |
+
'label' => esc_html__( 'Excerpt Spacing', 'the-post-grid' ),
|
4339 |
'type' => Controls_Manager::DIMENSIONS,
|
4340 |
'size_units' => [ 'px' ],
|
4341 |
'selectors' => [
|
4355 |
$ref->add_responsive_control(
|
4356 |
'content_alignment',
|
4357 |
[
|
4358 |
+
'label' => esc_html__( 'Alignment', 'the-post-grid' ),
|
4359 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
4360 |
'options' => [
|
4361 |
'left' => [
|
4362 |
+
'title' => esc_html__( 'Left', 'the-post-grid' ),
|
4363 |
'icon' => 'eicon-text-align-left',
|
4364 |
],
|
4365 |
'center' => [
|
4366 |
+
'title' => esc_html__( 'Center', 'the-post-grid' ),
|
4367 |
'icon' => 'eicon-text-align-center',
|
4368 |
],
|
4369 |
'right' => [
|
4370 |
+
'title' => esc_html__( 'Right', 'the-post-grid' ),
|
4371 |
'icon' => 'eicon-text-align-right',
|
4372 |
],
|
4373 |
'justify' => [
|
4374 |
+
'title' => esc_html__( 'Justify', 'the-post-grid' ),
|
4375 |
'icon' => 'eicon-text-align-justify',
|
4376 |
],
|
4377 |
],
|
4391 |
$ref->start_controls_tab(
|
4392 |
'excerpt_normal_tab',
|
4393 |
[
|
4394 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
4395 |
]
|
4396 |
);
|
4397 |
|
4399 |
$ref->add_control(
|
4400 |
'excerpt_color',
|
4401 |
[
|
4402 |
+
'label' => esc_html__( 'Excerpt color', 'the-post-grid' ),
|
4403 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4404 |
'selectors' => [
|
4405 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}}',
|
4410 |
$ref->add_control(
|
4411 |
'excerpt_border',
|
4412 |
[
|
4413 |
+
'label' => esc_html__( 'Border color', 'the-post-grid' ),
|
4414 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4415 |
'selectors' => [
|
4416 |
'{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder .rt-el-post-meta::before' => 'background: {{VALUE}}',
|
4427 |
$ref->start_controls_tab(
|
4428 |
'excerpt_hover_tab',
|
4429 |
[
|
4430 |
+
'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
|
4431 |
]
|
4432 |
);
|
4433 |
|
4435 |
$ref->add_control(
|
4436 |
'excerpt_hover_color',
|
4437 |
[
|
4438 |
+
'label' => esc_html__( 'Excerpt color on hover', 'the-post-grid' ),
|
4439 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4440 |
'selectors' => [
|
4441 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-el-excerpt .tpg-excerpt-inner' => 'color: {{VALUE}} !important',
|
4446 |
$ref->add_control(
|
4447 |
'excerpt_border_hover',
|
4448 |
[
|
4449 |
+
'label' => esc_html__( 'Border color - Hover', 'the-post-grid' ),
|
4450 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4451 |
'selectors' => [
|
4452 |
'{{WRAPPER}}.meta_position_default .tpg-el-main-wrapper .grid-layout3 .rt-holder:hover .rt-el-post-meta::before' => 'background: {{VALUE}}',
|
4476 |
$ref->start_controls_section(
|
4477 |
'post_meta_style',
|
4478 |
[
|
4479 |
+
'label' => esc_html__( 'Post Meta', 'the-post-grid' ),
|
4480 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
4481 |
'condition' => [
|
4482 |
'show_meta' => 'show',
|
4496 |
$ref->add_responsive_control(
|
4497 |
'meta_spacing',
|
4498 |
[
|
4499 |
+
'label' => esc_html__( 'Meta Spacing', 'the-post-grid' ),
|
4500 |
'type' => Controls_Manager::DIMENSIONS,
|
4501 |
'size_units' => [ 'px' ],
|
4502 |
'selectors' => [
|
4516 |
$ref->add_control(
|
4517 |
'separator_cat_heading',
|
4518 |
[
|
4519 |
+
'label' => esc_html__( 'Separate Category', 'the-post-grid' ),
|
4520 |
'type' => \Elementor\Controls_Manager::HEADING,
|
4521 |
'classes' => 'tpg-control-type-heading',
|
4522 |
'condition' => [
|
4539 |
$ref->add_control(
|
4540 |
'category_margin_bottom',
|
4541 |
[
|
4542 |
+
'label' => esc_html__( 'Category Margin Bottom', 'the-post-grid' ),
|
4543 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
4544 |
'min' => 0,
|
4545 |
'max' => 50,
|
4557 |
$ref->add_responsive_control(
|
4558 |
'category_radius',
|
4559 |
[
|
4560 |
+
'label' => esc_html__( 'Category Border Radius', 'the-post-grid' ),
|
4561 |
'type' => Controls_Manager::DIMENSIONS,
|
4562 |
'size_units' => [ 'px' ],
|
4563 |
'selectors' => [
|
4587 |
$ref->start_controls_tab(
|
4588 |
'meta_info_normal_tab',
|
4589 |
[
|
4590 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
4591 |
]
|
4592 |
);
|
4593 |
|
4596 |
$ref->add_control(
|
4597 |
'meta_info_color',
|
4598 |
[
|
4599 |
+
'label' => esc_html__( 'Meta Color', 'the-post-grid' ),
|
4600 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4601 |
'selectors' => [
|
4602 |
'{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags span' => 'color: {{VALUE}}',
|
4607 |
$ref->add_control(
|
4608 |
'meta_link_color',
|
4609 |
[
|
4610 |
+
'label' => esc_html__( 'Meta Link Color', 'the-post-grid' ),
|
4611 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4612 |
'selectors' => [
|
4613 |
'{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags a' => 'color: {{VALUE}}',
|
4618 |
$ref->add_control(
|
4619 |
'meta_separator_color',
|
4620 |
[
|
4621 |
+
'label' => esc_html__( 'Separator Color', 'the-post-grid' ),
|
4622 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4623 |
'selectors' => [
|
4624 |
'{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags .separator' => 'color: {{VALUE}}',
|
4632 |
$ref->add_control(
|
4633 |
'meta_icon_color',
|
4634 |
[
|
4635 |
+
'label' => esc_html__( 'Icon Color', 'the-post-grid' ),
|
4636 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4637 |
'selectors' => [
|
4638 |
'{{WRAPPER}} .tpg-el-main-wrapper .post-meta-tags i' => 'color: {{VALUE}}',
|
4643 |
$ref->add_control(
|
4644 |
'separate_category_color',
|
4645 |
[
|
4646 |
+
'label' => esc_html__( 'Category Color', 'the-post-grid' ),
|
4647 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4648 |
'separator' => 'before',
|
4649 |
'selectors' => [
|
4656 |
$ref->add_control(
|
4657 |
'separate_category_bg',
|
4658 |
[
|
4659 |
+
'label' => esc_html__( 'Category Background', 'the-post-grid' ),
|
4660 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4661 |
'selectors' => [
|
4662 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links' => 'background-color: {{VALUE}};padding: 3px 8px 1px;',
|
4669 |
$ref->add_control(
|
4670 |
'separate_category_icon_color',
|
4671 |
[
|
4672 |
+
'label' => esc_html__( 'Category Icon Color', 'the-post-grid' ),
|
4673 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4674 |
'selectors' => [
|
4675 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category .categories-links i' => 'color: {{VALUE}}',
|
4686 |
$ref->start_controls_tab(
|
4687 |
'meta_info_hover_tab',
|
4688 |
[
|
4689 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
4690 |
]
|
4691 |
);
|
4692 |
|
4696 |
$ref->add_control(
|
4697 |
'meta_link_colo_hover',
|
4698 |
[
|
4699 |
+
'label' => esc_html__( 'Meta Link Color - Hover', 'the-post-grid' ),
|
4700 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4701 |
'selectors' => [
|
4702 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder .post-meta-tags a:hover' => 'color: {{VALUE}}',
|
4707 |
$ref->add_control(
|
4708 |
'separate_category_color_hover',
|
4709 |
[
|
4710 |
+
'label' => esc_html__( 'Category Color - Hover', 'the-post-grid' ),
|
4711 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4712 |
'separator' => 'before',
|
4713 |
'selectors' => [
|
4720 |
$ref->add_control(
|
4721 |
'separate_category_bg_hover',
|
4722 |
[
|
4723 |
+
'label' => esc_html__( 'Category Background - Hover', 'the-post-grid' ),
|
4724 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4725 |
'selectors' => [
|
4726 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-separate-category.style1 .categories-links:hover' => 'background-color: {{VALUE}};padding: 3px 8px;',
|
4736 |
$ref->start_controls_tab(
|
4737 |
'meta_info_box_hover_tab',
|
4738 |
[
|
4739 |
+
'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
|
4740 |
]
|
4741 |
);
|
4742 |
|
4746 |
$ref->add_control(
|
4747 |
'meta_link_colo_box_hover',
|
4748 |
[
|
4749 |
+
'label' => esc_html__( 'Meta Color - Box Hover', 'the-post-grid' ),
|
4750 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4751 |
'selectors' => [
|
4752 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .post-meta-tags *' => 'color: {{VALUE}}',
|
4757 |
$ref->add_control(
|
4758 |
'separate_category_color_box_hover',
|
4759 |
[
|
4760 |
+
'label' => esc_html__( 'Category Color - Hover', 'the-post-grid' ),
|
4761 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4762 |
'separator' => 'before',
|
4763 |
'selectors' => [
|
4769 |
$ref->add_control(
|
4770 |
'separate_category_bg_box_hover',
|
4771 |
[
|
4772 |
+
'label' => esc_html__( 'Category Background - Box Hover', 'the-post-grid' ),
|
4773 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4774 |
'selectors' => [
|
4775 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category.style1 .categories-links' => 'background-color: {{VALUE}};padding: 3px 8px;',
|
4783 |
$ref->add_control(
|
4784 |
'separate_category_icon_color_box_hover',
|
4785 |
[
|
4786 |
+
'label' => esc_html__( 'Category Icon Color - Box Hover', 'the-post-grid' ),
|
4787 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4788 |
'selectors' => [
|
4789 |
'{{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover .tpg-separate-category .categories-links i' => 'color: {{VALUE}}',
|
4814 |
$ref->start_controls_section(
|
4815 |
'readmore_button_style',
|
4816 |
[
|
4817 |
+
'label' => esc_html__( 'Read More', 'the-post-grid' ),
|
4818 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
4819 |
'condition' => [
|
4820 |
'show_read_more' => 'show',
|
4835 |
$ref->add_responsive_control(
|
4836 |
'readmore_spacing',
|
4837 |
[
|
4838 |
+
'label' => esc_html__( 'Button Spacing', 'the-post-grid' ),
|
4839 |
'type' => Controls_Manager::DIMENSIONS,
|
4840 |
'size_units' => [ 'px' ],
|
4841 |
'allowed_dimensions' => 'all',
|
4855 |
$ref->add_responsive_control(
|
4856 |
'readmore_padding',
|
4857 |
[
|
4858 |
+
'label' => esc_html__( 'Button Padding', 'the-post-grid' ),
|
4859 |
'type' => Controls_Manager::DIMENSIONS,
|
4860 |
'size_units' => [ 'px' ],
|
4861 |
'selectors' => [
|
4871 |
$ref->add_responsive_control(
|
4872 |
'readmore_btn_alignment',
|
4873 |
[
|
4874 |
+
'label' => esc_html__( 'Button Alignment', 'the-post-grid' ),
|
4875 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
4876 |
'options' => [
|
4877 |
'left' => [
|
4878 |
+
'title' => esc_html__( 'Left', 'the-post-grid' ),
|
4879 |
'icon' => 'eicon-text-align-left',
|
4880 |
],
|
4881 |
'center' => [
|
4882 |
+
'title' => esc_html__( 'Center', 'the-post-grid' ),
|
4883 |
'icon' => 'eicon-text-align-center',
|
4884 |
],
|
4885 |
'right' => [
|
4886 |
+
'title' => esc_html__( 'Right', 'the-post-grid' ),
|
4887 |
'icon' => 'eicon-text-align-right',
|
4888 |
],
|
4889 |
],
|
4897 |
$ref->add_control(
|
4898 |
'readmore_icon_position',
|
4899 |
[
|
4900 |
+
'label' => esc_html__( 'Icon Position', 'the-post-grid' ),
|
4901 |
'type' => \Elementor\Controls_Manager::SELECT,
|
4902 |
'default' => 'right',
|
4903 |
'options' => [
|
4904 |
+
'left' => esc_html__( 'Left', 'the-post-grid' ),
|
4905 |
+
'right' => esc_html__( 'Right', 'the-post-grid' ),
|
4906 |
],
|
4907 |
'separator' => 'before',
|
4908 |
'condition' => [
|
4914 |
$ref->add_responsive_control(
|
4915 |
'readmore_icon_size',
|
4916 |
[
|
4917 |
+
'label' => esc_html__( 'Icon Size', 'the-post-grid' ),
|
4918 |
'type' => Controls_Manager::SLIDER,
|
4919 |
'size_units' => [ 'px' ],
|
4920 |
'range' => [
|
4936 |
$ref->add_responsive_control(
|
4937 |
'readmore_icon_y_position',
|
4938 |
[
|
4939 |
+
'label' => esc_html__( 'Icon Vertical Position', 'the-post-grid' ),
|
4940 |
'type' => Controls_Manager::SLIDER,
|
4941 |
'size_units' => [ 'px' ],
|
4942 |
'range' => [
|
4963 |
$ref->start_controls_tab(
|
4964 |
'readmore_style_normal_tab',
|
4965 |
[
|
4966 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
4967 |
]
|
4968 |
);
|
4969 |
|
4970 |
$ref->add_control(
|
4971 |
'readmore_text_color',
|
4972 |
[
|
4973 |
+
'label' => esc_html__( 'Text Color', 'the-post-grid' ),
|
4974 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4975 |
'selectors' => [
|
4976 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'color: {{VALUE}}',
|
4981 |
$ref->add_control(
|
4982 |
'readmore_icon_color',
|
4983 |
[
|
4984 |
+
'label' => esc_html__( 'Icon Color', 'the-post-grid' ),
|
4985 |
'type' => \Elementor\Controls_Manager::COLOR,
|
4986 |
'selectors' => [
|
4987 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a i' => 'color: {{VALUE}}',
|
4995 |
$ref->add_control(
|
4996 |
'readmore_bg',
|
4997 |
[
|
4998 |
+
'label' => esc_html__( 'Background Color', 'the-post-grid' ),
|
4999 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5000 |
'selectors' => [
|
5001 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a' => 'background-color: {{VALUE}}',
|
5009 |
$ref->add_responsive_control(
|
5010 |
'readmore_icon_margin',
|
5011 |
[
|
5012 |
+
'label' => esc_html__( 'Icon Spacing', 'the-post-grid' ),
|
5013 |
'type' => Controls_Manager::DIMENSIONS,
|
5014 |
'size_units' => [ 'px' ],
|
5015 |
'allowed_dimensions' => 'horizontal',
|
5032 |
$ref->add_responsive_control(
|
5033 |
'border_radius',
|
5034 |
[
|
5035 |
+
'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
|
5036 |
'type' => Controls_Manager::DIMENSIONS,
|
5037 |
'size_units' => [ 'px', '%', 'em' ],
|
5038 |
'allowed_dimensions' => 'all',
|
5049 |
\Elementor\Group_Control_Border::get_type(),
|
5050 |
[
|
5051 |
'name' => 'readmore_border',
|
5052 |
+
'label' => esc_html__( 'Button Border', 'the-post-grid' ),
|
5053 |
'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a',
|
5054 |
'fields_options' => [
|
5055 |
'border' => [
|
5081 |
$ref->start_controls_tab(
|
5082 |
'readmore_style_hover_tab',
|
5083 |
[
|
5084 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
5085 |
]
|
5086 |
);
|
5087 |
|
5088 |
$ref->add_control(
|
5089 |
'readmore_text_color_hover',
|
5090 |
[
|
5091 |
+
'label' => esc_html__( 'Text Color hover', 'the-post-grid' ),
|
5092 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5093 |
'selectors' => [
|
5094 |
'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'color: {{VALUE}}',
|
5099 |
$ref->add_control(
|
5100 |
'readmore_icon_color_hover',
|
5101 |
[
|
5102 |
+
'label' => esc_html__( 'Icon Color Hover', 'the-post-grid' ),
|
5103 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5104 |
'selectors' => [
|
5105 |
'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover i' => 'color: {{VALUE}}',
|
5113 |
$ref->add_control(
|
5114 |
'readmore_bg_hover',
|
5115 |
[
|
5116 |
+
'label' => esc_html__( 'Background Color hover', 'the-post-grid' ),
|
5117 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5118 |
'selectors' => [
|
5119 |
'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover' => 'background-color: {{VALUE}}',
|
5127 |
$ref->add_responsive_control(
|
5128 |
'readmore_icon_margin_hover',
|
5129 |
[
|
5130 |
+
'label' => esc_html__( 'Icon Spacing - Hover', 'the-post-grid' ),
|
5131 |
'type' => Controls_Manager::DIMENSIONS,
|
5132 |
'size_units' => [ 'px' ],
|
5133 |
'allowed_dimensions' => 'horizontal',
|
5150 |
$ref->add_responsive_control(
|
5151 |
'border_radius_hover',
|
5152 |
[
|
5153 |
+
'label' => esc_html__( 'Border Radius - Hover', 'the-post-grid' ),
|
5154 |
'type' => Controls_Manager::DIMENSIONS,
|
5155 |
'size_units' => [ 'px', '%', 'em' ],
|
5156 |
'allowed_dimensions' => 'all',
|
5167 |
\Elementor\Group_Control_Border::get_type(),
|
5168 |
[
|
5169 |
'name' => 'readmore_border_hover',
|
5170 |
+
'label' => esc_html__( 'Button Border - Hover', 'the-post-grid' ),
|
5171 |
'selector' => 'body {{WRAPPER}} .rt-tpg-container .tpg-post-holder .rt-detail .read-more a:hover',
|
5172 |
'fields_options' => [
|
5173 |
'border' => [
|
5200 |
$ref->start_controls_tab(
|
5201 |
'readmore_style_box_hover_tab',
|
5202 |
[
|
5203 |
+
'label' => esc_html__( 'Box Hover', 'the-post-grid' ),
|
5204 |
]
|
5205 |
);
|
5206 |
|
5207 |
$ref->add_control(
|
5208 |
'readmore_text_color_box_hover',
|
5209 |
[
|
5210 |
+
'label' => esc_html__( 'Text Color - BoxHover', 'the-post-grid' ),
|
5211 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5212 |
'selectors' => [
|
5213 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'color: {{VALUE}}',
|
5218 |
$ref->add_control(
|
5219 |
'readmore_icon_color_box_hover',
|
5220 |
[
|
5221 |
+
'label' => esc_html__( 'Icon Color - BoxHover', 'the-post-grid' ),
|
5222 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5223 |
'selectors' => [
|
5224 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a i' => 'color: {{VALUE}}',
|
5232 |
$ref->add_control(
|
5233 |
'readmore_bg_box_hover',
|
5234 |
[
|
5235 |
+
'label' => esc_html__( 'Background Color - BoxHover', 'the-post-grid' ),
|
5236 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5237 |
'selectors' => [
|
5238 |
'{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a' => 'background-color: {{VALUE}}',
|
5247 |
\Elementor\Group_Control_Border::get_type(),
|
5248 |
[
|
5249 |
'name' => 'readmore_border_box_hover',
|
5250 |
+
'label' => esc_html__( 'Button Border - Box Hover', 'the-post-grid' ),
|
5251 |
'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-post-holder:hover .rt-detail .read-more a',
|
5252 |
'condition' => [
|
5253 |
'readmore_btn_style' => 'default-style',
|
5273 |
$ref->start_controls_section(
|
5274 |
'pagination_loadmore_style',
|
5275 |
[
|
5276 |
+
'label' => esc_html__( 'Pagination / Load More', 'the-post-grid' ),
|
5277 |
'tab' => \Elementor\Controls_Manager::TAB_STYLE,
|
5278 |
'condition' => [
|
5279 |
'show_pagination' => 'show',
|
5320 |
$ref->add_responsive_control(
|
5321 |
'pagination_spacing',
|
5322 |
[
|
5323 |
+
'label' => esc_html__( 'Button Vertical Spacing', 'the-post-grid' ),
|
5324 |
'type' => Controls_Manager::DIMENSIONS,
|
5325 |
'size_units' => [ 'px' ],
|
5326 |
'allowed_dimensions' => 'vertical',
|
5343 |
$ref->add_responsive_control(
|
5344 |
'pagination_padding',
|
5345 |
[
|
5346 |
+
'label' => esc_html__( 'Button Padding', 'the-post-grid' ),
|
5347 |
'type' => Controls_Manager::DIMENSIONS,
|
5348 |
'size_units' => [ 'px' ],
|
5349 |
'allowed_dimensions' => 'all',
|
5359 |
$ref->add_responsive_control(
|
5360 |
'pagination_border_radius',
|
5361 |
[
|
5362 |
+
'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
|
5363 |
'type' => Controls_Manager::SLIDER,
|
5364 |
'size_units' => [ 'px', '%' ],
|
5365 |
'range' => [
|
5399 |
$ref->start_controls_tab(
|
5400 |
'pagination_style_normal_tab',
|
5401 |
[
|
5402 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
5403 |
]
|
5404 |
);
|
5405 |
|
5406 |
$ref->add_control(
|
5407 |
'pagination_color',
|
5408 |
[
|
5409 |
+
'label' => esc_html__( 'Color', 'the-post-grid' ),
|
5410 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5411 |
'selectors' => [
|
5412 |
'{{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > a, {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'color: {{VALUE}}',
|
5420 |
$ref->add_control(
|
5421 |
'pagination_bg',
|
5422 |
[
|
5423 |
+
'label' => esc_html__( 'Background Color', 'the-post-grid' ),
|
5424 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5425 |
'selectors' => [
|
5426 |
'{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'background-color: {{VALUE}}',
|
5434 |
$ref->add_control(
|
5435 |
'pagination_border_color',
|
5436 |
[
|
5437 |
+
'label' => esc_html__( 'Border Color', 'the-post-grid' ),
|
5438 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5439 |
'selectors' => [
|
5440 |
'{{WRAPPER}} .rt-pagination .pagination-list > li > a:not(:hover), {{WRAPPER}} .rt-pagination .pagination-list > li:not(:hover) > span' => 'border-color: {{VALUE}}',
|
5450 |
$ref->start_controls_tab(
|
5451 |
'pagination_style_hover_tab',
|
5452 |
[
|
5453 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
5454 |
]
|
5455 |
);
|
5456 |
|
5457 |
$ref->add_control(
|
5458 |
'pagination_color_hover',
|
5459 |
[
|
5460 |
+
'label' => esc_html__( 'Color - hover', 'the-post-grid' ),
|
5461 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5462 |
'selectors' => [
|
5463 |
'{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'color: {{VALUE}} !important',
|
5470 |
$ref->add_control(
|
5471 |
'pagination_bg_hover',
|
5472 |
[
|
5473 |
+
'label' => esc_html__( 'Background Color - Hover', 'the-post-grid' ),
|
5474 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5475 |
'selectors' => [
|
5476 |
'{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'background-color: {{VALUE}} !important',
|
5483 |
$ref->add_control(
|
5484 |
'pagination_border_color_hover',
|
5485 |
[
|
5486 |
+
'label' => esc_html__( 'Border Color - Hover', 'the-post-grid' ),
|
5487 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5488 |
'selectors' => [
|
5489 |
'{{WRAPPER}} .rt-pagination .pagination-list > li:hover > a, {{WRAPPER}} .rt-pagination .pagination-list > li:hover > span' => 'border-color: {{VALUE}} !important',
|
5500 |
$ref->start_controls_tab(
|
5501 |
'pagination_style_active_tab',
|
5502 |
[
|
5503 |
+
'label' => esc_html__( 'Active', 'the-post-grid' ),
|
5504 |
]
|
5505 |
);
|
5506 |
|
5507 |
$ref->add_control(
|
5508 |
'pagination_color_active',
|
5509 |
[
|
5510 |
+
'label' => esc_html__( 'Color - Active', 'the-post-grid' ),
|
5511 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5512 |
'selectors' => [
|
5513 |
+
'{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
|
5514 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > span,
|
5515 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
|
5516 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
|
5517 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
|
5518 |
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'color: {{VALUE}} !important',
|
5519 |
'{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'color: {{VALUE}}',
|
5520 |
],
|
5525 |
$ref->add_control(
|
5526 |
'pagination_bg_active',
|
5527 |
[
|
5528 |
+
'label' => esc_html__( 'Background Color - Active', 'the-post-grid' ),
|
5529 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5530 |
'selectors' => [
|
5531 |
+
'{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
|
5532 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > span,
|
5533 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
|
5534 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
|
5535 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
|
5536 |
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'background-color: {{VALUE}} !important',
|
5537 |
'{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'background-color: {{VALUE}}',
|
5538 |
],
|
5542 |
$ref->add_control(
|
5543 |
'pagination_border_color_active',
|
5544 |
[
|
5545 |
+
'label' => esc_html__( 'Border Color - Active', 'the-post-grid' ),
|
5546 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5547 |
'selectors' => [
|
5548 |
+
'{{WRAPPER}} .rt-pagination .pagination-list > .active > a,
|
5549 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > span,
|
5550 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:hover,
|
5551 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:hover,
|
5552 |
+
{{WRAPPER}} .rt-pagination .pagination-list > .active > a:focus,
|
5553 |
{{WRAPPER}} .rt-pagination .pagination-list > .active > span:focus' => 'border-color: {{VALUE}} !important',
|
5554 |
'{{WRAPPER}} .rt-tpg-container .rt-pagination-wrap .rt-page-numbers .paginationjs .paginationjs-pages ul li.active > a' => 'border-color: {{VALUE}}',
|
5555 |
],
|
5615 |
\Elementor\Group_Control_Typography::get_type(),
|
5616 |
[
|
5617 |
'name' => 'front_filter_typography',
|
5618 |
+
'label' => esc_html__( 'Filter Typography', 'the-post-grid' ),
|
5619 |
'selector' => '{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap, {{WRAPPER}} .tpg-header-wrapper.carousel .rt-filter-item-wrap.swiper-wrapper .swiper-slide',
|
5620 |
]
|
5621 |
);
|
5681 |
$ref->add_responsive_control(
|
5682 |
'filter_button_width',
|
5683 |
[
|
5684 |
+
'label' => esc_html__( 'Filter Width', 'the-post-grid' ),
|
5685 |
'type' => Controls_Manager::SLIDER,
|
5686 |
'size_units' => [ 'px', '%' ],
|
5687 |
'range' => [
|
5709 |
$ref->add_control(
|
5710 |
'border_style',
|
5711 |
[
|
5712 |
+
'label' => esc_html__( 'Filter Border', 'the-post-grid' ),
|
5713 |
'type' => \Elementor\Controls_Manager::SELECT,
|
5714 |
'default' => 'disable',
|
5715 |
'options' => [
|
5716 |
+
'disable' => esc_html__( 'Disable', 'the-post-grid' ),
|
5717 |
+
'enable' => esc_html__( 'Enable', 'the-post-grid' ),
|
5718 |
],
|
5719 |
'condition' => [
|
5720 |
'filter_type' => 'button',
|
5728 |
$ref->add_control(
|
5729 |
'filter_next_prev_btn',
|
5730 |
[
|
5731 |
+
'label' => esc_html__( 'Next/Prev Button', 'the-post-grid' ),
|
5732 |
'type' => \Elementor\Controls_Manager::SELECT,
|
5733 |
'default' => 'visible',
|
5734 |
'options' => [
|
5735 |
+
'visible' => esc_html__( 'Visible', 'the-post-grid' ),
|
5736 |
+
'hidden' => esc_html__( 'Hidden', 'the-post-grid' ),
|
5737 |
],
|
5738 |
'condition' => [
|
5739 |
'filter_type' => 'button',
|
5777 |
$ref->add_responsive_control(
|
5778 |
'filter_btn_radius',
|
5779 |
[
|
5780 |
+
'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
|
5781 |
'type' => Controls_Manager::DIMENSIONS,
|
5782 |
'size_units' => [ 'px' ],
|
5783 |
'selectors' => [
|
5800 |
$ref->start_controls_tab(
|
5801 |
'frontend_filter_style_normal_tab',
|
5802 |
[
|
5803 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
5804 |
]
|
5805 |
);
|
5806 |
|
5807 |
$ref->add_control(
|
5808 |
'filter_color',
|
5809 |
[
|
5810 |
+
'label' => esc_html__( 'Filter Color', 'the-post-grid' ),
|
5811 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5812 |
'selectors' => [
|
5813 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'color: {{VALUE}}',
|
5821 |
$ref->add_control(
|
5822 |
'filter_bg_color',
|
5823 |
[
|
5824 |
+
'label' => esc_html__( 'Filter Background Color', 'the-post-grid' ),
|
5825 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5826 |
'selectors' => [
|
5827 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'background-color: {{VALUE}}',
|
5834 |
$ref->add_control(
|
5835 |
'filter_border_color',
|
5836 |
[
|
5837 |
+
'label' => esc_html__( 'Filter Border Color', 'the-post-grid' ),
|
5838 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5839 |
'selectors' => [
|
5840 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item' => 'border-color: {{VALUE}}',
|
5849 |
$ref->add_control(
|
5850 |
'filter_search_bg',
|
5851 |
[
|
5852 |
+
'label' => esc_html__( 'Search Background', 'the-post-grid' ),
|
5853 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5854 |
'selectors' => [
|
5855 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input' => 'background-color: {{VALUE}}',
|
5864 |
$ref->add_control(
|
5865 |
'sub_menu_color_heading',
|
5866 |
[
|
5867 |
+
'label' => esc_html__( 'Sub Menu Options', 'the-post-grid' ),
|
5868 |
'type' => \Elementor\Controls_Manager::HEADING,
|
5869 |
'separator' => 'before',
|
5870 |
'classes' => 'tpg-control-type-heading',
|
5877 |
$ref->add_control(
|
5878 |
'sub_menu_bg_color',
|
5879 |
[
|
5880 |
+
'label' => esc_html__( 'Submenu Background', 'the-post-grid' ),
|
5881 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5882 |
'selectors' => [
|
5883 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown' => 'background-color: {{VALUE}}',
|
5891 |
$ref->add_control(
|
5892 |
'sub_menu_color',
|
5893 |
[
|
5894 |
+
'label' => esc_html__( 'Submenu Color', 'the-post-grid' ),
|
5895 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5896 |
'selectors' => [
|
5897 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'color: {{VALUE}}',
|
5905 |
$ref->add_control(
|
5906 |
'sub_menu_border_bottom',
|
5907 |
[
|
5908 |
+
'label' => esc_html__( 'Submenu Border', 'the-post-grid' ),
|
5909 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5910 |
'selectors' => [
|
5911 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item' => 'border-bottom-color: {{VALUE}}',
|
5919 |
$ref->add_control(
|
5920 |
'filter_nav_color',
|
5921 |
[
|
5922 |
+
'label' => esc_html__( 'Filter Nav Color', 'the-post-grid' ),
|
5923 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5924 |
'selectors' => [
|
5925 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'color: {{VALUE}}',
|
5934 |
$ref->add_control(
|
5935 |
'filter_nav_bg',
|
5936 |
[
|
5937 |
+
'label' => esc_html__( 'Filter Nav Background', 'the-post-grid' ),
|
5938 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5939 |
'selectors' => [
|
5940 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'background-color: {{VALUE}}',
|
5949 |
$ref->add_control(
|
5950 |
'filter_nav_border',
|
5951 |
[
|
5952 |
+
'label' => esc_html__( 'Filter Nav Border', 'the-post-grid' ),
|
5953 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5954 |
'selectors' => [
|
5955 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn' => 'border-color: {{VALUE}}',
|
5967 |
$ref->start_controls_tab(
|
5968 |
'frontend_filter_style_hover_tab',
|
5969 |
[
|
5970 |
+
'label' => esc_html__( 'Hover / Active', 'the-post-grid' ),
|
5971 |
]
|
5972 |
);
|
5973 |
|
5974 |
$ref->add_control(
|
5975 |
'filter_color_hover',
|
5976 |
[
|
5977 |
+
'label' => esc_html__( 'Filter Color - Hover', 'the-post-grid' ),
|
5978 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5979 |
'selectors' => [
|
5980 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'color: {{VALUE}}',
|
5987 |
$ref->add_control(
|
5988 |
'filter_bg_color_hover',
|
5989 |
[
|
5990 |
+
'label' => esc_html__( 'Filter Background Color - Hover', 'the-post-grid' ),
|
5991 |
'type' => \Elementor\Controls_Manager::COLOR,
|
5992 |
'selectors' => [
|
5993 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'background-color: {{VALUE}}',
|
6000 |
$ref->add_control(
|
6001 |
'filter_border_color_hover',
|
6002 |
[
|
6003 |
+
'label' => esc_html__( 'Filter Border Color - Hover', 'the-post-grid' ),
|
6004 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6005 |
'selectors' => [
|
6006 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item.selected, {{WRAPPER}} .rt-filter-item-wrap.rt-filter-button-wrap span.rt-filter-button-item:hover' => 'border-color: {{VALUE}}',
|
6015 |
$ref->add_control(
|
6016 |
'filter_search_bg_hover',
|
6017 |
[
|
6018 |
+
'label' => esc_html__( 'Search Background - Hover', 'the-post-grid' ),
|
6019 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6020 |
'selectors' => [
|
6021 |
'{{WRAPPER}} .rt-filter-item-wrap.rt-search-filter-wrap input.rt-search-input:hover' => 'background-color: {{VALUE}}',
|
6030 |
$ref->add_control(
|
6031 |
'sub_menu_color_heading_hover',
|
6032 |
[
|
6033 |
+
'label' => esc_html__( 'Sub Menu Options - Hover', 'the-post-grid' ),
|
6034 |
'type' => \Elementor\Controls_Manager::HEADING,
|
6035 |
'separator' => 'before',
|
6036 |
'classes' => 'tpg-control-type-heading',
|
6043 |
$ref->add_control(
|
6044 |
'sub_menu_bg_color_hover',
|
6045 |
[
|
6046 |
+
'label' => esc_html__( 'Submenu Background - Hover', 'the-post-grid' ),
|
6047 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6048 |
'selectors' => [
|
6049 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'background-color: {{VALUE}}',
|
6057 |
$ref->add_control(
|
6058 |
'sub_menu_color_hover',
|
6059 |
[
|
6060 |
+
'label' => esc_html__( 'Submenu Color - Hover', 'the-post-grid' ),
|
6061 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6062 |
'selectors' => [
|
6063 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'color: {{VALUE}}',
|
6071 |
$ref->add_control(
|
6072 |
'sub_menu_border_bottom_hover',
|
6073 |
[
|
6074 |
+
'label' => esc_html__( 'Submenu Border - Hover', 'the-post-grid' ),
|
6075 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6076 |
'selectors' => [
|
6077 |
'{{WRAPPER}} .rt-layout-filter-container .rt-filter-wrap .rt-filter-item-wrap.rt-filter-dropdown-wrap .rt-filter-dropdown .rt-filter-dropdown-item:hover' => 'border-bottom-color: {{VALUE}}',
|
6085 |
$ref->add_control(
|
6086 |
'filter_nav_color_hover',
|
6087 |
[
|
6088 |
+
'label' => esc_html__( 'Filter Nav Color - Hover', 'the-post-grid' ),
|
6089 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6090 |
'selectors' => [
|
6091 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'color: {{VALUE}}',
|
6100 |
$ref->add_control(
|
6101 |
'filter_nav_bg_hover',
|
6102 |
[
|
6103 |
+
'label' => esc_html__( 'Filter Nav Background - Hover', 'the-post-grid' ),
|
6104 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6105 |
'selectors' => [
|
6106 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'background-color: {{VALUE}}',
|
6115 |
$ref->add_control(
|
6116 |
'filter_nav_border_hover',
|
6117 |
[
|
6118 |
+
'label' => esc_html__( 'Filter Nav Border - Hover', 'the-post-grid' ),
|
6119 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6120 |
'selectors' => [
|
6121 |
'{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover' => 'border-color: {{VALUE}}',
|
6163 |
}
|
6164 |
|
6165 |
/**
|
6166 |
+
|
6167 |
+
* Get Social Share
|
6168 |
*
|
6169 |
* @param $ref
|
6170 |
* @param $prefix
|
6173 |
$ref->add_control(
|
6174 |
'social_icon_style',
|
6175 |
[
|
6176 |
+
'label' => esc_html__( 'Icon Color Style', 'the-post-grid' ),
|
6177 |
'type' => \Elementor\Controls_Manager::SELECT,
|
6178 |
'default' => 'default',
|
6179 |
'options' => [
|
6180 |
+
'default' => esc_html__( 'Default (Brand Color)', 'the-post-grid' ),
|
6181 |
+
'different_color' => esc_html__( 'Different Color for each', 'the-post-grid' ),
|
6182 |
+
'custom' => esc_html__( 'Custom color', 'the-post-grid' ),
|
6183 |
],
|
6184 |
+
'description' => esc_html__( 'Select Custom for your own customize', 'the-post-grid' ),
|
6185 |
]
|
6186 |
);
|
6187 |
|
6191 |
$ref->add_responsive_control(
|
6192 |
'social_icon_margin',
|
6193 |
[
|
6194 |
+
'label' => esc_html__( 'Icon Margin', 'the-post-grid' ),
|
6195 |
'type' => Controls_Manager::DIMENSIONS,
|
6196 |
'size_units' => [ 'px' ],
|
6197 |
'allowed_dimensions' => 'all',
|
6204 |
$ref->add_responsive_control(
|
6205 |
'social_wrapper_margin',
|
6206 |
[
|
6207 |
+
'label' => esc_html__( 'Icon Wrapper Spacing', 'the-post-grid' ),
|
6208 |
'type' => Controls_Manager::DIMENSIONS,
|
6209 |
'size_units' => [ 'px' ],
|
6210 |
'allowed_dimensions' => 'all', //horizontal, vertical, [ 'top', 'right', 'bottom', 'left' ]
|
6224 |
$ref->add_responsive_control(
|
6225 |
'social_icon_radius',
|
6226 |
[
|
6227 |
+
'label' => esc_html__( 'Border Radius', 'the-post-grid' ),
|
6228 |
'type' => Controls_Manager::DIMENSIONS,
|
6229 |
'size_units' => [ 'px', '%', 'em' ],
|
6230 |
'allowed_dimensions' => 'all',
|
6244 |
$ref->add_control(
|
6245 |
'icon_width_height',
|
6246 |
[
|
6247 |
+
'label' => esc_html__( 'Icon Dimension', 'the-post-grid' ),
|
6248 |
'type' => \Elementor\Controls_Manager::IMAGE_DIMENSIONS,
|
6249 |
'default' => [
|
6250 |
'width' => '',
|
6253 |
'selectors' => [
|
6254 |
'{{WRAPPER}} .rt-tpg-social-share a i' => 'width:{{width}}px; height:{{height}}px; line-height:{{height}}px; text-align:center',
|
6255 |
],
|
6256 |
+
'description' => esc_html__( 'Just write number. Don\'t use (px or em).', 'the-post-grid' ),
|
6257 |
'classes' => 'should-show-title',
|
6258 |
]
|
6259 |
);
|
6261 |
$ref->add_responsive_control(
|
6262 |
'icon_font_size',
|
6263 |
[
|
6264 |
+
'label' => esc_html__( 'Icon Font Size', 'the-post-grid' ),
|
6265 |
'type' => Controls_Manager::SLIDER,
|
6266 |
'size_units' => [ 'px' ],
|
6267 |
'range' => [
|
6285 |
$ref->start_controls_tab(
|
6286 |
'social_share_normal_tab',
|
6287 |
[
|
6288 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
6289 |
]
|
6290 |
);
|
6291 |
//TODO: Normal Tab
|
6294 |
$ref->add_control(
|
6295 |
'social_icon_color',
|
6296 |
[
|
6297 |
+
'label' => esc_html__( 'Social Icon color', 'the-post-grid' ),
|
6298 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6299 |
'selectors' => [
|
6300 |
'{{WRAPPER}} .rt-tpg-social-share a i' => 'color: {{VALUE}}',
|
6308 |
$ref->add_control(
|
6309 |
'social_icon_bg_color',
|
6310 |
[
|
6311 |
+
'label' => esc_html__( 'Social Icon Background', 'the-post-grid' ),
|
6312 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6313 |
'selectors' => [
|
6314 |
'{{WRAPPER}} .rt-tpg-social-share a i' => 'background-color: {{VALUE}}',
|
6324 |
$ref->add_control(
|
6325 |
$ss . '_social_icon_color',
|
6326 |
[
|
6327 |
+
'label' => ucwords( $ss ) . esc_html__( ' color', 'the-post-grid' ),
|
6328 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6329 |
'selectors' => [
|
6330 |
'{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'color: {{VALUE}}',
|
6338 |
$ref->add_control(
|
6339 |
$ss . '_social_icon_bg_color',
|
6340 |
[
|
6341 |
+
'label' => ucwords( $ss ) . esc_html__( ' Background', 'the-post-grid' ),
|
6342 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6343 |
'selectors' => [
|
6344 |
'{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ' i' => 'background-color: {{VALUE}}',
|
6355 |
\Elementor\Group_Control_Border::get_type(),
|
6356 |
[
|
6357 |
'name' => 'social_icon_border',
|
6358 |
+
'label' => esc_html__( 'Icon Border', 'the-post-grid' ),
|
6359 |
'selector' => '{{WRAPPER}} .rt-tpg-social-share a i',
|
6360 |
]
|
6361 |
);
|
6365 |
$ref->start_controls_tab(
|
6366 |
'socia_hover_tab',
|
6367 |
[
|
6368 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
6369 |
]
|
6370 |
);
|
6371 |
|
6374 |
$ref->add_control(
|
6375 |
'social_icon_color_hover',
|
6376 |
[
|
6377 |
+
'label' => esc_html__( 'Icon color', 'the-post-grid' ),
|
6378 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6379 |
'selectors' => [
|
6380 |
'{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'color: {{VALUE}}',
|
6388 |
$ref->add_control(
|
6389 |
'social_icon_bg_color_hover',
|
6390 |
[
|
6391 |
+
'label' => esc_html__( 'Social Icon Background', 'the-post-grid' ),
|
6392 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6393 |
'selectors' => [
|
6394 |
'{{WRAPPER}} .rt-tpg-social-share a:hover i' => 'background-color: {{VALUE}}',
|
6403 |
$ref->add_control(
|
6404 |
$ss . '_social_icon_color_hover',
|
6405 |
[
|
6406 |
+
'label' => ucwords( $ss ) . esc_html__( ' color - Hover', 'the-post-grid' ),
|
6407 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6408 |
'selectors' => [
|
6409 |
'{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ':hover i' => 'color: {{VALUE}}',
|
6417 |
$ref->add_control(
|
6418 |
$ss . '_social_icon_bg_color_hover',
|
6419 |
[
|
6420 |
+
'label' => ucwords( $ss ) . esc_html__( ' Background - Hover', 'the-post-grid' ),
|
6421 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6422 |
'selectors' => [
|
6423 |
'{{WRAPPER}} .rt-tpg-social-share a.' . $ss . ':hover i' => 'background-color: {{VALUE}}',
|
6433 |
\Elementor\Group_Control_Border::get_type(),
|
6434 |
[
|
6435 |
'name' => 'social_icon_border_hover',
|
6436 |
+
'label' => esc_html__( 'Icon Border - Hover', 'the-post-grid' ),
|
6437 |
'selector' => '{{WRAPPER}} .rt-tpg-social-share a:hover i',
|
6438 |
]
|
6439 |
);
|
6462 |
$ref->add_responsive_control(
|
6463 |
'box_margin',
|
6464 |
[
|
6465 |
+
'label' => esc_html__( 'Card Gap', 'the-post-grid' ),
|
6466 |
'type' => Controls_Manager::DIMENSIONS,
|
6467 |
'size_units' => [ 'px' ],
|
6468 |
'render_type' => 'template',
|
6520 |
$ref->add_responsive_control(
|
6521 |
'content_box_padding',
|
6522 |
[
|
6523 |
+
'label' => esc_html__( 'Content Padding', 'the-post-grid' ),
|
6524 |
'type' => Controls_Manager::DIMENSIONS,
|
6525 |
'size_units' => [ 'px' ],
|
6526 |
'allowed_dimensions' => 'all',
|
6537 |
$ref->add_responsive_control(
|
6538 |
'content_box_padding_offset',
|
6539 |
[
|
6540 |
+
'label' => esc_html__( 'Content Padding', 'the-post-grid' ),
|
6541 |
'type' => Controls_Manager::DIMENSIONS,
|
6542 |
'size_units' => [ 'px' ],
|
6543 |
'allowed_dimensions' => 'all',
|
6559 |
$ref->add_responsive_control(
|
6560 |
'content_box_padding_2',
|
6561 |
[
|
6562 |
+
'label' => esc_html__( 'Content Padding', 'the-post-grid' ),
|
6563 |
'type' => Controls_Manager::DIMENSIONS,
|
6564 |
'size_units' => [ 'px' ],
|
6565 |
'allowed_dimensions' => 'all',
|
6575 |
$ref->add_responsive_control(
|
6576 |
'box_radius',
|
6577 |
[
|
6578 |
+
'label' => esc_html__( 'Card Border Radius', 'the-post-grid' ),
|
6579 |
'type' => Controls_Manager::DIMENSIONS,
|
6580 |
'size_units' => [ 'px', '%' ],
|
6581 |
'selectors' => [
|
6604 |
$ref->add_control(
|
6605 |
'is_box_border',
|
6606 |
[
|
6607 |
+
'label' => esc_html__( 'Enable Border & Box Shadow', 'the-post-grid' ),
|
6608 |
'type' => \Elementor\Controls_Manager::SELECT,
|
6609 |
'default' => 'enable',
|
6610 |
'options' => [
|
6611 |
+
'enable' => esc_html__( 'Enable', 'the-post-grid' ),
|
6612 |
+
'disable' => esc_html__( 'Disable', 'the-post-grid' ),
|
6613 |
],
|
6614 |
'prefix_class' => 'tpg-el-box-border-',
|
6615 |
'condition' => [
|
6633 |
$ref->start_controls_tab(
|
6634 |
'box_style_normal_tab',
|
6635 |
[
|
6636 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
6637 |
]
|
6638 |
);
|
6639 |
|
6641 |
\Elementor\Group_Control_Background::get_type(),
|
6642 |
[
|
6643 |
'name' => 'box_background',
|
6644 |
+
'label' => esc_html__( 'Background', 'the-post-grid' ),
|
6645 |
'fields_options' => [
|
6646 |
'background' => [
|
6647 |
'label' => esc_html__( 'Card Background', 'the-post-grid' ),
|
6659 |
\Elementor\Group_Control_Background::get_type(),
|
6660 |
[
|
6661 |
'name' => 'box_background2',
|
6662 |
+
'label' => esc_html__( 'Background', 'the-post-grid' ),
|
6663 |
'fields_options' => [
|
6664 |
'background' => [
|
6665 |
'label' => esc_html__( 'Card Background', 'the-post-grid' ),
|
6677 |
$ref->add_control(
|
6678 |
'box_border',
|
6679 |
[
|
6680 |
+
'label' => esc_html__( 'Border Color', 'the-post-grid' ),
|
6681 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6682 |
'selectors' => [
|
6683 |
'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder' => 'border: 1px solid {{VALUE}}',
|
6698 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
6699 |
[
|
6700 |
'name' => 'box_box_shadow',
|
6701 |
+
'label' => esc_html__( 'Box Shadow', 'the-post-grid' ),
|
6702 |
'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder',
|
6703 |
'condition' => [
|
6704 |
'is_box_border' => 'enable',
|
6716 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
6717 |
[
|
6718 |
'name' => 'box_box_shadow2',
|
6719 |
+
'label' => esc_html__( 'Box Shadow', 'the-post-grid' ),
|
6720 |
'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content',
|
6721 |
'condition' => [
|
6722 |
$prefix . '_layout' => [ 'slider-layout13' ],
|
6732 |
$ref->start_controls_tab(
|
6733 |
'box_style_hover_tab',
|
6734 |
[
|
6735 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
6736 |
]
|
6737 |
);
|
6738 |
|
6740 |
\Elementor\Group_Control_Background::get_type(),
|
6741 |
[
|
6742 |
'name' => 'box_background_hover',
|
6743 |
+
'label' => esc_html__( 'Background - Hover', 'the-post-grid' ),
|
6744 |
'fields_options' => [
|
6745 |
'background' => [
|
6746 |
'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ),
|
6758 |
\Elementor\Group_Control_Background::get_type(),
|
6759 |
[
|
6760 |
'name' => 'box_background_hover2',
|
6761 |
+
'label' => esc_html__( 'Background - Hover', 'the-post-grid' ),
|
6762 |
'fields_options' => [
|
6763 |
'background' => [
|
6764 |
'label' => esc_html__( 'Card Background - Hover', 'the-post-grid' ),
|
6776 |
$ref->add_control(
|
6777 |
'box_border_hover',
|
6778 |
[
|
6779 |
+
'label' => esc_html__( 'Border Color - Hover', 'the-post-grid' ),
|
6780 |
'type' => \Elementor\Controls_Manager::COLOR,
|
6781 |
'selectors' => [
|
6782 |
'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover' => 'border: 1px solid {{VALUE}}',
|
6796 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
6797 |
[
|
6798 |
'name' => 'box_box_shadow_hover',
|
6799 |
+
'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ),
|
6800 |
'selector' => 'body {{WRAPPER}} .tpg-el-main-wrapper .tpg-post-holder:hover',
|
6801 |
'condition' => [
|
6802 |
'is_box_border' => 'enable',
|
6815 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
6816 |
[
|
6817 |
'name' => 'box_box_shadow_hover2',
|
6818 |
+
'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ),
|
6819 |
'selector' => 'body {{WRAPPER}} .rt-tpg-container .slider-layout13 .rt-holder .post-content',
|
6820 |
'condition' => [
|
6821 |
$prefix . '_layout' => [ 'slider-layout13' ],
|
6861 |
$ref->add_responsive_control(
|
6862 |
'slider_gap',
|
6863 |
[
|
6864 |
+
'label' => esc_html__( 'Slider Gap', 'the-post-grid' ),
|
6865 |
'type' => Controls_Manager::SLIDER,
|
6866 |
'size_units' => [ 'px' ],
|
6867 |
'range' => [
|
6890 |
$ref->add_control(
|
6891 |
'arrows',
|
6892 |
[
|
6893 |
+
'label' => esc_html__( 'Arrow Visibility', 'the-post-grid' ),
|
6894 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6895 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
6896 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
6897 |
'return_value' => 'yes',
|
6898 |
'default' => 'yes',
|
6899 |
'condition' => [
|
6906 |
$ref->add_control(
|
6907 |
'arrow_position',
|
6908 |
[
|
6909 |
+
'label' => esc_html__( 'Arrow Position', 'the-post-grid' ),
|
6910 |
'type' => \Elementor\Controls_Manager::SELECT,
|
6911 |
'default' => 'default',
|
6912 |
'options' => [
|
6913 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
6914 |
+
'top-right' => esc_html__( 'Top Right', 'the-post-grid' ),
|
6915 |
+
'top-left' => esc_html__( 'Top Left', 'the-post-grid' ),
|
6916 |
+
'show-hover' => esc_html__( 'Center (Show on hover)', 'the-post-grid' ),
|
6917 |
],
|
6918 |
'condition' => [
|
6919 |
'arrows' => 'yes',
|
6926 |
$ref->add_control(
|
6927 |
'dots',
|
6928 |
[
|
6929 |
+
'label' => esc_html__( 'Dots Visibility', 'the-post-grid' ),
|
6930 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6931 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
6932 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
6933 |
'return_value' => 'yes',
|
6934 |
'default' => 'yes',
|
6935 |
'prefix_class' => 'slider-dot-enable-',
|
6943 |
$ref->add_control(
|
6944 |
'dynamic_dots',
|
6945 |
[
|
6946 |
+
'label' => esc_html__( 'Enable Dynamic Dots', 'the-post-grid' ),
|
6947 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6948 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
6949 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
6950 |
'return_value' => 'yes',
|
6951 |
'default' => 'no',
|
6952 |
'render_type' => 'template',
|
6960 |
$ref->add_control(
|
6961 |
'dots_style',
|
6962 |
[
|
6963 |
+
'label' => esc_html__( 'Dots Style', 'the-post-grid' ),
|
6964 |
'type' => \Elementor\Controls_Manager::SELECT,
|
6965 |
'default' => 'default',
|
6966 |
'options' => [
|
6967 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
6968 |
+
'background' => esc_html__( 'With Background', 'the-post-grid' ),
|
6969 |
],
|
6970 |
'condition' => [
|
6971 |
'dots' => 'yes',
|
6978 |
$ref->add_control(
|
6979 |
'infinite',
|
6980 |
[
|
6981 |
+
'label' => esc_html__( 'Infinite', 'the-post-grid' ),
|
6982 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6983 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
6984 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
6985 |
'return_value' => 'yes',
|
6986 |
'default' => 'yes',
|
6987 |
]
|
6990 |
$ref->add_control(
|
6991 |
'autoplay',
|
6992 |
[
|
6993 |
+
'label' => esc_html__( 'Autoplay', 'the-post-grid' ),
|
6994 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
6995 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
6996 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
6997 |
'return_value' => 'yes',
|
6998 |
'default' => false,
|
6999 |
]
|
7002 |
$ref->add_control(
|
7003 |
'autoplaySpeed',
|
7004 |
[
|
7005 |
+
'label' => esc_html__( 'Autoplay Speed', 'the-post-grid' ),
|
7006 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
7007 |
'min' => 1000,
|
7008 |
'max' => 10000,
|
7017 |
$ref->add_control(
|
7018 |
'stopOnHover',
|
7019 |
[
|
7020 |
+
'label' => esc_html__( 'Stop On Hover', 'the-post-grid' ),
|
7021 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7022 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
7023 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
7024 |
'return_value' => 'yes',
|
7025 |
'default' => 'yes',
|
7026 |
'condition' => [
|
7032 |
$ref->add_control(
|
7033 |
'grabCursor',
|
7034 |
[
|
7035 |
+
'label' => esc_html__( 'Allow Touch Move', 'the-post-grid' ),
|
7036 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7037 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
7038 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
7039 |
'return_value' => 'yes',
|
7040 |
'default' => 'yes',
|
7041 |
]
|
7045 |
$ref->add_control(
|
7046 |
'autoHeight',
|
7047 |
[
|
7048 |
+
'label' => esc_html__( 'Auto Height', 'the-post-grid' ),
|
7049 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7050 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
7051 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
7052 |
'return_value' => 'yes',
|
7053 |
'default' => false,
|
7054 |
'condition' => [
|
7061 |
$ref->add_control(
|
7062 |
'lazyLoad',
|
7063 |
[
|
7064 |
+
'label' => esc_html__( 'lazy Load', 'the-post-grid' ),
|
7065 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7066 |
+
'label_on' => esc_html__( 'Yes', 'the-post-grid' ),
|
7067 |
+
'label_off' => esc_html__( 'No', 'the-post-grid' ),
|
7068 |
'return_value' => 'yes',
|
7069 |
'default' => false,
|
7070 |
'prefix_class' => 'is-lazy-load-',
|
7075 |
$ref->add_control(
|
7076 |
'speed',
|
7077 |
[
|
7078 |
+
'label' => esc_html__( 'Speed', 'the-post-grid' ),
|
7079 |
'type' => \Elementor\Controls_Manager::NUMBER,
|
7080 |
'min' => 100,
|
7081 |
'max' => 3000,
|
7087 |
$ref->add_control(
|
7088 |
'enable_2_rows',
|
7089 |
[
|
7090 |
+
'label' => esc_html__( 'Enable 2 Rows', 'the-post-grid' ),
|
7091 |
'type' => \Elementor\Controls_Manager::SWITCHER,
|
7092 |
+
'label_on' => esc_html__( 'Show', 'the-post-grid' ),
|
7093 |
+
'label_off' => esc_html__( 'Hide', 'the-post-grid' ),
|
7094 |
'return_value' => 'yes',
|
7095 |
'default' => false,
|
7096 |
'prefix_class' => 'enable-two-rows-',
|
7097 |
'render_type' => 'template',
|
7098 |
+
'description' => esc_html__( 'If you use 2 rows then you have to put an even number for post limit', 'the-post-grid' ),
|
7099 |
'condition' => [
|
7100 |
$prefix . '_layout!' => [ 'slider-layout13',
|
7101 |
'slider-layout11',
|
7109 |
$ref->add_control(
|
7110 |
'carousel_overflow',
|
7111 |
[
|
7112 |
+
'label' => esc_html__( 'Slider Overflow', 'the-post-grid' ),
|
7113 |
'type' => \Elementor\Controls_Manager::SELECT,
|
7114 |
'default' => 'hidden',
|
7115 |
'options' => [
|
7116 |
+
'hidden' => esc_html__( 'Hidden', 'the-post-grid' ),
|
7117 |
+
'none' => esc_html__( 'None', 'the-post-grid' ),
|
7118 |
],
|
7119 |
'render_type' => 'template',
|
7120 |
'prefix_class' => 'is-carousel-overflow-',
|
7127 |
$ref->add_control(
|
7128 |
'slider_direction',
|
7129 |
[
|
7130 |
+
'label' => esc_html__( 'Direction', 'the-post-grid' ),
|
7131 |
'type' => \Elementor\Controls_Manager::SELECT,
|
7132 |
'default' => 'ltr',
|
7133 |
'options' => [
|
7134 |
+
'ltr' => esc_html__( 'LTR', 'the-post-grid' ),
|
7135 |
+
'rtl' => esc_html__( 'RTL', 'the-post-grid' ),
|
7136 |
],
|
7137 |
'prefix_class' => 'slider-direction-',
|
7138 |
'render_type' => 'template',
|
7173 |
$ref->add_control(
|
7174 |
'arrow_style_heading',
|
7175 |
[
|
7176 |
+
'label' => esc_html__( 'Arrow Style', 'the-post-grid' ),
|
7177 |
'type' => \Elementor\Controls_Manager::HEADING,
|
7178 |
'separator' => 'before',
|
7179 |
'classes' => 'tpg-control-type-heading',
|
7186 |
$ref->add_responsive_control(
|
7187 |
'arrow_font_size',
|
7188 |
[
|
7189 |
+
'label' => esc_html__( 'Arrow Font Size', 'the-post-grid' ),
|
7190 |
'type' => Controls_Manager::SLIDER,
|
7191 |
'size_units' => [ 'px' ],
|
7192 |
'range' => [
|
7208 |
$ref->add_responsive_control(
|
7209 |
'arrow_border_radius',
|
7210 |
[
|
7211 |
+
'label' => esc_html__( 'Arrow Radius', 'the-post-grid' ),
|
7212 |
'type' => Controls_Manager::SLIDER,
|
7213 |
'size_units' => [ 'px', '%' ],
|
7214 |
'range' => [
|
7235 |
$ref->add_responsive_control(
|
7236 |
'arrow_width',
|
7237 |
[
|
7238 |
+
'label' => esc_html__( 'Arrow Width', 'the-post-grid' ),
|
7239 |
'type' => Controls_Manager::SLIDER,
|
7240 |
'size_units' => [ 'px' ],
|
7241 |
'range' => [
|
7257 |
$ref->add_responsive_control(
|
7258 |
'arrow_height',
|
7259 |
[
|
7260 |
+
'label' => esc_html__( 'Arrow Height', 'the-post-grid' ),
|
7261 |
'type' => Controls_Manager::SLIDER,
|
7262 |
'size_units' => [ 'px' ],
|
7263 |
'range' => [
|
7279 |
$ref->add_responsive_control(
|
7280 |
'arrow_x_position',
|
7281 |
[
|
7282 |
+
'label' => esc_html__( 'Arrow X Position', 'the-post-grid' ),
|
7283 |
'type' => Controls_Manager::SLIDER,
|
7284 |
'size_units' => [ 'px' ],
|
7285 |
'range' => [
|
7304 |
$ref->add_responsive_control(
|
7305 |
'arrow_y_position',
|
7306 |
[
|
7307 |
+
'label' => esc_html__( 'Arrow Y Position', 'the-post-grid' ),
|
7308 |
'type' => Controls_Manager::SLIDER,
|
7309 |
'size_units' => [ 'px', '%' ],
|
7310 |
'range' => [
|
7337 |
$ref->start_controls_tab(
|
7338 |
'arrow_style_normal_tab',
|
7339 |
[
|
7340 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
7341 |
]
|
7342 |
);
|
7343 |
|
7367 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
7368 |
[
|
7369 |
'name' => 'arrow_box_shadow',
|
7370 |
+
'label' => esc_html__( 'Box Shadow', 'the-post-grid' ),
|
7371 |
'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn',
|
7372 |
]
|
7373 |
);
|
7386 |
$ref->start_controls_tab(
|
7387 |
'arrow_style_hover_tab',
|
7388 |
[
|
7389 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
7390 |
]
|
7391 |
);
|
7392 |
|
7416 |
\Elementor\Group_Control_Box_Shadow::get_type(),
|
7417 |
[
|
7418 |
'name' => 'arrow_box_shadow_hover',
|
7419 |
+
'label' => esc_html__( 'Box Shadow - Hover', 'the-post-grid' ),
|
7420 |
'selector' => '{{WRAPPER}} .rt-tpg-container .swiper-navigation .slider-btn:hover',
|
7421 |
]
|
7422 |
);
|
7441 |
$ref->add_control(
|
7442 |
'dot_style_heading',
|
7443 |
[
|
7444 |
+
'label' => esc_html__( 'Dots Style', 'the-post-grid' ),
|
7445 |
'type' => \Elementor\Controls_Manager::HEADING,
|
7446 |
'separator' => 'before',
|
7447 |
'classes' => 'tpg-control-type-heading',
|
7454 |
$ref->add_control(
|
7455 |
'dots_text_align',
|
7456 |
[
|
7457 |
+
'label' => esc_html__( 'Dots Alignment', 'the-post-grid' ),
|
7458 |
'type' => \Elementor\Controls_Manager::CHOOSE,
|
7459 |
'options' => [
|
7460 |
'left' => [
|
7461 |
+
'title' => esc_html__( 'Left', 'the-post-grid' ),
|
7462 |
'icon' => 'eicon-text-align-left',
|
7463 |
],
|
7464 |
'center' => [
|
7465 |
+
'title' => esc_html__( 'Center', 'the-post-grid' ),
|
7466 |
'icon' => 'eicon-text-align-center',
|
7467 |
],
|
7468 |
'right' => [
|
7469 |
+
'title' => esc_html__( 'Right', 'the-post-grid' ),
|
7470 |
'icon' => 'eicon-text-align-right',
|
7471 |
],
|
7472 |
],
|
7482 |
$ref->add_responsive_control(
|
7483 |
'dot_wrapper_radius',
|
7484 |
[
|
7485 |
+
'label' => esc_html__( 'Dots Wrapper Radius', 'the-post-grid' ),
|
7486 |
'type' => Controls_Manager::SLIDER,
|
7487 |
'size_units' => [ 'px', '%' ],
|
7488 |
'range' => [
|
7505 |
$ref->add_responsive_control(
|
7506 |
'dots_border_radius',
|
7507 |
[
|
7508 |
+
'label' => esc_html__( 'Dots Radius', 'the-post-grid' ),
|
7509 |
'type' => Controls_Manager::SLIDER,
|
7510 |
'size_units' => [ 'px', '%' ],
|
7511 |
'range' => [
|
7532 |
$ref->add_responsive_control(
|
7533 |
'dots_width',
|
7534 |
[
|
7535 |
+
'label' => esc_html__( 'Dots Width', 'the-post-grid' ),
|
7536 |
'type' => Controls_Manager::SLIDER,
|
7537 |
'size_units' => [ 'px' ],
|
7538 |
'range' => [
|
7555 |
$ref->add_responsive_control(
|
7556 |
'dots_height',
|
7557 |
[
|
7558 |
+
'label' => esc_html__( 'Dots Height', 'the-post-grid' ),
|
7559 |
'type' => Controls_Manager::SLIDER,
|
7560 |
'size_units' => [ 'px' ],
|
7561 |
'range' => [
|
7578 |
$ref->add_responsive_control(
|
7579 |
'dots_margin',
|
7580 |
[
|
7581 |
+
'label' => esc_html__( 'Dots Margin', 'the-post-grid' ),
|
7582 |
'type' => Controls_Manager::SLIDER,
|
7583 |
'size_units' => [ 'px' ],
|
7584 |
'range' => [
|
7600 |
$ref->add_responsive_control(
|
7601 |
'dots_position',
|
7602 |
[
|
7603 |
+
'label' => esc_html__( 'Dots Y Position', 'the-post-grid' ),
|
7604 |
'type' => Controls_Manager::SLIDER,
|
7605 |
'size_units' => [ 'px' ],
|
7606 |
'range' => [
|
7633 |
$ref->start_controls_tab(
|
7634 |
'dots_style_normal_tab',
|
7635 |
[
|
7636 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
7637 |
]
|
7638 |
);
|
7639 |
|
7686 |
$ref->start_controls_tab(
|
7687 |
'dots_style_hover_tab',
|
7688 |
[
|
7689 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
7690 |
]
|
7691 |
);
|
7692 |
|
7733 |
$ref->add_control(
|
7734 |
'popup_head_bg',
|
7735 |
[
|
7736 |
+
'label' => esc_html__( 'Header Background', 'the-post-grid' ),
|
7737 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7738 |
'selectors' => [
|
7739 |
'body .rt-popup-wrap .rt-popup-navigation-wrap' => 'background-color: {{VALUE}}',
|
7744 |
$ref->add_control(
|
7745 |
'popup_head_txt_color',
|
7746 |
[
|
7747 |
+
'label' => esc_html__( 'Header Text Color', 'the-post-grid' ),
|
7748 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7749 |
'selectors' => [
|
7750 |
'body #rt-popup-wrap .rt-popup-singlePage-counter' => 'color: {{VALUE}}',
|
7755 |
$ref->add_control(
|
7756 |
'popup_title_color',
|
7757 |
[
|
7758 |
+
'label' => esc_html__( 'Popup Title Color', 'the-post-grid' ),
|
7759 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7760 |
'selectors' => [
|
7761 |
'body .md-content .rt-md-content-holder > .md-header .entry-title' => 'color: {{VALUE}}',
|
7769 |
$ref->add_control(
|
7770 |
'popup_meta_color',
|
7771 |
[
|
7772 |
+
'label' => esc_html__( 'Popup Meta Color', 'the-post-grid' ),
|
7773 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7774 |
'selectors' => [
|
7775 |
'body .md-content .rt-md-content-holder > .md-header .post-meta-user *' => 'color: {{VALUE}}',
|
7782 |
$ref->add_control(
|
7783 |
'popup_content_color',
|
7784 |
[
|
7785 |
+
'label' => esc_html__( 'Popup Content Color', 'the-post-grid' ),
|
7786 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7787 |
'selectors' => [
|
7788 |
'body .md-content .rt-md-content *' => 'color: {{VALUE}}',
|
7795 |
$ref->add_control(
|
7796 |
'popup_bg',
|
7797 |
[
|
7798 |
+
'label' => esc_html__( 'Popup Background', 'the-post-grid' ),
|
7799 |
'type' => \Elementor\Controls_Manager::COLOR,
|
7800 |
'selectors' => [
|
7801 |
'body .md-content, body #rt-popup-wrap .rt-popup-content' => 'background-color: {{VALUE}}',
|
7896 |
\Elementor\Group_Control_Background::get_type(),
|
7897 |
[
|
7898 |
'name' => 'thumb_wrapper_bg',
|
7899 |
+
'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ),
|
7900 |
'fields_options' => [
|
7901 |
'background' => [
|
7902 |
'label' => esc_html__( 'Thumb Wrapper Background', 'the-post-grid' ),
|
7947 |
\Elementor\Group_Control_Typography::get_type(),
|
7948 |
[
|
7949 |
'name' => 'acf_group_title_typography',
|
7950 |
+
'label' => esc_html__( 'Group Title Typography', 'the-post-grid' ),
|
7951 |
'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-group-title',
|
7952 |
]
|
7953 |
);
|
7956 |
\Elementor\Group_Control_Typography::get_type(),
|
7957 |
[
|
7958 |
'name' => 'acf_typography',
|
7959 |
+
'label' => esc_html__( 'ACF Fields Typography', 'the-post-grid' ),
|
7960 |
'selector' => '{{WRAPPER}} .rt-tpg-container .tpg-cf-fields',
|
7961 |
]
|
7962 |
);
|
7964 |
$ref->add_control(
|
7965 |
'acf_label_style',
|
7966 |
[
|
7967 |
+
'label' => esc_html__( 'Label Style', 'the-post-grid' ),
|
7968 |
'type' => \Elementor\Controls_Manager::SELECT,
|
7969 |
'default' => 'inline',
|
7970 |
'options' => [
|
7971 |
+
'default' => esc_html__( 'Default', 'the-post-grid' ),
|
7972 |
+
'inline' => esc_html__( 'Inline', 'the-post-grid' ),
|
7973 |
+
'block' => esc_html__( 'Block', 'the-post-grid' ),
|
7974 |
],
|
7975 |
'condition' => [
|
7976 |
'cf_show_only_value' => 'yes',
|
7983 |
$ref->add_responsive_control(
|
7984 |
'acf_label_width',
|
7985 |
[
|
7986 |
+
'label' => esc_html__( 'Label Min Width', 'the-post-grid' ),
|
7987 |
'type' => Controls_Manager::SLIDER,
|
7988 |
'size_units' => [ 'px' ],
|
7989 |
'range' => [
|
8041 |
$ref->start_controls_tab(
|
8042 |
'acf_style_normal_tab',
|
8043 |
[
|
8044 |
+
'label' => esc_html__( 'Normal', 'the-post-grid' ),
|
8045 |
]
|
8046 |
);
|
8047 |
}
|
8048 |
$ref->add_control(
|
8049 |
'acf_group_title_color',
|
8050 |
[
|
8051 |
+
'label' => esc_html__( 'Group Title Color', 'the-post-grid' ),
|
8052 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8053 |
'selectors' => [
|
8054 |
'{{WRAPPER}} .acf-custom-field-wrap .tpg-cf-group-title' => 'color: {{VALUE}}',
|
8062 |
$ref->add_control(
|
8063 |
'acf_label_color',
|
8064 |
[
|
8065 |
+
'label' => esc_html__( 'Label Color', 'the-post-grid' ),
|
8066 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8067 |
'selectors' => [
|
8068 |
'{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-label' => 'color: {{VALUE}}',
|
8076 |
$ref->add_control(
|
8077 |
'acf_value_color',
|
8078 |
[
|
8079 |
+
'label' => esc_html__( 'Value Color', 'the-post-grid' ),
|
8080 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8081 |
'selectors' => [
|
8082 |
'{{WRAPPER}} .acf-custom-field-wrap .tgp-cf-field-value' => 'color: {{VALUE}}',
|
8092 |
$ref->start_controls_tab(
|
8093 |
'acf_style_hover_tab',
|
8094 |
[
|
8095 |
+
'label' => esc_html__( 'Hover', 'the-post-grid' ),
|
8096 |
]
|
8097 |
);
|
8098 |
|
8099 |
$ref->add_control(
|
8100 |
'acf_group_title_color_hover',
|
8101 |
[
|
8102 |
+
'label' => esc_html__( 'Group Title Color - Hover', 'the-post-grid' ),
|
8103 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8104 |
'selectors' => [
|
8105 |
'{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tpg-cf-group-title' => 'color: {{VALUE}}',
|
8113 |
$ref->add_control(
|
8114 |
'acf_label_color_hover',
|
8115 |
[
|
8116 |
+
'label' => esc_html__( 'Label Color - Hover', 'the-post-grid' ),
|
8117 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8118 |
'selectors' => [
|
8119 |
'{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-label' => 'color: {{VALUE}}',
|
8127 |
$ref->add_control(
|
8128 |
'acf_value_color_hover',
|
8129 |
[
|
8130 |
+
'label' => esc_html__( 'Value Color - Hover', 'the-post-grid' ),
|
8131 |
'type' => \Elementor\Controls_Manager::COLOR,
|
8132 |
'selectors' => [
|
8133 |
'{{WRAPPER}} .rt-tpg-container .rt-holder:hover .tgp-cf-field-value' => 'color: {{VALUE}}',
|
8141 |
//End Tab
|
8142 |
}
|
8143 |
}
|
8144 |
+
}
|
|
|
|
|
|
app/Widgets/elementor/rtTPGElementorQuery.php
CHANGED
@@ -1,23 +1,25 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
-
|
9 |
-
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class rtTPGElementorQuery {
|
15 |
|
16 |
/**
|
17 |
* Post Query for normal grid widget
|
18 |
*
|
19 |
* @param $data
|
20 |
-
* @param string
|
21 |
*
|
22 |
* @return array
|
23 |
*/
|
@@ -29,8 +31,6 @@ class rtTPGElementorQuery {
|
|
29 |
|
30 |
$excluded_ids = null;
|
31 |
|
32 |
-
|
33 |
-
|
34 |
if ( $data['post_id'] ) {
|
35 |
$post_ids = explode( ',', $data['post_id'] );
|
36 |
$post_ids = array_map( 'trim', $post_ids );
|
@@ -42,8 +42,8 @@ class rtTPGElementorQuery {
|
|
42 |
}
|
43 |
}
|
44 |
|
45 |
-
if (
|
46 |
-
$_paged = is_front_page() ?
|
47 |
$args['paged'] = get_query_var( $_paged ) ? absint( get_query_var( $_paged ) ) : 1;
|
48 |
}
|
49 |
|
@@ -52,9 +52,10 @@ class rtTPGElementorQuery {
|
|
52 |
}
|
53 |
|
54 |
if ( $orderby = $data['orderby'] ) {
|
55 |
-
if(! rtTPG()->hasPro() && 'rand' == $orderby) {
|
56 |
$orderby = 'date';
|
57 |
}
|
|
|
58 |
$args['orderby'] = $orderby;
|
59 |
}
|
60 |
|
@@ -96,6 +97,7 @@ class rtTPGElementorQuery {
|
|
96 |
}
|
97 |
} else {
|
98 |
$setting_key = $object->name . '_ids';
|
|
|
99 |
if ( ! empty( $data[ $setting_key ] ) ) {
|
100 |
$args['tax_query'][] = [
|
101 |
'taxonomy' => $object->name,
|
@@ -131,6 +133,7 @@ class rtTPGElementorQuery {
|
|
131 |
}
|
132 |
} else {
|
133 |
$_posts_per_page = 9;
|
|
|
134 |
if ( 'grid' === $prefix ) {
|
135 |
if ( $data['grid_layout'] == 'grid-layout5' ) {
|
136 |
$_posts_per_page = 5;
|
@@ -150,8 +153,10 @@ class rtTPGElementorQuery {
|
|
150 |
$_posts_per_page = 7;
|
151 |
} elseif ( in_array( $data['grid_hover_layout'], [ 'grid_hover-layout5', 'grid_hover-layout5-2' ] ) ) {
|
152 |
$_posts_per_page = 3;
|
153 |
-
} elseif ( in_array(
|
154 |
-
[
|
|
|
|
|
155 |
) {
|
156 |
$_posts_per_page = 4;
|
157 |
} elseif ( in_array( $data['grid_hover_layout'], [ 'grid_hover-layout7', 'grid_hover-layout7-2', 'grid_hover-layout8' ] ) ) {
|
@@ -169,29 +174,32 @@ class rtTPGElementorQuery {
|
|
169 |
}
|
170 |
} else {
|
171 |
$slider_per_page = $data['post_limit'];
|
|
|
172 |
if ( $data['slider_layout'] == 'slider-layout10' ) {
|
173 |
$slider_reminder = ( intval( $data['post_limit'], 10 ) % 5 );
|
174 |
if ( $slider_reminder ) {
|
175 |
$slider_per_page = ( $data['post_limit'] - $slider_reminder + 5 );
|
176 |
}
|
177 |
}
|
|
|
178 |
$args['posts_per_page'] = $slider_per_page;
|
179 |
}
|
180 |
|
181 |
-
|
182 |
if ( $data['exclude'] || $data['offset'] ) {
|
183 |
$excluded_ids = [];
|
|
|
184 |
if ( $data['exclude'] ) {
|
185 |
$excluded_ids = explode( ',', $data['exclude'] );
|
186 |
$excluded_ids = array_map( 'trim', $excluded_ids );
|
187 |
}
|
188 |
|
189 |
$offset_posts = [];
|
|
|
190 |
if ( $data['offset'] ) {
|
191 |
$_temp_args = $args;
|
192 |
-
unset($_temp_args['paged']);
|
193 |
$_temp_args['posts_per_page'] = $data['offset'];
|
194 |
-
$_temp_args['fields']
|
195 |
|
196 |
$offset_posts = get_posts( $_temp_args );
|
197 |
}
|
@@ -208,8 +216,8 @@ class rtTPGElementorQuery {
|
|
208 |
* Post Query for page builder block
|
209 |
*
|
210 |
* @param $data
|
211 |
-
* @param string
|
212 |
-
* @param string
|
213 |
*
|
214 |
* @return array
|
215 |
*/
|
@@ -238,12 +246,15 @@ class rtTPGElementorQuery {
|
|
238 |
}
|
239 |
|
240 |
$slider_per_page = $data['post_limit'];
|
|
|
241 |
if ( $data['slider_layout'] == 'slider-layout10' ) {
|
242 |
$slider_reminder = ( intval( $data['post_limit'], 10 ) % 5 );
|
|
|
243 |
if ( $slider_reminder ) {
|
244 |
$slider_per_page = ( $data['post_limit'] - $slider_reminder + 5 );
|
245 |
}
|
246 |
}
|
|
|
247 |
$args['posts_per_page'] = $slider_per_page;
|
248 |
} else {
|
249 |
$args = [
|
@@ -256,12 +267,14 @@ class rtTPGElementorQuery {
|
|
256 |
|
257 |
if ( $data['exclude'] || $data['offset'] ) {
|
258 |
$excluded_ids = [];
|
|
|
259 |
if ( $data['exclude'] ) {
|
260 |
$excluded_ids = explode( ',', $data['exclude'] );
|
261 |
$excluded_ids = array_map( 'trim', $excluded_ids );
|
262 |
}
|
263 |
|
264 |
$offset_posts = [];
|
|
|
265 |
if ( $data['offset'] ) {
|
266 |
$_temp_args = [
|
267 |
'post_type' => 'post',
|
@@ -317,7 +330,7 @@ class rtTPGElementorQuery {
|
|
317 |
}
|
318 |
|
319 |
if ( 'slider' !== $prefix && 'show' === $data['show_pagination'] ) {
|
320 |
-
$args['paged'] = get_query_var(
|
321 |
}
|
322 |
|
323 |
if ( is_tag() ) {
|
@@ -356,5 +369,4 @@ class rtTPGElementorQuery {
|
|
356 |
|
357 |
return $args;
|
358 |
}
|
359 |
-
|
360 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Elementor Query Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
+
// Do not allow directly accessing this file.
|
|
|
9 |
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit( 'This script cannot be accessed directly.' );
|
11 |
}
|
12 |
|
13 |
+
/**
|
14 |
+
* Elementor Query Class
|
15 |
+
*/
|
16 |
class rtTPGElementorQuery {
|
17 |
|
18 |
/**
|
19 |
* Post Query for normal grid widget
|
20 |
*
|
21 |
* @param $data
|
22 |
+
* @param string $prefix
|
23 |
*
|
24 |
* @return array
|
25 |
*/
|
31 |
|
32 |
$excluded_ids = null;
|
33 |
|
|
|
|
|
34 |
if ( $data['post_id'] ) {
|
35 |
$post_ids = explode( ',', $data['post_id'] );
|
36 |
$post_ids = array_map( 'trim', $post_ids );
|
42 |
}
|
43 |
}
|
44 |
|
45 |
+
if ( 'slider' !== $prefix && 'show' === $data['show_pagination'] ) {
|
46 |
+
$_paged = is_front_page() ? 'page' : 'paged';
|
47 |
$args['paged'] = get_query_var( $_paged ) ? absint( get_query_var( $_paged ) ) : 1;
|
48 |
}
|
49 |
|
52 |
}
|
53 |
|
54 |
if ( $orderby = $data['orderby'] ) {
|
55 |
+
if ( ! rtTPG()->hasPro() && 'rand' == $orderby ) {
|
56 |
$orderby = 'date';
|
57 |
}
|
58 |
+
|
59 |
$args['orderby'] = $orderby;
|
60 |
}
|
61 |
|
97 |
}
|
98 |
} else {
|
99 |
$setting_key = $object->name . '_ids';
|
100 |
+
|
101 |
if ( ! empty( $data[ $setting_key ] ) ) {
|
102 |
$args['tax_query'][] = [
|
103 |
'taxonomy' => $object->name,
|
133 |
}
|
134 |
} else {
|
135 |
$_posts_per_page = 9;
|
136 |
+
|
137 |
if ( 'grid' === $prefix ) {
|
138 |
if ( $data['grid_layout'] == 'grid-layout5' ) {
|
139 |
$_posts_per_page = 5;
|
153 |
$_posts_per_page = 7;
|
154 |
} elseif ( in_array( $data['grid_hover_layout'], [ 'grid_hover-layout5', 'grid_hover-layout5-2' ] ) ) {
|
155 |
$_posts_per_page = 3;
|
156 |
+
} elseif ( in_array(
|
157 |
+
$data['grid_hover_layout'],
|
158 |
+
[ 'grid_hover-layout6', 'grid_hover-layout6-2', 'grid_hover-layout9', 'grid_hover-layout9-2', 'grid_hover-layout10', 'grid_hover-layout11' ]
|
159 |
+
)
|
160 |
) {
|
161 |
$_posts_per_page = 4;
|
162 |
} elseif ( in_array( $data['grid_hover_layout'], [ 'grid_hover-layout7', 'grid_hover-layout7-2', 'grid_hover-layout8' ] ) ) {
|
174 |
}
|
175 |
} else {
|
176 |
$slider_per_page = $data['post_limit'];
|
177 |
+
|
178 |
if ( $data['slider_layout'] == 'slider-layout10' ) {
|
179 |
$slider_reminder = ( intval( $data['post_limit'], 10 ) % 5 );
|
180 |
if ( $slider_reminder ) {
|
181 |
$slider_per_page = ( $data['post_limit'] - $slider_reminder + 5 );
|
182 |
}
|
183 |
}
|
184 |
+
|
185 |
$args['posts_per_page'] = $slider_per_page;
|
186 |
}
|
187 |
|
|
|
188 |
if ( $data['exclude'] || $data['offset'] ) {
|
189 |
$excluded_ids = [];
|
190 |
+
|
191 |
if ( $data['exclude'] ) {
|
192 |
$excluded_ids = explode( ',', $data['exclude'] );
|
193 |
$excluded_ids = array_map( 'trim', $excluded_ids );
|
194 |
}
|
195 |
|
196 |
$offset_posts = [];
|
197 |
+
|
198 |
if ( $data['offset'] ) {
|
199 |
$_temp_args = $args;
|
200 |
+
unset( $_temp_args['paged'] );
|
201 |
$_temp_args['posts_per_page'] = $data['offset'];
|
202 |
+
$_temp_args['fields'] = 'ids';
|
203 |
|
204 |
$offset_posts = get_posts( $_temp_args );
|
205 |
}
|
216 |
* Post Query for page builder block
|
217 |
*
|
218 |
* @param $data
|
219 |
+
* @param string $prefix
|
220 |
+
* @param string $template_type
|
221 |
*
|
222 |
* @return array
|
223 |
*/
|
246 |
}
|
247 |
|
248 |
$slider_per_page = $data['post_limit'];
|
249 |
+
|
250 |
if ( $data['slider_layout'] == 'slider-layout10' ) {
|
251 |
$slider_reminder = ( intval( $data['post_limit'], 10 ) % 5 );
|
252 |
+
|
253 |
if ( $slider_reminder ) {
|
254 |
$slider_per_page = ( $data['post_limit'] - $slider_reminder + 5 );
|
255 |
}
|
256 |
}
|
257 |
+
|
258 |
$args['posts_per_page'] = $slider_per_page;
|
259 |
} else {
|
260 |
$args = [
|
267 |
|
268 |
if ( $data['exclude'] || $data['offset'] ) {
|
269 |
$excluded_ids = [];
|
270 |
+
|
271 |
if ( $data['exclude'] ) {
|
272 |
$excluded_ids = explode( ',', $data['exclude'] );
|
273 |
$excluded_ids = array_map( 'trim', $excluded_ids );
|
274 |
}
|
275 |
|
276 |
$offset_posts = [];
|
277 |
+
|
278 |
if ( $data['offset'] ) {
|
279 |
$_temp_args = [
|
280 |
'post_type' => 'post',
|
330 |
}
|
331 |
|
332 |
if ( 'slider' !== $prefix && 'show' === $data['show_pagination'] ) {
|
333 |
+
$args['paged'] = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
|
334 |
}
|
335 |
|
336 |
if ( is_tag() ) {
|
369 |
|
370 |
return $args;
|
371 |
}
|
372 |
+
}
|
|
app/Widgets/elementor/widgets/default.php
CHANGED
@@ -1,7 +1,20 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
use RT\ThePostGrid\Helpers\Fns;
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
class RtElementorWidget extends \Elementor\Widget_Base {
|
6 |
|
7 |
public function get_name() {
|
@@ -24,19 +37,19 @@ class RtElementorWidget extends \Elementor\Widget_Base {
|
|
24 |
$this->start_controls_section(
|
25 |
'content_section',
|
26 |
[
|
27 |
-
'label' =>
|
28 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
|
29 |
]
|
30 |
);
|
31 |
|
32 |
$this->add_control(
|
33 |
'post_grid_id',
|
34 |
-
|
35 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
36 |
'id' => 'style',
|
37 |
-
'label' =>
|
38 |
-
'options' => Fns::getAllTPGShortCodeList()
|
39 |
-
|
40 |
);
|
41 |
|
42 |
$this->end_controls_section();
|
@@ -44,10 +57,11 @@ class RtElementorWidget extends \Elementor\Widget_Base {
|
|
44 |
|
45 |
protected function render() {
|
46 |
$settings = $this->get_settings_for_display();
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
51 |
}
|
52 |
}
|
53 |
-
}
|
1 |
<?php
|
2 |
+
/**
|
3 |
+
* Default Widget Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
+
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
+
}
|
14 |
+
|
15 |
+
/**
|
16 |
+
* Default Widget Class
|
17 |
+
*/
|
18 |
class RtElementorWidget extends \Elementor\Widget_Base {
|
19 |
|
20 |
public function get_name() {
|
37 |
$this->start_controls_section(
|
38 |
'content_section',
|
39 |
[
|
40 |
+
'label' => esc_html__( 'The Post Grid (Deprecated)', 'the-post-grid' ),
|
41 |
'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
|
42 |
]
|
43 |
);
|
44 |
|
45 |
$this->add_control(
|
46 |
'post_grid_id',
|
47 |
+
[
|
48 |
'type' => \Elementor\Controls_Manager::SELECT2,
|
49 |
'id' => 'style',
|
50 |
+
'label' => esc_html__( 'Post Grid', 'the-post-grid' ),
|
51 |
+
'options' => Fns::getAllTPGShortCodeList(),
|
52 |
+
]
|
53 |
);
|
54 |
|
55 |
$this->end_controls_section();
|
57 |
|
58 |
protected function render() {
|
59 |
$settings = $this->get_settings_for_display();
|
60 |
+
|
61 |
+
if ( isset( $settings['post_grid_id'] ) && ! empty( $settings['post_grid_id'] ) && $id = $settings['post_grid_id'] ) {
|
62 |
+
echo do_shortcode( '[the-post-grid id="' . absint( $id ) . '"]' );
|
63 |
+
} else {
|
64 |
+
echo esc_html__( 'Please select a post grid', 'the-post-grid' );
|
65 |
}
|
66 |
}
|
67 |
+
}
|
app/Widgets/elementor/widgets/grid-hover-layout-archive.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
-
* @param array
|
20 |
-
* @param null
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
@@ -27,7 +31,7 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
27 |
$this->prefix = 'grid_hover';
|
28 |
$this->tpg_name = esc_html__( 'TPG - Grid Hover Layout', 'the-post-grid' );
|
29 |
$this->tpg_base = 'tpg-grid-hover-layout-archive';
|
30 |
-
$this->tpg_icon = 'eicon-image-rollover tpg-grid-icon';
|
31 |
$this->tpg_category = $this->tpg_archive_category;
|
32 |
}
|
33 |
|
@@ -42,7 +46,7 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
42 |
|
43 |
public function get_style_depends() {
|
44 |
$settings = get_option( rtTPG()->options['settings'] );
|
45 |
-
$style
|
46 |
|
47 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
48 |
array_push( $style, 'rt-fontawsome' );
|
@@ -58,19 +62,19 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
58 |
* ===========
|
59 |
*/
|
60 |
|
61 |
-
//Layout
|
62 |
rtTPGElementorHelper::grid_layouts( $this, 'archive' );
|
63 |
|
64 |
-
//Query
|
65 |
rtTPGElementorHelper::query_builder( $this, 'archive' );
|
66 |
|
67 |
-
//Filter Settings
|
68 |
-
//rtTPGElementorHelper::filter_settings( $this );
|
69 |
|
70 |
-
//Pagination Settings
|
71 |
rtTPGElementorHelper::pagination_settings( $this, 'archive' );
|
72 |
|
73 |
-
//Links
|
74 |
rtTPGElementorHelper::links( $this );
|
75 |
|
76 |
/**
|
@@ -78,28 +82,28 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
78 |
* =============
|
79 |
*/
|
80 |
|
81 |
-
//Field Selection
|
82 |
rtTPGElementorHelper::field_selection( $this );
|
83 |
|
84 |
-
//Section Title Settings
|
85 |
rtTPGElementorHelper::section_title_settings( $this, 'archive' );
|
86 |
|
87 |
-
//Title Settings
|
88 |
rtTPGElementorHelper::post_title_settings( $this );
|
89 |
|
90 |
-
//Thumbnail Settings
|
91 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
92 |
|
93 |
-
//Excerpt Settings
|
94 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
95 |
|
96 |
-
//Meta Settings
|
97 |
rtTPGElementorHelper::post_meta_settings( $this );
|
98 |
|
99 |
-
//Advanced Custom Field ACF Settings
|
100 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
101 |
|
102 |
-
//Readmore Settings
|
103 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
104 |
|
105 |
/**
|
@@ -107,46 +111,46 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
107 |
* ==========
|
108 |
*/
|
109 |
|
110 |
-
//Section Title Style
|
111 |
rtTPGElementorHelper::sectionTitle( $this, 'archive' );
|
112 |
|
113 |
-
// Title Style
|
114 |
rtTPGElementorHelper::titleStyle( $this );
|
115 |
|
116 |
-
//Thumbnail Style
|
117 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
118 |
|
119 |
-
// Content Style
|
120 |
rtTPGElementorHelper::contentStyle( $this );
|
121 |
|
122 |
-
// Meta Info Style
|
123 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
124 |
|
125 |
-
//Box Style
|
126 |
rtTPGElementorHelper::socialShareStyle( $this );
|
127 |
|
128 |
-
//ACF Style
|
129 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
130 |
|
131 |
-
//Read More Style
|
132 |
rtTPGElementorHelper::readmoreStyle( $this );
|
133 |
|
134 |
-
//Link Style
|
135 |
rtTPGElementorHelper::linkStyle( $this );
|
136 |
|
137 |
-
//Pagination - Loadmore Style
|
138 |
rtTPGElementorHelper::paginationStyle( $this );
|
139 |
|
140 |
-
//Box Style
|
141 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
142 |
|
143 |
-
//Promotions Style
|
144 |
rtTPGElementorHelper::promotions( $this );
|
145 |
}
|
146 |
|
147 |
protected function render() {
|
148 |
-
$data
|
149 |
-
$_prefix
|
150 |
$data['post_type'] = 'post';
|
151 |
|
152 |
if ( ! rtTPG()->hasPro() && ! in_array( $data[ $_prefix . '_layout' ], [ 'grid_hover-layout1', 'grid_hover-layout2', 'grid_hover-layout3' ] ) ) {
|
@@ -164,53 +168,56 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
164 |
wp_enqueue_script( 'rt-pagination' );
|
165 |
}
|
166 |
|
167 |
-
//Query
|
168 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix );
|
169 |
$query = new WP_Query( $query_args );
|
170 |
-
$rand =
|
171 |
-
$layoutID =
|
172 |
$posts_per_page = $data['post_limit'];
|
173 |
|
174 |
-
|
175 |
-
//TODO: Get Post Data for render post
|
176 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
177 |
|
178 |
-
//Post type render
|
179 |
$post_types = Fns::get_post_types();
|
|
|
180 |
foreach ( $post_types as $post_type => $label ) {
|
181 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
|
|
182 |
if ( empty( $_taxonomies ) ) {
|
183 |
continue;
|
184 |
}
|
185 |
-
|
186 |
-
$post_data[ $data['post_type'] . '
|
|
|
187 |
}
|
188 |
$template_path = $this->tpg_template_path( $post_data );
|
189 |
$_layout = $data[ $_prefix . '_layout' ];
|
190 |
?>
|
191 |
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
<?php
|
201 |
$settings = get_option( rtTPG()->options['settings'] );
|
202 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
203 |
?>
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
<?php
|
210 |
}
|
211 |
|
212 |
$wrapper_class = [];
|
213 |
-
if ( in_array(
|
|
|
214 |
[
|
215 |
'grid_hover-layout6',
|
216 |
'grid_hover-layout7',
|
@@ -222,7 +229,8 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
222 |
'grid_hover-layout6-2',
|
223 |
'grid_hover-layout7-2',
|
224 |
'grid_hover-layout9-2',
|
225 |
-
]
|
|
|
226 |
) {
|
227 |
$wrapper_class[] = 'grid_hover-layout5';
|
228 |
}
|
@@ -230,18 +238,17 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
230 |
$wrapper_class[] = 'tpg-even grid-behaviour';
|
231 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
232 |
|
233 |
-
//section title settings
|
234 |
-
|
235 |
-
|
236 |
echo "<div class='tpg-header-wrapper'>";
|
237 |
$this->get_section_title( $data );
|
238 |
-
echo
|
239 |
?>
|
240 |
|
241 |
-
|
242 |
<?php
|
243 |
if ( $query->have_posts() ) {
|
244 |
$pCount = 1;
|
|
|
245 |
while ( $query->have_posts() ) {
|
246 |
$query->the_post();
|
247 |
set_query_var( 'tpg_post_count', $pCount );
|
@@ -258,12 +265,12 @@ class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
|
258 |
}
|
259 |
wp_reset_postdata();
|
260 |
?>
|
261 |
-
|
262 |
|
263 |
-
<?php
|
264 |
-
|
265 |
<?php
|
266 |
-
do_action('tpg_elementor_script');
|
267 |
}
|
268 |
|
269 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Grid Hover Layout Archive Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Grid Hover Layout Archive Class
|
17 |
+
*/
|
18 |
class TPGGridHoverLayoutArchive extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
+
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
31 |
$this->prefix = 'grid_hover';
|
32 |
$this->tpg_name = esc_html__( 'TPG - Grid Hover Layout', 'the-post-grid' );
|
33 |
$this->tpg_base = 'tpg-grid-hover-layout-archive';
|
34 |
+
$this->tpg_icon = 'eicon-image-rollover tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
$this->tpg_category = $this->tpg_archive_category;
|
36 |
}
|
37 |
|
46 |
|
47 |
public function get_style_depends() {
|
48 |
$settings = get_option( rtTPG()->options['settings'] );
|
49 |
+
$style = [];
|
50 |
|
51 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
52 |
array_push( $style, 'rt-fontawsome' );
|
62 |
* ===========
|
63 |
*/
|
64 |
|
65 |
+
// Layout.
|
66 |
rtTPGElementorHelper::grid_layouts( $this, 'archive' );
|
67 |
|
68 |
+
// Query.
|
69 |
rtTPGElementorHelper::query_builder( $this, 'archive' );
|
70 |
|
71 |
+
// Filter Settings.
|
72 |
+
// rtTPGElementorHelper::filter_settings( $this );
|
73 |
|
74 |
+
// Pagination Settings.
|
75 |
rtTPGElementorHelper::pagination_settings( $this, 'archive' );
|
76 |
|
77 |
+
// Links.
|
78 |
rtTPGElementorHelper::links( $this );
|
79 |
|
80 |
/**
|
82 |
* =============
|
83 |
*/
|
84 |
|
85 |
+
// Field Selection.
|
86 |
rtTPGElementorHelper::field_selection( $this );
|
87 |
|
88 |
+
// Section Title Settings.
|
89 |
rtTPGElementorHelper::section_title_settings( $this, 'archive' );
|
90 |
|
91 |
+
// Title Settings.
|
92 |
rtTPGElementorHelper::post_title_settings( $this );
|
93 |
|
94 |
+
// Thumbnail Settings.
|
95 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
96 |
|
97 |
+
// Excerpt Settings.
|
98 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
99 |
|
100 |
+
// Meta Settings.
|
101 |
rtTPGElementorHelper::post_meta_settings( $this );
|
102 |
|
103 |
+
// Advanced Custom Field ACF Settings.
|
104 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
105 |
|
106 |
+
// Readmore Settings.
|
107 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
108 |
|
109 |
/**
|
111 |
* ==========
|
112 |
*/
|
113 |
|
114 |
+
// Section Title Style.
|
115 |
rtTPGElementorHelper::sectionTitle( $this, 'archive' );
|
116 |
|
117 |
+
// Title Style.
|
118 |
rtTPGElementorHelper::titleStyle( $this );
|
119 |
|
120 |
+
// Thumbnail Style.
|
121 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
122 |
|
123 |
+
// Content Style.
|
124 |
rtTPGElementorHelper::contentStyle( $this );
|
125 |
|
126 |
+
// Meta Info Style.
|
127 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
128 |
|
129 |
+
// Box Style.
|
130 |
rtTPGElementorHelper::socialShareStyle( $this );
|
131 |
|
132 |
+
// ACF Style.
|
133 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
134 |
|
135 |
+
// Read More Style.
|
136 |
rtTPGElementorHelper::readmoreStyle( $this );
|
137 |
|
138 |
+
// Link Style.
|
139 |
rtTPGElementorHelper::linkStyle( $this );
|
140 |
|
141 |
+
// Pagination - Loadmore Style.
|
142 |
rtTPGElementorHelper::paginationStyle( $this );
|
143 |
|
144 |
+
// Box Style.
|
145 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
146 |
|
147 |
+
// Promotions Style.
|
148 |
rtTPGElementorHelper::promotions( $this );
|
149 |
}
|
150 |
|
151 |
protected function render() {
|
152 |
+
$data = $this->get_settings();
|
153 |
+
$_prefix = $this->prefix;
|
154 |
$data['post_type'] = 'post';
|
155 |
|
156 |
if ( ! rtTPG()->hasPro() && ! in_array( $data[ $_prefix . '_layout' ], [ 'grid_hover-layout1', 'grid_hover-layout2', 'grid_hover-layout3' ] ) ) {
|
168 |
wp_enqueue_script( 'rt-pagination' );
|
169 |
}
|
170 |
|
171 |
+
// Query.
|
172 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix );
|
173 |
$query = new WP_Query( $query_args );
|
174 |
+
$rand = wp_rand();
|
175 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
176 |
$posts_per_page = $data['post_limit'];
|
177 |
|
178 |
+
// TODO: Get Post Data for render post.
|
|
|
179 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
180 |
|
181 |
+
// Post type render.
|
182 |
$post_types = Fns::get_post_types();
|
183 |
+
|
184 |
foreach ( $post_types as $post_type => $label ) {
|
185 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
186 |
+
|
187 |
if ( empty( $_taxonomies ) ) {
|
188 |
continue;
|
189 |
}
|
190 |
+
|
191 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
192 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
193 |
}
|
194 |
$template_path = $this->tpg_template_path( $post_data );
|
195 |
$_layout = $data[ $_prefix . '_layout' ];
|
196 |
?>
|
197 |
|
198 |
+
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper <?php echo esc_attr( $_layout . '-main' ); ?>"
|
199 |
+
id="<?php echo esc_attr( $layoutID ); ?>"
|
200 |
+
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
201 |
+
data-sc-id="elementor"
|
202 |
+
data-el-settings='<?php Fns::print_html( htmlspecialchars( wp_json_encode( $post_data ) ), true ); ?>'
|
203 |
+
data-el-query='<?php Fns::print_html( htmlspecialchars( wp_json_encode( $query_args ) ), true ); ?>'
|
204 |
+
data-el-path='<?php echo esc_attr( $template_path ); ?>'
|
205 |
+
>
|
206 |
<?php
|
207 |
$settings = get_option( rtTPG()->options['settings'] );
|
208 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
209 |
?>
|
210 |
+
<div id="bottom-script-loader" class="bottom-script-loader">
|
211 |
+
<div class="rt-ball-clip-rotate">
|
212 |
+
<div></div>
|
213 |
+
</div>
|
214 |
+
</div>
|
215 |
<?php
|
216 |
}
|
217 |
|
218 |
$wrapper_class = [];
|
219 |
+
if ( in_array(
|
220 |
+
$_layout,
|
221 |
[
|
222 |
'grid_hover-layout6',
|
223 |
'grid_hover-layout7',
|
229 |
'grid_hover-layout6-2',
|
230 |
'grid_hover-layout7-2',
|
231 |
'grid_hover-layout9-2',
|
232 |
+
]
|
233 |
+
)
|
234 |
) {
|
235 |
$wrapper_class[] = 'grid_hover-layout5';
|
236 |
}
|
238 |
$wrapper_class[] = 'tpg-even grid-behaviour';
|
239 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
240 |
|
241 |
+
// section title settings.
|
|
|
|
|
242 |
echo "<div class='tpg-header-wrapper'>";
|
243 |
$this->get_section_title( $data );
|
244 |
+
echo '</div>';
|
245 |
?>
|
246 |
|
247 |
+
<div data-title="Loading ..." class="rt-row rt-content-loader <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
248 |
<?php
|
249 |
if ( $query->have_posts() ) {
|
250 |
$pCount = 1;
|
251 |
+
|
252 |
while ( $query->have_posts() ) {
|
253 |
$query->the_post();
|
254 |
set_query_var( 'tpg_post_count', $pCount );
|
265 |
}
|
266 |
wp_reset_postdata();
|
267 |
?>
|
268 |
+
</div>
|
269 |
|
270 |
+
<?php Fns::print_html( $this->get_pagination_markup( $query, $data ) ); ?>
|
271 |
+
</div>
|
272 |
<?php
|
273 |
+
do_action( 'tpg_elementor_script' );
|
274 |
}
|
275 |
|
276 |
+
}
|
app/Widgets/elementor/widgets/grid-hover-layout.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGGridHoverLayout extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
* @param array $data
|
20 |
-
* @param null
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
@@ -27,7 +31,7 @@ class TPGGridHoverLayout extends Custom_Widget_Base {
|
|
27 |
$this->prefix = 'grid_hover';
|
28 |
$this->tpg_name = esc_html__( 'TPG - Grid Hover Layout', 'the-post-grid' );
|
29 |
$this->tpg_base = 'tpg-grid-hover-layout';
|
30 |
-
$this->tpg_icon = 'eicon-image-rollover tpg-grid-icon';
|
31 |
}
|
32 |
|
33 |
public function get_script_depends() {
|
@@ -57,19 +61,19 @@ class TPGGridHoverLayout extends Custom_Widget_Base {
|
|
57 |
* ===========
|
58 |
*/
|
59 |
|
60 |
-
//Layout
|
61 |
rtTPGElementorHelper::grid_layouts( $this );
|
62 |
|
63 |
-
//Query
|
64 |
rtTPGElementorHelper::query( $this );
|
65 |
|
66 |
-
//Filter Settings
|
67 |
rtTPGElementorHelper::filter_settings( $this );
|
68 |
|
69 |
-
//Pagination Settings
|
70 |
rtTPGElementorHelper::pagination_settings( $this );
|
71 |
|
72 |
-
//Links
|
73 |
rtTPGElementorHelper::links( $this );
|
74 |
|
75 |
/**
|
@@ -77,28 +81,28 @@ class TPGGridHoverLayout extends Custom_Widget_Base {
|
|
77 |
* =============
|
78 |
*/
|
79 |
|
80 |
-
//Field Selection
|
81 |
rtTPGElementorHelper::field_selection( $this );
|
82 |
|
83 |
-
//Section Title Settings
|
84 |
rtTPGElementorHelper::section_title_settings( $this );
|
85 |
|
86 |
-
//Title Settings
|
87 |
rtTPGElementorHelper::post_title_settings( $this );
|
88 |
|
89 |
-
//Thumbnail Settings
|
90 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
91 |
|
92 |
-
//Excerpt Settings
|
93 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
94 |
|
95 |
-
//Meta Settings
|
96 |
rtTPGElementorHelper::post_meta_settings( $this );
|
97 |
|
98 |
-
//Advanced Custom Field ACF Settings
|
99 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
100 |
|
101 |
-
//Readmore Settings
|
102 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
103 |
|
104 |
/**
|
@@ -106,53 +110,58 @@ class TPGGridHoverLayout extends Custom_Widget_Base {
|
|
106 |
* ==========
|
107 |
*/
|
108 |
|
109 |
-
//Section Title Style
|
110 |
rtTPGElementorHelper::sectionTitle( $this );
|
111 |
|
112 |
-
// Title Style
|
113 |
rtTPGElementorHelper::titleStyle( $this );
|
114 |
|
115 |
-
//Thumbnail Style
|
116 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
117 |
|
118 |
-
// Content Style
|
119 |
rtTPGElementorHelper::contentStyle( $this );
|
120 |
|
121 |
-
// Meta Info Style
|
122 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
123 |
|
124 |
-
//Box Style
|
125 |
rtTPGElementorHelper::socialShareStyle( $this );
|
126 |
|
127 |
-
//ACF Style
|
128 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
129 |
|
130 |
-
//Read More Style
|
131 |
rtTPGElementorHelper::readmoreStyle( $this );
|
132 |
|
133 |
-
//Link Style
|
134 |
rtTPGElementorHelper::linkStyle( $this );
|
135 |
|
136 |
-
//Box Style
|
137 |
rtTPGElementorHelper::frontEndFilter( $this );
|
138 |
|
139 |
-
//Pagination - Loadmore Style
|
140 |
rtTPGElementorHelper::paginationStyle( $this );
|
141 |
|
142 |
-
//Box Style
|
143 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
144 |
|
145 |
-
//Promotions Style
|
146 |
rtTPGElementorHelper::promotions( $this );
|
147 |
}
|
148 |
|
149 |
protected function render() {
|
150 |
$data = $this->get_settings();
|
151 |
$_prefix = $this->prefix;
|
152 |
-
|
|
|
|
|
|
|
|
|
153 |
'grid_hover-layout2',
|
154 |
-
'grid_hover-layout3'
|
155 |
-
]
|
|
|
156 |
$data[ $_prefix . '_layout' ] = 'grid_hover-layout1';
|
157 |
}
|
158 |
|
@@ -163,94 +172,101 @@ class TPGGridHoverLayout extends Custom_Widget_Base {
|
|
163 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ] );
|
164 |
}
|
165 |
|
166 |
-
if(rtTPG()->hasPro() && 'button' == $data['filter_type'] && 'carousel' == $data['filter_btn_style']){
|
167 |
-
wp_enqueue_script('swiper');
|
168 |
}
|
169 |
|
170 |
if ( 'show' == $data['show_pagination'] && 'pagination_ajax' == $data['pagination_type'] ) {
|
171 |
wp_enqueue_script( 'rt-pagination' );
|
172 |
}
|
173 |
|
174 |
-
//Query
|
175 |
$query_args = rtTPGElementorQuery::post_query( $data, $_prefix );
|
176 |
$query = new WP_Query( $query_args );
|
177 |
-
$rand =
|
178 |
-
$layoutID =
|
179 |
$posts_per_page = $data['display_per_page'] ? $data['display_per_page'] : $data['post_limit'];
|
180 |
|
181 |
-
|
182 |
-
//TODO: Get Post Data for render post
|
183 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
184 |
|
185 |
-
//Post type render
|
186 |
$post_types = Fns::get_post_types();
|
187 |
foreach ( $post_types as $post_type => $label ) {
|
188 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
|
|
189 |
if ( empty( $_taxonomies ) ) {
|
190 |
continue;
|
191 |
}
|
192 |
-
|
193 |
-
$post_data[ $data['post_type'] . '
|
|
|
194 |
}
|
195 |
$template_path = $this->tpg_template_path( $post_data );
|
196 |
$_layout = $data[ $_prefix . '_layout' ];
|
197 |
?>
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
<?php
|
208 |
$settings = get_option( rtTPG()->options['settings'] );
|
209 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
210 |
?>
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
<?php
|
217 |
}
|
218 |
|
219 |
$wrapper_class = [];
|
220 |
-
if ( in_array(
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
|
|
|
|
|
|
|
|
231 |
$wrapper_class[] = 'grid_hover-layout5';
|
232 |
}
|
233 |
$wrapper_class[] = str_replace( '-2', null, $_layout );
|
234 |
$wrapper_class[] = 'tpg-even grid-behaviour';
|
235 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
236 |
|
237 |
-
//section title settings
|
238 |
$is_carousel = '';
|
|
|
239 |
if ( rtTPG()->hasPro() && 'carousel' == $data['filter_btn_style'] && 'button' == $data['filter_type'] ) {
|
240 |
$is_carousel = 'carousel';
|
241 |
}
|
242 |
|
243 |
echo "<div class='tpg-header-wrapper {$is_carousel}'>";
|
244 |
$this->get_section_title( $data );
|
245 |
-
|
246 |
-
echo
|
247 |
?>
|
248 |
|
249 |
-
|
250 |
-
|
251 |
<?php
|
252 |
if ( $query->have_posts() ) {
|
253 |
$pCount = 1;
|
|
|
254 |
while ( $query->have_posts() ) {
|
255 |
$query->the_post();
|
256 |
set_query_var( 'tpg_post_count', $pCount );
|
@@ -267,12 +283,12 @@ class TPGGridHoverLayout extends Custom_Widget_Base {
|
|
267 |
}
|
268 |
wp_reset_postdata();
|
269 |
?>
|
270 |
-
|
271 |
|
272 |
-
<?php
|
273 |
-
|
274 |
<?php
|
275 |
do_action( 'tpg_elementor_script' );
|
276 |
}
|
277 |
|
278 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Grid Hover Layout Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Grid Hover Layout Class
|
17 |
+
*/
|
18 |
class TPGGridHoverLayout extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
31 |
$this->prefix = 'grid_hover';
|
32 |
$this->tpg_name = esc_html__( 'TPG - Grid Hover Layout', 'the-post-grid' );
|
33 |
$this->tpg_base = 'tpg-grid-hover-layout';
|
34 |
+
$this->tpg_icon = 'eicon-image-rollover tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
}
|
36 |
|
37 |
public function get_script_depends() {
|
61 |
* ===========
|
62 |
*/
|
63 |
|
64 |
+
// Layout.
|
65 |
rtTPGElementorHelper::grid_layouts( $this );
|
66 |
|
67 |
+
// Query.
|
68 |
rtTPGElementorHelper::query( $this );
|
69 |
|
70 |
+
// Filter Settings.
|
71 |
rtTPGElementorHelper::filter_settings( $this );
|
72 |
|
73 |
+
// Pagination Settings.
|
74 |
rtTPGElementorHelper::pagination_settings( $this );
|
75 |
|
76 |
+
// Links.
|
77 |
rtTPGElementorHelper::links( $this );
|
78 |
|
79 |
/**
|
81 |
* =============
|
82 |
*/
|
83 |
|
84 |
+
// Field Selection.
|
85 |
rtTPGElementorHelper::field_selection( $this );
|
86 |
|
87 |
+
// Section Title Settings.
|
88 |
rtTPGElementorHelper::section_title_settings( $this );
|
89 |
|
90 |
+
// Title Settings.
|
91 |
rtTPGElementorHelper::post_title_settings( $this );
|
92 |
|
93 |
+
// Thumbnail Settings.
|
94 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
95 |
|
96 |
+
// Excerpt Settings.
|
97 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
98 |
|
99 |
+
// Meta Settings.
|
100 |
rtTPGElementorHelper::post_meta_settings( $this );
|
101 |
|
102 |
+
// Advanced Custom Field ACF Settings.
|
103 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
104 |
|
105 |
+
// Readmore Settings.
|
106 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
107 |
|
108 |
/**
|
110 |
* ==========
|
111 |
*/
|
112 |
|
113 |
+
// Section Title Style.
|
114 |
rtTPGElementorHelper::sectionTitle( $this );
|
115 |
|
116 |
+
// Title Style.
|
117 |
rtTPGElementorHelper::titleStyle( $this );
|
118 |
|
119 |
+
// Thumbnail Style.
|
120 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
121 |
|
122 |
+
// Content Style.
|
123 |
rtTPGElementorHelper::contentStyle( $this );
|
124 |
|
125 |
+
// Meta Info Style.
|
126 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
127 |
|
128 |
+
// Box Style.
|
129 |
rtTPGElementorHelper::socialShareStyle( $this );
|
130 |
|
131 |
+
// ACF Style.
|
132 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
133 |
|
134 |
+
// Read More Style.
|
135 |
rtTPGElementorHelper::readmoreStyle( $this );
|
136 |
|
137 |
+
// Link Style.
|
138 |
rtTPGElementorHelper::linkStyle( $this );
|
139 |
|
140 |
+
// Box Style.
|
141 |
rtTPGElementorHelper::frontEndFilter( $this );
|
142 |
|
143 |
+
// Pagination - Loadmore Style.
|
144 |
rtTPGElementorHelper::paginationStyle( $this );
|
145 |
|
146 |
+
// Box Style.
|
147 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
148 |
|
149 |
+
// Promotions Style.
|
150 |
rtTPGElementorHelper::promotions( $this );
|
151 |
}
|
152 |
|
153 |
protected function render() {
|
154 |
$data = $this->get_settings();
|
155 |
$_prefix = $this->prefix;
|
156 |
+
|
157 |
+
if ( ! rtTPG()->hasPro() && ! in_array(
|
158 |
+
$data[ $_prefix . '_layout' ],
|
159 |
+
[
|
160 |
+
'grid_hover-layout1',
|
161 |
'grid_hover-layout2',
|
162 |
+
'grid_hover-layout3',
|
163 |
+
]
|
164 |
+
) ) {
|
165 |
$data[ $_prefix . '_layout' ] = 'grid_hover-layout1';
|
166 |
}
|
167 |
|
172 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ] );
|
173 |
}
|
174 |
|
175 |
+
if ( rtTPG()->hasPro() && 'button' == $data['filter_type'] && 'carousel' == $data['filter_btn_style'] ) {
|
176 |
+
wp_enqueue_script( 'swiper' );
|
177 |
}
|
178 |
|
179 |
if ( 'show' == $data['show_pagination'] && 'pagination_ajax' == $data['pagination_type'] ) {
|
180 |
wp_enqueue_script( 'rt-pagination' );
|
181 |
}
|
182 |
|
183 |
+
// Query.
|
184 |
$query_args = rtTPGElementorQuery::post_query( $data, $_prefix );
|
185 |
$query = new WP_Query( $query_args );
|
186 |
+
$rand = wp_rand();
|
187 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
188 |
$posts_per_page = $data['display_per_page'] ? $data['display_per_page'] : $data['post_limit'];
|
189 |
|
190 |
+
// TODO: Get Post Data for render post.
|
|
|
191 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
192 |
|
193 |
+
// Post type render.
|
194 |
$post_types = Fns::get_post_types();
|
195 |
foreach ( $post_types as $post_type => $label ) {
|
196 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
197 |
+
|
198 |
if ( empty( $_taxonomies ) ) {
|
199 |
continue;
|
200 |
}
|
201 |
+
|
202 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
203 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
204 |
}
|
205 |
$template_path = $this->tpg_template_path( $post_data );
|
206 |
$_layout = $data[ $_prefix . '_layout' ];
|
207 |
?>
|
208 |
|
209 |
+
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper <?php echo esc_attr( $_layout . '-main' ); ?>"
|
210 |
+
id="<?php echo esc_attr( $layoutID ); ?>"
|
211 |
+
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
212 |
+
data-sc-id="elementor"
|
213 |
+
data-el-settings='<?php Fns::is_filter_enable( $data ) ? Fns::print_html( htmlspecialchars( wp_json_encode( $post_data ) ), true ) : ''; ?>'
|
214 |
+
data-el-query='<?php Fns::is_filter_enable( $data ) ? Fns::print_html( htmlspecialchars( wp_json_encode( $query_args ) ), true ) : ''; ?>'
|
215 |
+
data-el-path='<?php echo Fns::is_filter_enable( $data ) ? esc_attr( $template_path ) : ''; ?>'
|
216 |
+
>
|
217 |
<?php
|
218 |
$settings = get_option( rtTPG()->options['settings'] );
|
219 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
220 |
?>
|
221 |
+
<div id="bottom-script-loader" class="bottom-script-loader">
|
222 |
+
<div class="rt-ball-clip-rotate">
|
223 |
+
<div></div>
|
224 |
+
</div>
|
225 |
+
</div>
|
226 |
<?php
|
227 |
}
|
228 |
|
229 |
$wrapper_class = [];
|
230 |
+
if ( in_array(
|
231 |
+
$_layout,
|
232 |
+
[
|
233 |
+
'grid_hover-layout6',
|
234 |
+
'grid_hover-layout7',
|
235 |
+
'grid_hover-layout8',
|
236 |
+
'grid_hover-layout9',
|
237 |
+
'grid_hover-layout10',
|
238 |
+
'grid_hover-layout11',
|
239 |
+
'grid_hover-layout5-2',
|
240 |
+
'grid_hover-layout6-2',
|
241 |
+
'grid_hover-layout7-2',
|
242 |
+
'grid_hover-layout9-2',
|
243 |
+
]
|
244 |
+
) ) {
|
245 |
$wrapper_class[] = 'grid_hover-layout5';
|
246 |
}
|
247 |
$wrapper_class[] = str_replace( '-2', null, $_layout );
|
248 |
$wrapper_class[] = 'tpg-even grid-behaviour';
|
249 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
250 |
|
251 |
+
// section title settings.
|
252 |
$is_carousel = '';
|
253 |
+
|
254 |
if ( rtTPG()->hasPro() && 'carousel' == $data['filter_btn_style'] && 'button' == $data['filter_type'] ) {
|
255 |
$is_carousel = 'carousel';
|
256 |
}
|
257 |
|
258 |
echo "<div class='tpg-header-wrapper {$is_carousel}'>";
|
259 |
$this->get_section_title( $data );
|
260 |
+
Fns::print_html( $this->get_frontend_filter_markup( $data ) );
|
261 |
+
echo '</div>';
|
262 |
?>
|
263 |
|
264 |
+
<div data-title="Loading ..."
|
265 |
+
class="rt-row rt-content-loader <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
266 |
<?php
|
267 |
if ( $query->have_posts() ) {
|
268 |
$pCount = 1;
|
269 |
+
|
270 |
while ( $query->have_posts() ) {
|
271 |
$query->the_post();
|
272 |
set_query_var( 'tpg_post_count', $pCount );
|
283 |
}
|
284 |
wp_reset_postdata();
|
285 |
?>
|
286 |
+
</div>
|
287 |
|
288 |
+
<?php Fns::print_html( $this->get_pagination_markup( $query, $data ) ); ?>
|
289 |
+
</div>
|
290 |
<?php
|
291 |
do_action( 'tpg_elementor_script' );
|
292 |
}
|
293 |
|
294 |
+
}
|
app/Widgets/elementor/widgets/grid-layout-archive.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGGridLayoutArchive extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
-
* @param array
|
20 |
-
* @param null
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
@@ -27,7 +31,7 @@ class TPGGridLayoutArchive extends Custom_Widget_Base {
|
|
27 |
$this->prefix = 'grid';
|
28 |
$this->tpg_name = esc_html__( 'TPG - Grid Layout Archive', 'the-post-grid' );
|
29 |
$this->tpg_base = 'tpg-grid-layout-archive';
|
30 |
-
$this->tpg_icon = 'eicon-posts-grid tpg-grid-icon';
|
31 |
$this->tpg_category = $this->tpg_archive_category;
|
32 |
}
|
33 |
|
@@ -42,7 +46,7 @@ class TPGGridLayoutArchive extends Custom_Widget_Base {
|
|
42 |
|
43 |
public function get_style_depends() {
|
44 |
$settings = get_option( rtTPG()->options['settings'] );
|
45 |
-
$style
|
46 |
|
47 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
48 |
array_push( $style, 'rt-fontawsome' );
|
@@ -53,21 +57,21 @@ class TPGGridLayoutArchive extends Custom_Widget_Base {
|
|
53 |
}
|
54 |
|
55 |
protected function register_controls() {
|
56 |
-
/** Content TAB
|
57 |
|
58 |
-
//Layout
|
59 |
rtTPGElementorHelper::grid_layouts( $this, 'archive' );
|
60 |
|
61 |
-
//Query
|
62 |
rtTPGElementorHelper::query_builder( $this );
|
63 |
|
64 |
-
//Filter Settings
|
65 |
-
//rtTPGElementorHelper::filter_settings( $this, 'archive' );
|
66 |
|
67 |
-
//Pagination Settings
|
68 |
rtTPGElementorHelper::pagination_settings( $this, 'archive' );
|
69 |
|
70 |
-
//Links
|
71 |
rtTPGElementorHelper::links( $this );
|
72 |
|
73 |
/**
|
@@ -75,68 +79,66 @@ class TPGGridLayoutArchive extends Custom_Widget_Base {
|
|
75 |
* ===========
|
76 |
*/
|
77 |
|
78 |
-
//Field Selection
|
79 |
rtTPGElementorHelper::field_selection( $this );
|
80 |
|
81 |
-
//Section Title Settings
|
82 |
rtTPGElementorHelper::section_title_settings( $this, 'archive' );
|
83 |
|
84 |
-
//Title Settings
|
85 |
rtTPGElementorHelper::post_title_settings( $this );
|
86 |
|
87 |
-
//Thumbnail Settings
|
88 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
89 |
|
90 |
-
//Excerpt Settings
|
91 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
92 |
|
93 |
-
//Meta Settings
|
94 |
rtTPGElementorHelper::post_meta_settings( $this );
|
95 |
|
96 |
-
//Advanced Custom Field ACF Settings
|
97 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
98 |
|
99 |
-
//Readmore Settings
|
100 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
101 |
|
|
|
102 |
|
103 |
-
|
104 |
-
|
105 |
-
//Section Title Style
|
106 |
rtTPGElementorHelper::sectionTitle( $this, 'archive' );
|
107 |
|
108 |
-
// Title Style
|
109 |
rtTPGElementorHelper::titleStyle( $this );
|
110 |
|
111 |
-
//Thumbnail Style
|
112 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
113 |
|
114 |
-
// Content Style
|
115 |
rtTPGElementorHelper::contentStyle( $this );
|
116 |
|
117 |
-
// Meta Info Style
|
118 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
119 |
|
120 |
-
//Social Share Settings
|
121 |
rtTPGElementorHelper::socialShareStyle( $this );
|
122 |
|
123 |
-
//ACF Style
|
124 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
125 |
|
126 |
-
//Read More Style
|
127 |
rtTPGElementorHelper::readmoreStyle( $this );
|
128 |
|
129 |
-
//Link Style
|
130 |
rtTPGElementorHelper::linkStyle( $this );
|
131 |
|
132 |
-
|
133 |
-
//Pagination - Loadmore Style
|
134 |
rtTPGElementorHelper::paginationStyle( $this );
|
135 |
|
136 |
-
//Box Settings
|
137 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
138 |
|
139 |
-
//Promotions
|
140 |
rtTPGElementorHelper::promotions( $this );
|
141 |
}
|
142 |
|
@@ -165,31 +167,32 @@ class TPGGridLayoutArchive extends Custom_Widget_Base {
|
|
165 |
wp_enqueue_script( 'rt-pagination' );
|
166 |
}
|
167 |
|
168 |
-
//Query
|
169 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix );
|
170 |
$query = new WP_Query( $query_args );
|
171 |
-
$rand =
|
172 |
-
$layoutID =
|
173 |
$posts_per_page = $data['post_limit'];
|
174 |
|
175 |
/**
|
176 |
* TODO: Get Post Data for render post
|
177 |
*/
|
178 |
-
|
179 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
180 |
|
181 |
/**
|
182 |
* Post type render
|
183 |
*/
|
184 |
-
|
185 |
$post_types = Fns::get_post_types();
|
|
|
186 |
foreach ( $post_types as $post_type => $label ) {
|
187 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
|
|
188 |
if ( empty( $_taxonomies ) ) {
|
189 |
continue;
|
190 |
}
|
191 |
-
|
192 |
-
$post_data[ $data['post_type'] . '
|
|
|
193 |
}
|
194 |
|
195 |
$template_path = $this->tpg_template_path( $post_data );
|
@@ -198,55 +201,56 @@ class TPGGridLayoutArchive extends Custom_Widget_Base {
|
|
198 |
|
199 |
?>
|
200 |
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
<?php
|
211 |
|
212 |
$settings = get_option( rtTPG()->options['settings'] );
|
213 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
214 |
?>
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
<?php
|
221 |
}
|
222 |
|
223 |
$wrapper_class = [];
|
224 |
$wrapper_class[] = str_replace( '-2', null, $_layout );
|
225 |
$wrapper_class[] = 'grid-behaviour';
|
226 |
-
$wrapper_class[] = ( in_array( $_layout, [ 'grid-layout2' ] ) ) ?
|
227 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
|
|
228 |
if ( 'masonry' === $_layout_style && ! in_array( $_layout, [ $this->prefix . '-layout2', $this->prefix . '-layout5', $this->prefix . '-layout6' ] ) ) {
|
229 |
$wrapper_class[] = 'tpg-masonry';
|
230 |
}
|
231 |
|
232 |
-
//section title settings
|
233 |
-
|
234 |
echo "<div class='tpg-header-wrapper '>";
|
235 |
$this->get_section_title( $data );
|
236 |
-
echo
|
237 |
?>
|
238 |
|
239 |
-
|
240 |
<?php
|
241 |
if ( $query->have_posts() ) {
|
242 |
$pCount = 1;
|
|
|
243 |
while ( $query->have_posts() ) {
|
244 |
$query->the_post();
|
245 |
set_query_var( 'tpg_post_count', $pCount );
|
246 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
247 |
$this->tpg_template( $post_data );
|
248 |
$pCount ++;
|
249 |
-
//rtTPGElementorHelper::tpg_template($data, $this->tpg_dir);
|
250 |
}
|
251 |
} else {
|
252 |
if ( $data['no_posts_found_text'] ) {
|
@@ -257,17 +261,17 @@ class TPGGridLayoutArchive extends Custom_Widget_Base {
|
|
257 |
}
|
258 |
wp_reset_postdata();
|
259 |
?>
|
260 |
-
|
261 |
|
262 |
-
<?php
|
263 |
-
|
264 |
<?php
|
265 |
if ( 'masonry' === $data[ $_prefix . '_layout_style' ] && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
266 |
?>
|
267 |
-
|
268 |
<?php
|
269 |
}
|
270 |
-
do_action('tpg_elementor_script');
|
271 |
}
|
272 |
|
273 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Grid Layout Archive Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Grid Layout Archive Class
|
17 |
+
*/
|
18 |
class TPGGridLayoutArchive extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
+
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
31 |
$this->prefix = 'grid';
|
32 |
$this->tpg_name = esc_html__( 'TPG - Grid Layout Archive', 'the-post-grid' );
|
33 |
$this->tpg_base = 'tpg-grid-layout-archive';
|
34 |
+
$this->tpg_icon = 'eicon-posts-grid tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
$this->tpg_category = $this->tpg_archive_category;
|
36 |
}
|
37 |
|
46 |
|
47 |
public function get_style_depends() {
|
48 |
$settings = get_option( rtTPG()->options['settings'] );
|
49 |
+
$style = [];
|
50 |
|
51 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
52 |
array_push( $style, 'rt-fontawsome' );
|
57 |
}
|
58 |
|
59 |
protected function register_controls() {
|
60 |
+
/** Content TAB */
|
61 |
|
62 |
+
// Layout.
|
63 |
rtTPGElementorHelper::grid_layouts( $this, 'archive' );
|
64 |
|
65 |
+
// Query.
|
66 |
rtTPGElementorHelper::query_builder( $this );
|
67 |
|
68 |
+
// Filter Settings.
|
69 |
+
// rtTPGElementorHelper::filter_settings( $this, 'archive' );
|
70 |
|
71 |
+
// Pagination Settings.
|
72 |
rtTPGElementorHelper::pagination_settings( $this, 'archive' );
|
73 |
|
74 |
+
// Links.
|
75 |
rtTPGElementorHelper::links( $this );
|
76 |
|
77 |
/**
|
79 |
* ===========
|
80 |
*/
|
81 |
|
82 |
+
// Field Selection.
|
83 |
rtTPGElementorHelper::field_selection( $this );
|
84 |
|
85 |
+
// Section Title Settings.
|
86 |
rtTPGElementorHelper::section_title_settings( $this, 'archive' );
|
87 |
|
88 |
+
// Title Settings.
|
89 |
rtTPGElementorHelper::post_title_settings( $this );
|
90 |
|
91 |
+
// Thumbnail Settings.
|
92 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
93 |
|
94 |
+
// Excerpt Settings.
|
95 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
96 |
|
97 |
+
// Meta Settings.
|
98 |
rtTPGElementorHelper::post_meta_settings( $this );
|
99 |
|
100 |
+
// Advanced Custom Field ACF Settings.
|
101 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
102 |
|
103 |
+
// Readmore Settings.
|
104 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
105 |
|
106 |
+
/** Style TAB */
|
107 |
|
108 |
+
// Section Title Style.
|
|
|
|
|
109 |
rtTPGElementorHelper::sectionTitle( $this, 'archive' );
|
110 |
|
111 |
+
// Title Style.
|
112 |
rtTPGElementorHelper::titleStyle( $this );
|
113 |
|
114 |
+
// Thumbnail Style.
|
115 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
116 |
|
117 |
+
// Content Style.
|
118 |
rtTPGElementorHelper::contentStyle( $this );
|
119 |
|
120 |
+
// Meta Info Style.
|
121 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
122 |
|
123 |
+
// Social Share Settings.
|
124 |
rtTPGElementorHelper::socialShareStyle( $this );
|
125 |
|
126 |
+
// ACF Style.
|
127 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
128 |
|
129 |
+
// Read More Style.
|
130 |
rtTPGElementorHelper::readmoreStyle( $this );
|
131 |
|
132 |
+
// Link Style.
|
133 |
rtTPGElementorHelper::linkStyle( $this );
|
134 |
|
135 |
+
// Pagination - Loadmore Style.
|
|
|
136 |
rtTPGElementorHelper::paginationStyle( $this );
|
137 |
|
138 |
+
// Box Settings.
|
139 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
140 |
|
141 |
+
// Promotions.
|
142 |
rtTPGElementorHelper::promotions( $this );
|
143 |
}
|
144 |
|
167 |
wp_enqueue_script( 'rt-pagination' );
|
168 |
}
|
169 |
|
170 |
+
// Query.
|
171 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix );
|
172 |
$query = new WP_Query( $query_args );
|
173 |
+
$rand = wp_rand();
|
174 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
175 |
$posts_per_page = $data['post_limit'];
|
176 |
|
177 |
/**
|
178 |
* TODO: Get Post Data for render post
|
179 |
*/
|
|
|
180 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
181 |
|
182 |
/**
|
183 |
* Post type render
|
184 |
*/
|
|
|
185 |
$post_types = Fns::get_post_types();
|
186 |
+
|
187 |
foreach ( $post_types as $post_type => $label ) {
|
188 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
189 |
+
|
190 |
if ( empty( $_taxonomies ) ) {
|
191 |
continue;
|
192 |
}
|
193 |
+
|
194 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
195 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
196 |
}
|
197 |
|
198 |
$template_path = $this->tpg_template_path( $post_data );
|
201 |
|
202 |
?>
|
203 |
|
204 |
+
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper clearfix <?php echo esc_attr( $_layout . '-main' ); ?>"
|
205 |
+
id="<?php echo esc_attr( $layoutID ); ?>"
|
206 |
+
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
207 |
+
data-grid-style="<?php echo esc_attr( $data[ $_prefix . '_layout_style' ] ); ?>"
|
208 |
+
data-sc-id="elementor"
|
209 |
+
data-el-settings='<?php Fns::print_html( htmlspecialchars( wp_json_encode( $post_data ) ), true ); ?>'
|
210 |
+
data-el-query='<?php Fns::print_html( htmlspecialchars( wp_json_encode( $query_args ) ), true ); ?>'
|
211 |
+
data-el-path='<?php echo esc_attr( $template_path ); ?>'
|
212 |
+
>
|
213 |
<?php
|
214 |
|
215 |
$settings = get_option( rtTPG()->options['settings'] );
|
216 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
217 |
?>
|
218 |
+
<div id="bottom-script-loader" class="bottom-script-loader">
|
219 |
+
<div class="rt-ball-clip-rotate">
|
220 |
+
<div></div>
|
221 |
+
</div>
|
222 |
+
</div>
|
223 |
<?php
|
224 |
}
|
225 |
|
226 |
$wrapper_class = [];
|
227 |
$wrapper_class[] = str_replace( '-2', null, $_layout );
|
228 |
$wrapper_class[] = 'grid-behaviour';
|
229 |
+
$wrapper_class[] = ( in_array( $_layout, [ 'grid-layout2' ] ) ) ? 'tpg-even' : $_layout_style;
|
230 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
231 |
+
|
232 |
if ( 'masonry' === $_layout_style && ! in_array( $_layout, [ $this->prefix . '-layout2', $this->prefix . '-layout5', $this->prefix . '-layout6' ] ) ) {
|
233 |
$wrapper_class[] = 'tpg-masonry';
|
234 |
}
|
235 |
|
236 |
+
// section title settings.
|
|
|
237 |
echo "<div class='tpg-header-wrapper '>";
|
238 |
$this->get_section_title( $data );
|
239 |
+
echo '</div>';
|
240 |
?>
|
241 |
|
242 |
+
<div data-title="Loading ..." class="rt-row rt-content-loader <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
243 |
<?php
|
244 |
if ( $query->have_posts() ) {
|
245 |
$pCount = 1;
|
246 |
+
|
247 |
while ( $query->have_posts() ) {
|
248 |
$query->the_post();
|
249 |
set_query_var( 'tpg_post_count', $pCount );
|
250 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
251 |
$this->tpg_template( $post_data );
|
252 |
$pCount ++;
|
253 |
+
// rtTPGElementorHelper::tpg_template($data, $this->tpg_dir);
|
254 |
}
|
255 |
} else {
|
256 |
if ( $data['no_posts_found_text'] ) {
|
261 |
}
|
262 |
wp_reset_postdata();
|
263 |
?>
|
264 |
+
</div>
|
265 |
|
266 |
+
<?php Fns::print_html( $this->get_pagination_markup( $query, $data ) ); ?>
|
267 |
+
</div>
|
268 |
<?php
|
269 |
if ( 'masonry' === $data[ $_prefix . '_layout_style' ] && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
270 |
?>
|
271 |
+
<script>jQuery('.rt-row.rt-content-loader.tpg-masonry').isotope();</script>
|
272 |
<?php
|
273 |
}
|
274 |
+
do_action( 'tpg_elementor_script' );
|
275 |
}
|
276 |
|
277 |
+
}
|
app/Widgets/elementor/widgets/grid-layout.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGGridLayout extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
* @param array $data
|
20 |
-
* @param null
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
@@ -27,7 +31,7 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
27 |
$this->prefix = 'grid';
|
28 |
$this->tpg_name = esc_html__( 'TPG - Grid Layout', 'the-post-grid' );
|
29 |
$this->tpg_base = 'tpg-grid-layout';
|
30 |
-
$this->tpg_icon = 'eicon-posts-grid tpg-grid-icon';
|
31 |
}
|
32 |
|
33 |
|
@@ -54,21 +58,21 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
54 |
}
|
55 |
|
56 |
protected function register_controls() {
|
57 |
-
/** Content TAB
|
58 |
|
59 |
-
//Layout
|
60 |
rtTPGElementorHelper::grid_layouts( $this );
|
61 |
|
62 |
-
//Query
|
63 |
rtTPGElementorHelper::query( $this );
|
64 |
|
65 |
-
//Filter Settings
|
66 |
rtTPGElementorHelper::filter_settings( $this );
|
67 |
|
68 |
-
//Pagination Settings
|
69 |
rtTPGElementorHelper::pagination_settings( $this );
|
70 |
|
71 |
-
//Links
|
72 |
rtTPGElementorHelper::links( $this );
|
73 |
|
74 |
/**
|
@@ -76,70 +80,69 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
76 |
* ===========
|
77 |
*/
|
78 |
|
79 |
-
//Field Selection
|
80 |
rtTPGElementorHelper::field_selection( $this );
|
81 |
|
82 |
-
//Section Title Settings
|
83 |
rtTPGElementorHelper::section_title_settings( $this );
|
84 |
|
85 |
-
//Title Settings
|
86 |
rtTPGElementorHelper::post_title_settings( $this );
|
87 |
|
88 |
-
//Thumbnail Settings
|
89 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
90 |
|
91 |
-
//Excerpt Settings
|
92 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
93 |
|
94 |
-
//Meta Settings
|
95 |
rtTPGElementorHelper::post_meta_settings( $this );
|
96 |
|
97 |
-
//Advanced Custom Field ACF Settings
|
98 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
99 |
|
100 |
-
//Readmore Settings
|
101 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
102 |
|
|
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
//Section Title Style
|
107 |
rtTPGElementorHelper::sectionTitle( $this );
|
108 |
|
109 |
-
// Title Style
|
110 |
rtTPGElementorHelper::titleStyle( $this );
|
111 |
|
112 |
-
//Thumbnail Style
|
113 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
114 |
|
115 |
-
// Content Style
|
116 |
rtTPGElementorHelper::contentStyle( $this );
|
117 |
|
118 |
-
// Meta Info Style
|
119 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
120 |
|
121 |
-
//Box Style
|
122 |
rtTPGElementorHelper::socialShareStyle( $this );
|
123 |
|
124 |
-
//ACF Style
|
125 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
126 |
|
127 |
-
//Read More Style
|
128 |
rtTPGElementorHelper::readmoreStyle( $this );
|
129 |
|
130 |
-
//Link Style
|
131 |
rtTPGElementorHelper::linkStyle( $this );
|
132 |
|
133 |
-
//Pagination - Load more Style
|
134 |
rtTPGElementorHelper::paginationStyle( $this );
|
135 |
|
136 |
-
//Box Style
|
137 |
rtTPGElementorHelper::frontEndFilter( $this );
|
138 |
|
139 |
-
//Box Settings
|
140 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
141 |
|
142 |
-
//Promotions
|
143 |
rtTPGElementorHelper::promotions( $this );
|
144 |
}
|
145 |
|
@@ -147,10 +150,14 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
147 |
$data = $this->get_settings();
|
148 |
$_prefix = $this->prefix;
|
149 |
|
150 |
-
if ( ! rtTPG()->hasPro() && ! in_array(
|
|
|
|
|
|
|
151 |
'grid-layout4',
|
152 |
-
'grid-layout3'
|
153 |
-
]
|
|
|
154 |
$data[ $_prefix . '_layout' ] = 'grid-layout1';
|
155 |
}
|
156 |
|
@@ -161,9 +168,9 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
161 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ] );
|
162 |
}
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
|
168 |
if ( 'masonry' === $data['grid_layout_style'] ) {
|
169 |
wp_enqueue_script( 'rt-isotope-js' );
|
@@ -174,23 +181,21 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
174 |
wp_enqueue_script( 'rt-pagination' );
|
175 |
}
|
176 |
|
177 |
-
//Query
|
178 |
$query_args = rtTPGElementorQuery::post_query( $data, $_prefix );
|
179 |
$query = new WP_Query( $query_args );
|
180 |
-
$rand =
|
181 |
-
$layoutID =
|
182 |
$posts_per_page = $data['display_per_page'] ? $data['display_per_page'] : $data['post_limit'];
|
183 |
|
184 |
/**
|
185 |
* TODO: Get Post Data for render post
|
186 |
*/
|
187 |
-
|
188 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
189 |
|
190 |
/**
|
191 |
* Post type render
|
192 |
*/
|
193 |
-
|
194 |
$post_types = Fns::get_post_types();
|
195 |
foreach ( $post_types as $post_type => $label ) {
|
196 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
@@ -199,8 +204,8 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
199 |
continue;
|
200 |
}
|
201 |
|
202 |
-
$post_data[ $data['post_type'] . '_taxonomy' ] = isset($data[ $data['post_type'] . '_taxonomy' ]) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
203 |
-
$post_data[ $data['post_type'] . '_tags' ] = isset($data[ $data['post_type'] . '_tags' ]) ? $data[ $data['post_type'] . '_tags' ] : '';
|
204 |
}
|
205 |
|
206 |
$template_path = $this->tpg_template_path( $post_data );
|
@@ -208,42 +213,47 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
208 |
$_layout_style = $data[ $_prefix . '_layout_style' ];
|
209 |
|
210 |
?>
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
|
221 |
|
222 |
<?php
|
223 |
$settings = get_option( rtTPG()->options['settings'] );
|
224 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
225 |
?>
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
<?php
|
232 |
}
|
233 |
|
234 |
$wrapper_class = [];
|
235 |
$wrapper_class[] = str_replace( '-2', '', $_layout );
|
236 |
$wrapper_class[] = 'grid-behaviour';
|
237 |
-
$wrapper_class[] = ( in_array( $_layout, [ 'grid-layout2' ] ) ) ?
|
238 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
239 |
-
|
|
|
|
|
|
|
|
|
240 |
'grid-layout3',
|
241 |
-
'grid-layout4'
|
242 |
-
]
|
|
|
243 |
$wrapper_class[] = 'tpg-masonry';
|
244 |
}
|
245 |
|
246 |
-
//section title settings
|
247 |
$is_carousel = '';
|
248 |
if ( rtTPG()->hasPro() && 'carousel' == $data['filter_btn_style'] && 'button' == $data['filter_type'] ) {
|
249 |
$is_carousel = 'carousel';
|
@@ -251,21 +261,21 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
251 |
|
252 |
echo "<div class='tpg-header-wrapper {$is_carousel}'>";
|
253 |
$this->get_section_title( $data );
|
254 |
-
|
255 |
-
echo
|
256 |
?>
|
257 |
|
258 |
-
|
259 |
<?php
|
260 |
if ( $query->have_posts() ) {
|
261 |
$pCount = 1;
|
|
|
262 |
while ( $query->have_posts() ) {
|
263 |
$query->the_post();
|
264 |
set_query_var( 'tpg_post_count', $pCount );
|
265 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
266 |
$this->tpg_template( $post_data );
|
267 |
$pCount ++;
|
268 |
-
//rtTPGElementorHelper::tpg_template($data, $this->tpg_dir);
|
269 |
}
|
270 |
} else {
|
271 |
if ( $data['no_posts_found_text'] ) {
|
@@ -276,19 +286,19 @@ class TPGGridLayout extends Custom_Widget_Base {
|
|
276 |
}
|
277 |
wp_reset_postdata();
|
278 |
?>
|
279 |
-
|
280 |
|
281 |
-
<?php
|
282 |
|
283 |
-
|
284 |
<?php
|
285 |
if ( 'masonry' === $data[ $_prefix . '_layout_style' ] && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
286 |
?>
|
287 |
-
|
288 |
<?php
|
289 |
}
|
290 |
|
291 |
do_action( 'tpg_elementor_script' );
|
292 |
}
|
293 |
|
294 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Grid Layout Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Grid Layout Class
|
17 |
+
*/
|
18 |
class TPGGridLayout extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
31 |
$this->prefix = 'grid';
|
32 |
$this->tpg_name = esc_html__( 'TPG - Grid Layout', 'the-post-grid' );
|
33 |
$this->tpg_base = 'tpg-grid-layout';
|
34 |
+
$this->tpg_icon = 'eicon-posts-grid tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
}
|
36 |
|
37 |
|
58 |
}
|
59 |
|
60 |
protected function register_controls() {
|
61 |
+
/** Content TAB */
|
62 |
|
63 |
+
// Layout.
|
64 |
rtTPGElementorHelper::grid_layouts( $this );
|
65 |
|
66 |
+
// Query.
|
67 |
rtTPGElementorHelper::query( $this );
|
68 |
|
69 |
+
// Filter Settings.
|
70 |
rtTPGElementorHelper::filter_settings( $this );
|
71 |
|
72 |
+
// Pagination Settings.
|
73 |
rtTPGElementorHelper::pagination_settings( $this );
|
74 |
|
75 |
+
// Links.
|
76 |
rtTPGElementorHelper::links( $this );
|
77 |
|
78 |
/**
|
80 |
* ===========
|
81 |
*/
|
82 |
|
83 |
+
// Field Selection.
|
84 |
rtTPGElementorHelper::field_selection( $this );
|
85 |
|
86 |
+
// Section Title Settings.
|
87 |
rtTPGElementorHelper::section_title_settings( $this );
|
88 |
|
89 |
+
// Title Settings.
|
90 |
rtTPGElementorHelper::post_title_settings( $this );
|
91 |
|
92 |
+
// Thumbnail Settings.
|
93 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
94 |
|
95 |
+
// Excerpt Settings.
|
96 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
97 |
|
98 |
+
// Meta Settings.
|
99 |
rtTPGElementorHelper::post_meta_settings( $this );
|
100 |
|
101 |
+
// Advanced Custom Field ACF Settings.
|
102 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
103 |
|
104 |
+
// Readmore Settings.
|
105 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
106 |
|
107 |
+
/** Style TAB */
|
108 |
|
109 |
+
// Section Title Style.
|
|
|
|
|
110 |
rtTPGElementorHelper::sectionTitle( $this );
|
111 |
|
112 |
+
// Title Style.
|
113 |
rtTPGElementorHelper::titleStyle( $this );
|
114 |
|
115 |
+
// Thumbnail Style.
|
116 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
117 |
|
118 |
+
// Content Style.
|
119 |
rtTPGElementorHelper::contentStyle( $this );
|
120 |
|
121 |
+
// Meta Info Style.
|
122 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
123 |
|
124 |
+
// Box Style.
|
125 |
rtTPGElementorHelper::socialShareStyle( $this );
|
126 |
|
127 |
+
// ACF Style.
|
128 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
129 |
|
130 |
+
// Read More Style.
|
131 |
rtTPGElementorHelper::readmoreStyle( $this );
|
132 |
|
133 |
+
// Link Style.
|
134 |
rtTPGElementorHelper::linkStyle( $this );
|
135 |
|
136 |
+
// Pagination - Load more Style.
|
137 |
rtTPGElementorHelper::paginationStyle( $this );
|
138 |
|
139 |
+
// Box Style.
|
140 |
rtTPGElementorHelper::frontEndFilter( $this );
|
141 |
|
142 |
+
// Box Settings.
|
143 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
144 |
|
145 |
+
// Promotions.
|
146 |
rtTPGElementorHelper::promotions( $this );
|
147 |
}
|
148 |
|
150 |
$data = $this->get_settings();
|
151 |
$_prefix = $this->prefix;
|
152 |
|
153 |
+
if ( ! rtTPG()->hasPro() && ! in_array(
|
154 |
+
$data[ $_prefix . '_layout' ],
|
155 |
+
[
|
156 |
+
'grid-layout1',
|
157 |
'grid-layout4',
|
158 |
+
'grid-layout3',
|
159 |
+
]
|
160 |
+
) ) {
|
161 |
$data[ $_prefix . '_layout' ] = 'grid-layout1';
|
162 |
}
|
163 |
|
168 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ] );
|
169 |
}
|
170 |
|
171 |
+
if ( rtTPG()->hasPro() && 'button' == $data['filter_type'] && 'carousel' == $data['filter_btn_style'] ) {
|
172 |
+
wp_enqueue_script( 'swiper' );
|
173 |
+
}
|
174 |
|
175 |
if ( 'masonry' === $data['grid_layout_style'] ) {
|
176 |
wp_enqueue_script( 'rt-isotope-js' );
|
181 |
wp_enqueue_script( 'rt-pagination' );
|
182 |
}
|
183 |
|
184 |
+
// Query.
|
185 |
$query_args = rtTPGElementorQuery::post_query( $data, $_prefix );
|
186 |
$query = new WP_Query( $query_args );
|
187 |
+
$rand = wp_rand();
|
188 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
189 |
$posts_per_page = $data['display_per_page'] ? $data['display_per_page'] : $data['post_limit'];
|
190 |
|
191 |
/**
|
192 |
* TODO: Get Post Data for render post
|
193 |
*/
|
|
|
194 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
195 |
|
196 |
/**
|
197 |
* Post type render
|
198 |
*/
|
|
|
199 |
$post_types = Fns::get_post_types();
|
200 |
foreach ( $post_types as $post_type => $label ) {
|
201 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
204 |
continue;
|
205 |
}
|
206 |
|
207 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
208 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
209 |
}
|
210 |
|
211 |
$template_path = $this->tpg_template_path( $post_data );
|
213 |
$_layout_style = $data[ $_prefix . '_layout_style' ];
|
214 |
|
215 |
?>
|
216 |
+
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper clearfix <?php echo esc_attr( $_layout . '-main' ); ?>"
|
217 |
+
id="<?php echo esc_attr( $layoutID ); ?>"
|
218 |
+
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
219 |
+
data-grid-style="<?php echo esc_attr( $data[ $_prefix . '_layout_style' ] ); ?>"
|
220 |
+
data-sc-id="elementor"
|
221 |
+
data-el-settings='<?php Fns::is_filter_enable( $data ) ? Fns::print_html( htmlspecialchars( wp_json_encode( $post_data ) ), true ) : ''; ?>'
|
222 |
+
data-el-query='<?php Fns::is_filter_enable( $data ) ? Fns::print_html( htmlspecialchars( wp_json_encode( $query_args ) ), true ) : ''; ?>'
|
223 |
+
data-el-path='<?php echo Fns::is_filter_enable( $data ) ? esc_attr( $template_path ) : ''; ?>'
|
224 |
+
>
|
225 |
|
226 |
|
227 |
<?php
|
228 |
$settings = get_option( rtTPG()->options['settings'] );
|
229 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
230 |
?>
|
231 |
+
<div id="bottom-script-loader" class="bottom-script-loader">
|
232 |
+
<div class="rt-ball-clip-rotate">
|
233 |
+
<div></div>
|
234 |
+
</div>
|
235 |
+
</div>
|
236 |
<?php
|
237 |
}
|
238 |
|
239 |
$wrapper_class = [];
|
240 |
$wrapper_class[] = str_replace( '-2', '', $_layout );
|
241 |
$wrapper_class[] = 'grid-behaviour';
|
242 |
+
$wrapper_class[] = ( in_array( $_layout, [ 'grid-layout2' ] ) ) ? 'tpg-even' : $_layout_style;
|
243 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
244 |
+
|
245 |
+
if ( 'masonry' === $_layout_style && in_array(
|
246 |
+
$_layout,
|
247 |
+
[
|
248 |
+
'grid-layout1',
|
249 |
'grid-layout3',
|
250 |
+
'grid-layout4',
|
251 |
+
]
|
252 |
+
) ) {
|
253 |
$wrapper_class[] = 'tpg-masonry';
|
254 |
}
|
255 |
|
256 |
+
// section title settings.
|
257 |
$is_carousel = '';
|
258 |
if ( rtTPG()->hasPro() && 'carousel' == $data['filter_btn_style'] && 'button' == $data['filter_type'] ) {
|
259 |
$is_carousel = 'carousel';
|
261 |
|
262 |
echo "<div class='tpg-header-wrapper {$is_carousel}'>";
|
263 |
$this->get_section_title( $data );
|
264 |
+
Fns::print_html( $this->get_frontend_filter_markup( $data ) );
|
265 |
+
echo '</div>';
|
266 |
?>
|
267 |
|
268 |
+
<div data-title="Loading ..." class="rt-row rt-content-loader <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
269 |
<?php
|
270 |
if ( $query->have_posts() ) {
|
271 |
$pCount = 1;
|
272 |
+
|
273 |
while ( $query->have_posts() ) {
|
274 |
$query->the_post();
|
275 |
set_query_var( 'tpg_post_count', $pCount );
|
276 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
277 |
$this->tpg_template( $post_data );
|
278 |
$pCount ++;
|
|
|
279 |
}
|
280 |
} else {
|
281 |
if ( $data['no_posts_found_text'] ) {
|
286 |
}
|
287 |
wp_reset_postdata();
|
288 |
?>
|
289 |
+
</div>
|
290 |
|
291 |
+
<?php Fns::print_html( $this->get_pagination_markup( $query, $data ) ); ?>
|
292 |
|
293 |
+
</div>
|
294 |
<?php
|
295 |
if ( 'masonry' === $data[ $_prefix . '_layout_style' ] && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
296 |
?>
|
297 |
+
<script>jQuery( '.rt-row.rt-content-loader.tpg-masonry' ).isotope();</script>
|
298 |
<?php
|
299 |
}
|
300 |
|
301 |
do_action( 'tpg_elementor_script' );
|
302 |
}
|
303 |
|
304 |
+
}
|
app/Widgets/elementor/widgets/list-layout-archive.php
CHANGED
@@ -1,33 +1,37 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGListLayoutArchive extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
-
* @param array
|
20 |
-
* @param null
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
24 |
|
25 |
public function __construct( $data = [], $args = null ) {
|
26 |
parent::__construct( $data, $args );
|
27 |
-
$this->prefix
|
28 |
-
$this->tpg_name
|
29 |
-
$this->tpg_base
|
30 |
-
$this->tpg_icon
|
31 |
$this->tpg_category = $this->tpg_archive_category;
|
32 |
}
|
33 |
|
@@ -42,7 +46,7 @@ class TPGListLayoutArchive extends Custom_Widget_Base {
|
|
42 |
|
43 |
public function get_style_depends() {
|
44 |
$settings = get_option( rtTPG()->options['settings'] );
|
45 |
-
$style
|
46 |
|
47 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
48 |
array_push( $style, 'rt-fontawsome' );
|
@@ -58,19 +62,19 @@ class TPGListLayoutArchive extends Custom_Widget_Base {
|
|
58 |
* ===========
|
59 |
*/
|
60 |
|
61 |
-
//Layout
|
62 |
rtTPGElementorHelper::list_layouts( $this, 'archive' );
|
63 |
|
64 |
-
//Query
|
65 |
rtTPGElementorHelper::query_builder( $this );
|
66 |
|
67 |
-
//Filter Settings
|
68 |
-
//rtTPGElementorHelper::filter_settings( $this );
|
69 |
|
70 |
-
//Pagination Settings
|
71 |
rtTPGElementorHelper::pagination_settings( $this, 'archive' );
|
72 |
|
73 |
-
//Links
|
74 |
rtTPGElementorHelper::links( $this );
|
75 |
|
76 |
/**
|
@@ -78,77 +82,76 @@ class TPGListLayoutArchive extends Custom_Widget_Base {
|
|
78 |
* =============
|
79 |
*/
|
80 |
|
81 |
-
//Field Selection
|
82 |
rtTPGElementorHelper::field_selection( $this );
|
83 |
|
84 |
-
//Section Title Settings
|
85 |
rtTPGElementorHelper::section_title_settings( $this, 'archive' );
|
86 |
|
87 |
-
//Title Settings
|
88 |
rtTPGElementorHelper::post_title_settings( $this );
|
89 |
|
90 |
-
//Thumbnail Settings
|
91 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
92 |
|
93 |
-
//Excerpt Settings
|
94 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
95 |
|
96 |
-
//Meta Settings
|
97 |
rtTPGElementorHelper::post_meta_settings( $this );
|
98 |
|
99 |
-
//Advanced Custom Field ACF Settings
|
100 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
101 |
|
102 |
-
//Readmore Settings
|
103 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
104 |
|
105 |
-
|
106 |
/**
|
107 |
* Style Tabs
|
108 |
* ===========
|
109 |
*/
|
110 |
|
111 |
-
//Section Title Style
|
112 |
rtTPGElementorHelper::sectionTitle( $this, 'archive' );
|
113 |
|
114 |
-
// Title Style
|
115 |
rtTPGElementorHelper::titleStyle( $this );
|
116 |
|
117 |
-
//Thumbnail Style
|
118 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
119 |
|
120 |
-
// Content Style
|
121 |
rtTPGElementorHelper::contentStyle( $this );
|
122 |
|
123 |
-
// Meta Info Style
|
124 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
125 |
|
126 |
-
//Social Share Style
|
127 |
rtTPGElementorHelper::socialShareStyle( $this );
|
128 |
|
129 |
-
//ACF Style
|
130 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
131 |
|
132 |
-
//ReadMore Style
|
133 |
rtTPGElementorHelper::readmoreStyle( $this );
|
134 |
|
135 |
-
//Link Style
|
136 |
rtTPGElementorHelper::linkStyle( $this );
|
137 |
|
138 |
-
//Pagination - LoadMore Style
|
139 |
rtTPGElementorHelper::paginationStyle( $this );
|
140 |
|
141 |
-
//Box Settings
|
142 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
143 |
|
144 |
-
//Promotions
|
145 |
rtTPGElementorHelper::promotions( $this );
|
146 |
}
|
147 |
|
148 |
|
149 |
protected function render() {
|
150 |
-
$data
|
151 |
-
$_prefix
|
152 |
$data['post_type'] = 'post';
|
153 |
|
154 |
if ( ! rtTPG()->hasPro() && ! in_array( $data[ $_prefix . '_layout' ], [ 'list-layout1', 'list-layout2', 'list-layout2-2' ] ) ) {
|
@@ -170,17 +173,16 @@ class TPGListLayoutArchive extends Custom_Widget_Base {
|
|
170 |
wp_enqueue_script( 'rt-pagination' );
|
171 |
}
|
172 |
|
173 |
-
//Query
|
174 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix );
|
175 |
$query = new WP_Query( $query_args );
|
176 |
-
$rand =
|
177 |
-
$layoutID =
|
178 |
$posts_per_page = $data['post_limit'];
|
179 |
|
180 |
/**
|
181 |
* TODO: Get Post Data for render post
|
182 |
*/
|
183 |
-
|
184 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
185 |
|
186 |
/**
|
@@ -189,35 +191,37 @@ class TPGListLayoutArchive extends Custom_Widget_Base {
|
|
189 |
$post_types = Fns::get_post_types();
|
190 |
foreach ( $post_types as $post_type => $label ) {
|
191 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
|
|
192 |
if ( empty( $_taxonomies ) ) {
|
193 |
continue;
|
194 |
}
|
195 |
-
|
196 |
-
$post_data[ $data['post_type'] . '
|
|
|
197 |
}
|
198 |
|
199 |
$template_path = $this->tpg_template_path( $post_data );
|
200 |
$_layout = $data[ $_prefix . '_layout' ];
|
201 |
$_layout_style = $data[ $_prefix . '_layout_style' ];
|
202 |
?>
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
<?php
|
213 |
$settings = get_option( rtTPG()->options['settings'] );
|
214 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
215 |
?>
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
<?php
|
222 |
}
|
223 |
|
@@ -225,22 +229,22 @@ class TPGListLayoutArchive extends Custom_Widget_Base {
|
|
225 |
$wrapper_class[] = str_replace( '-2', null, $_layout );
|
226 |
$wrapper_class[] = 'tpg-even list-behaviour';
|
227 |
$wrapper_class[] = $_prefix . '-layout-wrapper';
|
|
|
228 |
if ( 'masonry' === $_layout_style && ! in_array( $_layout, [ 'list-layout2', 'list-layout3' ] ) ) {
|
229 |
$wrapper_class[] = 'tpg-masonry';
|
230 |
}
|
231 |
|
232 |
-
//section title settings
|
233 |
-
|
234 |
-
|
235 |
echo "<div class='tpg-header-wrapper'>";
|
236 |
$this->get_section_title( $data );
|
237 |
-
echo
|
238 |
?>
|
239 |
|
240 |
-
|
241 |
<?php
|
242 |
if ( $query->have_posts() ) {
|
243 |
$pCount = 1;
|
|
|
244 |
while ( $query->have_posts() ) {
|
245 |
$query->the_post();
|
246 |
set_query_var( 'tpg_post_count', $pCount );
|
@@ -257,17 +261,18 @@ class TPGListLayoutArchive extends Custom_Widget_Base {
|
|
257 |
}
|
258 |
wp_reset_postdata();
|
259 |
?>
|
260 |
-
|
261 |
|
262 |
-
<?php
|
263 |
|
264 |
-
|
265 |
<?php
|
266 |
-
if ( 'masonry' === $data[ $_prefix . '_layout_style' ] && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
267 |
-
|
|
|
268 |
<?php
|
269 |
}
|
270 |
-
do_action('tpg_elementor_script');
|
271 |
}
|
272 |
|
273 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* List Layout Archive Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* List Layout Archive Class
|
17 |
+
*/
|
18 |
class TPGListLayoutArchive extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
+
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
28 |
|
29 |
public function __construct( $data = [], $args = null ) {
|
30 |
parent::__construct( $data, $args );
|
31 |
+
$this->prefix = 'list';
|
32 |
+
$this->tpg_name = esc_html__( 'TPG - List Layout Archive', 'the-post-grid' );
|
33 |
+
$this->tpg_base = 'tpg-list-layout-archive';
|
34 |
+
$this->tpg_icon = 'eicon-post-list tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
$this->tpg_category = $this->tpg_archive_category;
|
36 |
}
|
37 |
|
46 |
|
47 |
public function get_style_depends() {
|
48 |
$settings = get_option( rtTPG()->options['settings'] );
|
49 |
+
$style = [];
|
50 |
|
51 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
52 |
array_push( $style, 'rt-fontawsome' );
|
62 |
* ===========
|
63 |
*/
|
64 |
|
65 |
+
// Layout.
|
66 |
rtTPGElementorHelper::list_layouts( $this, 'archive' );
|
67 |
|
68 |
+
// Query.
|
69 |
rtTPGElementorHelper::query_builder( $this );
|
70 |
|
71 |
+
// Filter Settings.
|
72 |
+
// rtTPGElementorHelper::filter_settings( $this );
|
73 |
|
74 |
+
// Pagination Settings.
|
75 |
rtTPGElementorHelper::pagination_settings( $this, 'archive' );
|
76 |
|
77 |
+
// Links.
|
78 |
rtTPGElementorHelper::links( $this );
|
79 |
|
80 |
/**
|
82 |
* =============
|
83 |
*/
|
84 |
|
85 |
+
// Field Selection.
|
86 |
rtTPGElementorHelper::field_selection( $this );
|
87 |
|
88 |
+
// Section Title Settings.
|
89 |
rtTPGElementorHelper::section_title_settings( $this, 'archive' );
|
90 |
|
91 |
+
// Title Settings.
|
92 |
rtTPGElementorHelper::post_title_settings( $this );
|
93 |
|
94 |
+
// Thumbnail Settings.
|
95 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
96 |
|
97 |
+
// Excerpt Settings.
|
98 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
99 |
|
100 |
+
// Meta Settings.
|
101 |
rtTPGElementorHelper::post_meta_settings( $this );
|
102 |
|
103 |
+
// Advanced Custom Field ACF Settings.
|
104 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
105 |
|
106 |
+
// Readmore Settings.
|
107 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
108 |
|
|
|
109 |
/**
|
110 |
* Style Tabs
|
111 |
* ===========
|
112 |
*/
|
113 |
|
114 |
+
// Section Title Style.
|
115 |
rtTPGElementorHelper::sectionTitle( $this, 'archive' );
|
116 |
|
117 |
+
// Title Style.
|
118 |
rtTPGElementorHelper::titleStyle( $this );
|
119 |
|
120 |
+
// Thumbnail Style.
|
121 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
122 |
|
123 |
+
// Content Style.
|
124 |
rtTPGElementorHelper::contentStyle( $this );
|
125 |
|
126 |
+
// Meta Info Style.
|
127 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
128 |
|
129 |
+
// Social Share Style.
|
130 |
rtTPGElementorHelper::socialShareStyle( $this );
|
131 |
|
132 |
+
// ACF Style.
|
133 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
134 |
|
135 |
+
// ReadMore Style.
|
136 |
rtTPGElementorHelper::readmoreStyle( $this );
|
137 |
|
138 |
+
// Link Style.
|
139 |
rtTPGElementorHelper::linkStyle( $this );
|
140 |
|
141 |
+
// Pagination - LoadMore Style.
|
142 |
rtTPGElementorHelper::paginationStyle( $this );
|
143 |
|
144 |
+
// Box Settings.
|
145 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
146 |
|
147 |
+
// Promotions.
|
148 |
rtTPGElementorHelper::promotions( $this );
|
149 |
}
|
150 |
|
151 |
|
152 |
protected function render() {
|
153 |
+
$data = $this->get_settings();
|
154 |
+
$_prefix = $this->prefix;
|
155 |
$data['post_type'] = 'post';
|
156 |
|
157 |
if ( ! rtTPG()->hasPro() && ! in_array( $data[ $_prefix . '_layout' ], [ 'list-layout1', 'list-layout2', 'list-layout2-2' ] ) ) {
|
173 |
wp_enqueue_script( 'rt-pagination' );
|
174 |
}
|
175 |
|
176 |
+
// Query.
|
177 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix );
|
178 |
$query = new WP_Query( $query_args );
|
179 |
+
$rand = wp_rand();
|
180 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
181 |
$posts_per_page = $data['post_limit'];
|
182 |
|
183 |
/**
|
184 |
* TODO: Get Post Data for render post
|
185 |
*/
|
|
|
186 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
187 |
|
188 |
/**
|
191 |
$post_types = Fns::get_post_types();
|
192 |
foreach ( $post_types as $post_type => $label ) {
|
193 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
194 |
+
|
195 |
if ( empty( $_taxonomies ) ) {
|
196 |
continue;
|
197 |
}
|
198 |
+
|
199 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
200 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
201 |
}
|
202 |
|
203 |
$template_path = $this->tpg_template_path( $post_data );
|
204 |
$_layout = $data[ $_prefix . '_layout' ];
|
205 |
$_layout_style = $data[ $_prefix . '_layout_style' ];
|
206 |
?>
|
207 |
+
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper <?php echo esc_attr( $_layout . '-main' ); ?>"
|
208 |
+
data-sc-id="elementor"
|
209 |
+
id="<?php echo esc_attr( $layoutID ); ?>"
|
210 |
+
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
211 |
+
data-grid-style="<?php echo esc_attr( $data[ $_prefix . '_layout_style' ] ); ?>"
|
212 |
+
data-el-settings='<?php Fns::print_html( htmlspecialchars( wp_json_encode( $post_data ) ), true ); ?>'
|
213 |
+
data-el-query='<?php Fns::print_html( htmlspecialchars( wp_json_encode( $query_args ) ), true ); ?>'
|
214 |
+
data-el-path='<?php echo esc_attr( $template_path ); ?>'
|
215 |
+
>
|
216 |
<?php
|
217 |
$settings = get_option( rtTPG()->options['settings'] );
|
218 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
219 |
?>
|
220 |
+
<div id="bottom-script-loader" class="bottom-script-loader">
|
221 |
+
<div class="rt-ball-clip-rotate">
|
222 |
+
<div></div>
|
223 |
+
</div>
|
224 |
+
</div>
|
225 |
<?php
|
226 |
}
|
227 |
|
229 |
$wrapper_class[] = str_replace( '-2', null, $_layout );
|
230 |
$wrapper_class[] = 'tpg-even list-behaviour';
|
231 |
$wrapper_class[] = $_prefix . '-layout-wrapper';
|
232 |
+
|
233 |
if ( 'masonry' === $_layout_style && ! in_array( $_layout, [ 'list-layout2', 'list-layout3' ] ) ) {
|
234 |
$wrapper_class[] = 'tpg-masonry';
|
235 |
}
|
236 |
|
237 |
+
// section title settings.
|
|
|
|
|
238 |
echo "<div class='tpg-header-wrapper'>";
|
239 |
$this->get_section_title( $data );
|
240 |
+
echo '</div>';
|
241 |
?>
|
242 |
|
243 |
+
<div data-title="Loading ..." class="rt-row rt-content-loader <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
244 |
<?php
|
245 |
if ( $query->have_posts() ) {
|
246 |
$pCount = 1;
|
247 |
+
|
248 |
while ( $query->have_posts() ) {
|
249 |
$query->the_post();
|
250 |
set_query_var( 'tpg_post_count', $pCount );
|
261 |
}
|
262 |
wp_reset_postdata();
|
263 |
?>
|
264 |
+
</div>
|
265 |
|
266 |
+
<?php Fns::print_html( $this->get_pagination_markup( $query, $data ) ); ?>
|
267 |
|
268 |
+
</div>
|
269 |
<?php
|
270 |
+
if ( 'masonry' === $data[ $_prefix . '_layout_style' ] && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
271 |
+
?>
|
272 |
+
<script>jQuery('.rt-row.rt-content-loader.tpg-masonry').isotope();</script>
|
273 |
<?php
|
274 |
}
|
275 |
+
do_action( 'tpg_elementor_script' );
|
276 |
}
|
277 |
|
278 |
+
}
|
app/Widgets/elementor/widgets/list-layout.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGListLayout extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
-
* @param array
|
20 |
-
* @param null
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
@@ -27,7 +31,7 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
27 |
$this->prefix = 'list';
|
28 |
$this->tpg_name = esc_html__( 'TPG - List Layout', 'the-post-grid' );
|
29 |
$this->tpg_base = 'tpg-list-layout';
|
30 |
-
$this->tpg_icon = 'eicon-post-list tpg-grid-icon';
|
31 |
}
|
32 |
|
33 |
public function get_script_depends() {
|
@@ -41,7 +45,7 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
41 |
|
42 |
public function get_style_depends() {
|
43 |
$settings = get_option( rtTPG()->options['settings'] );
|
44 |
-
$style
|
45 |
|
46 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
47 |
array_push( $style, 'rt-fontawsome' );
|
@@ -57,20 +61,19 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
57 |
* ===========
|
58 |
*/
|
59 |
|
60 |
-
//Layout
|
61 |
rtTPGElementorHelper::list_layouts( $this );
|
62 |
|
63 |
-
//Query
|
64 |
rtTPGElementorHelper::query( $this );
|
65 |
|
66 |
-
|
67 |
-
//Filter Settings
|
68 |
rtTPGElementorHelper::filter_settings( $this );
|
69 |
|
70 |
-
//Pagination Settings
|
71 |
rtTPGElementorHelper::pagination_settings( $this );
|
72 |
|
73 |
-
//Links
|
74 |
rtTPGElementorHelper::links( $this );
|
75 |
|
76 |
/**
|
@@ -78,73 +81,72 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
78 |
* =============
|
79 |
*/
|
80 |
|
81 |
-
//Field Selection
|
82 |
rtTPGElementorHelper::field_selection( $this );
|
83 |
|
84 |
-
//Section Title Settings
|
85 |
rtTPGElementorHelper::section_title_settings( $this );
|
86 |
|
87 |
-
//Title Settings
|
88 |
rtTPGElementorHelper::post_title_settings( $this );
|
89 |
|
90 |
-
//Thumbnail Settings
|
91 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
92 |
|
93 |
-
//Excerpt Settings
|
94 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
95 |
|
96 |
-
//Meta Settings
|
97 |
rtTPGElementorHelper::post_meta_settings( $this );
|
98 |
|
99 |
-
//Advanced Custom Field ACF Settings
|
100 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
101 |
|
102 |
-
//Readmore Settings
|
103 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
104 |
|
105 |
-
|
106 |
/**
|
107 |
* Style Tabs
|
108 |
* ===========
|
109 |
*/
|
110 |
|
111 |
-
//Section Title Style
|
112 |
rtTPGElementorHelper::sectionTitle( $this );
|
113 |
|
114 |
-
// Title Style
|
115 |
rtTPGElementorHelper::titleStyle( $this );
|
116 |
|
117 |
-
//Thumbnail Style
|
118 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
119 |
|
120 |
-
// Content Style
|
121 |
rtTPGElementorHelper::contentStyle( $this );
|
122 |
|
123 |
-
// Meta Info Style
|
124 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
125 |
|
126 |
-
//Box Style
|
127 |
rtTPGElementorHelper::socialShareStyle( $this );
|
128 |
|
129 |
-
//ACF Style
|
130 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
131 |
|
132 |
-
//Read More Style
|
133 |
rtTPGElementorHelper::readmoreStyle( $this );
|
134 |
|
135 |
-
//Link Style
|
136 |
rtTPGElementorHelper::linkStyle( $this );
|
137 |
|
138 |
-
//Box Style
|
139 |
rtTPGElementorHelper::frontEndFilter( $this );
|
140 |
|
141 |
-
//Pagination - Loadmore Style
|
142 |
rtTPGElementorHelper::paginationStyle( $this );
|
143 |
|
144 |
-
//Box Settings
|
145 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
146 |
|
147 |
-
//Promotions
|
148 |
rtTPGElementorHelper::promotions( $this );
|
149 |
}
|
150 |
|
@@ -152,9 +154,11 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
152 |
protected function render() {
|
153 |
$data = $this->get_settings();
|
154 |
$_prefix = $this->prefix;
|
|
|
155 |
if ( ! rtTPG()->hasPro() && ! in_array( $data[ $_prefix . '_layout' ], [ 'list-layout1', 'list-layout2', 'list-layout2-2' ] ) ) {
|
156 |
$data[ $_prefix . '_layout' ] = 'list-layout1';
|
157 |
}
|
|
|
158 |
if ( rtTPG()->hasPro() && ( 'popup' == $data['post_link_type'] || 'multi_popup' == $data['post_link_type'] ) ) {
|
159 |
wp_enqueue_style( 'rt-magnific-popup' );
|
160 |
wp_enqueue_script( 'rt-scrollbar' );
|
@@ -162,8 +166,8 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
162 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ] );
|
163 |
}
|
164 |
|
165 |
-
if(rtTPG()->hasPro() && 'button' == $data['filter_type'] && 'carousel' == $data['filter_btn_style']){
|
166 |
-
wp_enqueue_script('swiper');
|
167 |
}
|
168 |
|
169 |
if ( 'masonry' === $data['list_layout_style'] ) {
|
@@ -175,17 +179,16 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
175 |
wp_enqueue_script( 'rt-pagination' );
|
176 |
}
|
177 |
|
178 |
-
$query_args
|
179 |
-
$query
|
180 |
|
181 |
-
$rand =
|
182 |
-
$layoutID =
|
183 |
$posts_per_page = $data['display_per_page'] ? $data['display_per_page'] : $data['post_limit'];
|
184 |
|
185 |
/**
|
186 |
* TODO: Get Post Data for render post
|
187 |
*/
|
188 |
-
|
189 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
190 |
|
191 |
/**
|
@@ -194,36 +197,38 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
194 |
$post_types = Fns::get_post_types();
|
195 |
foreach ( $post_types as $post_type => $label ) {
|
196 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
|
|
197 |
if ( empty( $_taxonomies ) ) {
|
198 |
continue;
|
199 |
}
|
200 |
-
|
201 |
-
$post_data[ $data['post_type'] . '
|
|
|
202 |
}
|
203 |
|
204 |
$template_path = $this->tpg_template_path( $post_data );
|
205 |
$_layout = $data[ $_prefix . '_layout' ];
|
206 |
$_layout_style = $data[ $_prefix . '_layout_style' ];
|
207 |
?>
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
<?php
|
218 |
|
219 |
$settings = get_option( rtTPG()->options['settings'] );
|
220 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
221 |
?>
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
<?php
|
228 |
}
|
229 |
|
@@ -231,28 +236,31 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
231 |
$wrapper_class[] = str_replace( '-2', null, $_layout );
|
232 |
$wrapper_class[] = 'tpg-even list-behaviour';
|
233 |
$wrapper_class[] = $_prefix . '-layout-wrapper';
|
|
|
234 |
if ( 'masonry' === $_layout_style && ! in_array( $_layout, [ 'list-layout2', 'list-layout3' ] ) ) {
|
235 |
$wrapper_class[] = 'tpg-masonry';
|
236 |
}
|
237 |
|
238 |
-
//section title settings
|
239 |
$is_carousel = '';
|
|
|
240 |
if ( rtTPG()->hasPro() && 'carousel' == $data['filter_btn_style'] && 'button' == $data['filter_type'] ) {
|
241 |
$is_carousel = 'carousel';
|
242 |
}
|
243 |
|
244 |
echo "<div class='tpg-header-wrapper {$is_carousel}'>";
|
245 |
$this->get_section_title( $data );
|
246 |
-
|
247 |
-
echo
|
248 |
?>
|
249 |
|
250 |
-
|
251 |
<?php
|
252 |
if ( $query->have_posts() ) {
|
253 |
$pCount = 1;
|
254 |
while ( $query->have_posts() ) {
|
255 |
$query->the_post();
|
|
|
256 |
set_query_var( 'tpg_post_count', $pCount );
|
257 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
258 |
$this->tpg_template( $post_data );
|
@@ -267,18 +275,19 @@ class TPGListLayout extends Custom_Widget_Base {
|
|
267 |
}
|
268 |
wp_reset_postdata();
|
269 |
?>
|
270 |
-
|
271 |
|
272 |
-
<?php
|
273 |
|
274 |
-
|
275 |
<?php
|
276 |
-
if ( 'masonry' === $data[ $_prefix . '_layout_style' ] && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
277 |
-
|
|
|
278 |
<?php
|
279 |
}
|
280 |
|
281 |
-
do_action('tpg_elementor_script');
|
282 |
}
|
283 |
|
284 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* List Layout Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* List Layout Class
|
17 |
+
*/
|
18 |
class TPGListLayout extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
+
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
31 |
$this->prefix = 'list';
|
32 |
$this->tpg_name = esc_html__( 'TPG - List Layout', 'the-post-grid' );
|
33 |
$this->tpg_base = 'tpg-list-layout';
|
34 |
+
$this->tpg_icon = 'eicon-post-list tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
}
|
36 |
|
37 |
public function get_script_depends() {
|
45 |
|
46 |
public function get_style_depends() {
|
47 |
$settings = get_option( rtTPG()->options['settings'] );
|
48 |
+
$style = [];
|
49 |
|
50 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
51 |
array_push( $style, 'rt-fontawsome' );
|
61 |
* ===========
|
62 |
*/
|
63 |
|
64 |
+
// Layout.
|
65 |
rtTPGElementorHelper::list_layouts( $this );
|
66 |
|
67 |
+
// Query.
|
68 |
rtTPGElementorHelper::query( $this );
|
69 |
|
70 |
+
// Filter Settings.
|
|
|
71 |
rtTPGElementorHelper::filter_settings( $this );
|
72 |
|
73 |
+
// Pagination Settings.
|
74 |
rtTPGElementorHelper::pagination_settings( $this );
|
75 |
|
76 |
+
// Links.
|
77 |
rtTPGElementorHelper::links( $this );
|
78 |
|
79 |
/**
|
81 |
* =============
|
82 |
*/
|
83 |
|
84 |
+
// Field Selection.
|
85 |
rtTPGElementorHelper::field_selection( $this );
|
86 |
|
87 |
+
// Section Title Settings.
|
88 |
rtTPGElementorHelper::section_title_settings( $this );
|
89 |
|
90 |
+
// Title Settings.
|
91 |
rtTPGElementorHelper::post_title_settings( $this );
|
92 |
|
93 |
+
// Thumbnail Settings.
|
94 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
95 |
|
96 |
+
// Excerpt Settings.
|
97 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
98 |
|
99 |
+
// Meta Settings.
|
100 |
rtTPGElementorHelper::post_meta_settings( $this );
|
101 |
|
102 |
+
// Advanced Custom Field ACF Settings.
|
103 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
104 |
|
105 |
+
// Readmore Settings.
|
106 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
107 |
|
|
|
108 |
/**
|
109 |
* Style Tabs
|
110 |
* ===========
|
111 |
*/
|
112 |
|
113 |
+
// Section Title Style.
|
114 |
rtTPGElementorHelper::sectionTitle( $this );
|
115 |
|
116 |
+
// Title Style.
|
117 |
rtTPGElementorHelper::titleStyle( $this );
|
118 |
|
119 |
+
// Thumbnail Style.
|
120 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
121 |
|
122 |
+
// Content Style.
|
123 |
rtTPGElementorHelper::contentStyle( $this );
|
124 |
|
125 |
+
// Meta Info Style.
|
126 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
127 |
|
128 |
+
// Box Style.
|
129 |
rtTPGElementorHelper::socialShareStyle( $this );
|
130 |
|
131 |
+
// ACF Style.
|
132 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
133 |
|
134 |
+
// Read More Style.
|
135 |
rtTPGElementorHelper::readmoreStyle( $this );
|
136 |
|
137 |
+
// Link Style.
|
138 |
rtTPGElementorHelper::linkStyle( $this );
|
139 |
|
140 |
+
// Box Style.
|
141 |
rtTPGElementorHelper::frontEndFilter( $this );
|
142 |
|
143 |
+
// Pagination - Loadmore Style.
|
144 |
rtTPGElementorHelper::paginationStyle( $this );
|
145 |
|
146 |
+
// Box Settings.
|
147 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
148 |
|
149 |
+
// Promotions.
|
150 |
rtTPGElementorHelper::promotions( $this );
|
151 |
}
|
152 |
|
154 |
protected function render() {
|
155 |
$data = $this->get_settings();
|
156 |
$_prefix = $this->prefix;
|
157 |
+
|
158 |
if ( ! rtTPG()->hasPro() && ! in_array( $data[ $_prefix . '_layout' ], [ 'list-layout1', 'list-layout2', 'list-layout2-2' ] ) ) {
|
159 |
$data[ $_prefix . '_layout' ] = 'list-layout1';
|
160 |
}
|
161 |
+
|
162 |
if ( rtTPG()->hasPro() && ( 'popup' == $data['post_link_type'] || 'multi_popup' == $data['post_link_type'] ) ) {
|
163 |
wp_enqueue_style( 'rt-magnific-popup' );
|
164 |
wp_enqueue_script( 'rt-scrollbar' );
|
166 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ] );
|
167 |
}
|
168 |
|
169 |
+
if ( rtTPG()->hasPro() && 'button' == $data['filter_type'] && 'carousel' == $data['filter_btn_style'] ) {
|
170 |
+
wp_enqueue_script( 'swiper' );
|
171 |
}
|
172 |
|
173 |
if ( 'masonry' === $data['list_layout_style'] ) {
|
179 |
wp_enqueue_script( 'rt-pagination' );
|
180 |
}
|
181 |
|
182 |
+
$query_args = rtTPGElementorQuery::post_query( $data, $_prefix );
|
183 |
+
$query = new WP_Query( $query_args );
|
184 |
|
185 |
+
$rand = wp_rand();
|
186 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
187 |
$posts_per_page = $data['display_per_page'] ? $data['display_per_page'] : $data['post_limit'];
|
188 |
|
189 |
/**
|
190 |
* TODO: Get Post Data for render post
|
191 |
*/
|
|
|
192 |
$post_data = $this->get_render_data_set( $data, $query->max_num_pages, $posts_per_page );
|
193 |
|
194 |
/**
|
197 |
$post_types = Fns::get_post_types();
|
198 |
foreach ( $post_types as $post_type => $label ) {
|
199 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
200 |
+
|
201 |
if ( empty( $_taxonomies ) ) {
|
202 |
continue;
|
203 |
}
|
204 |
+
|
205 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
206 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
207 |
}
|
208 |
|
209 |
$template_path = $this->tpg_template_path( $post_data );
|
210 |
$_layout = $data[ $_prefix . '_layout' ];
|
211 |
$_layout_style = $data[ $_prefix . '_layout_style' ];
|
212 |
?>
|
213 |
+
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper <?php echo esc_attr( $_layout . '-main' ); ?>"
|
214 |
+
data-sc-id="elementor"
|
215 |
+
id="<?php echo esc_attr( $layoutID ); ?>"
|
216 |
+
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
217 |
+
data-grid-style="<?php echo esc_attr( $data[ $_prefix . '_layout_style' ] ); ?>"
|
218 |
+
data-el-settings='<?php Fns::is_filter_enable( $data ) ? Fns::print_html( htmlspecialchars( wp_json_encode( $post_data ) ), true ) : ''; ?>'
|
219 |
+
data-el-query='<?php Fns::is_filter_enable( $data ) ? Fns::print_html( htmlspecialchars( wp_json_encode( $query_args ) ), true ) : ''; ?>'
|
220 |
+
data-el-path='<?php echo Fns::is_filter_enable( $data ) ? esc_attr( $template_path ) : ''; ?>'
|
221 |
+
>
|
222 |
<?php
|
223 |
|
224 |
$settings = get_option( rtTPG()->options['settings'] );
|
225 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
226 |
?>
|
227 |
+
<div id="bottom-script-loader" class="bottom-script-loader">
|
228 |
+
<div class="rt-ball-clip-rotate">
|
229 |
+
<div></div>
|
230 |
+
</div>
|
231 |
+
</div>
|
232 |
<?php
|
233 |
}
|
234 |
|
236 |
$wrapper_class[] = str_replace( '-2', null, $_layout );
|
237 |
$wrapper_class[] = 'tpg-even list-behaviour';
|
238 |
$wrapper_class[] = $_prefix . '-layout-wrapper';
|
239 |
+
|
240 |
if ( 'masonry' === $_layout_style && ! in_array( $_layout, [ 'list-layout2', 'list-layout3' ] ) ) {
|
241 |
$wrapper_class[] = 'tpg-masonry';
|
242 |
}
|
243 |
|
244 |
+
// section title settings.
|
245 |
$is_carousel = '';
|
246 |
+
|
247 |
if ( rtTPG()->hasPro() && 'carousel' == $data['filter_btn_style'] && 'button' == $data['filter_type'] ) {
|
248 |
$is_carousel = 'carousel';
|
249 |
}
|
250 |
|
251 |
echo "<div class='tpg-header-wrapper {$is_carousel}'>";
|
252 |
$this->get_section_title( $data );
|
253 |
+
Fns::print_html( $this->get_frontend_filter_markup( $data ) );
|
254 |
+
echo '</div>';
|
255 |
?>
|
256 |
|
257 |
+
<div data-title="Loading ..." class="rt-row rt-content-loader <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
258 |
<?php
|
259 |
if ( $query->have_posts() ) {
|
260 |
$pCount = 1;
|
261 |
while ( $query->have_posts() ) {
|
262 |
$query->the_post();
|
263 |
+
|
264 |
set_query_var( 'tpg_post_count', $pCount );
|
265 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
266 |
$this->tpg_template( $post_data );
|
275 |
}
|
276 |
wp_reset_postdata();
|
277 |
?>
|
278 |
+
</div>
|
279 |
|
280 |
+
<?php Fns::print_html( $this->get_pagination_markup( $query, $data ) ); ?>
|
281 |
|
282 |
+
</div>
|
283 |
<?php
|
284 |
+
if ( 'masonry' === $data[ $_prefix . '_layout_style' ] && \Elementor\Plugin::$instance->editor->is_edit_mode() ) {
|
285 |
+
?>
|
286 |
+
<script>jQuery('.rt-row.rt-content-loader.tpg-masonry').isotope();</script>
|
287 |
<?php
|
288 |
}
|
289 |
|
290 |
+
do_action( 'tpg_elementor_script' );
|
291 |
}
|
292 |
|
293 |
+
}
|
app/Widgets/elementor/widgets/related-post.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGRelatedPost extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
-
* @param
|
20 |
-
* @param
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
@@ -27,13 +31,14 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
27 |
$this->prefix = 'slider';
|
28 |
$this->tpg_name = esc_html__( 'TPG - Related Post', 'the-post-grid' );
|
29 |
$this->tpg_base = 'tpg-related-post';
|
30 |
-
$this->tpg_icon = 'eicon-posts-grid tpg-grid-icon';
|
31 |
$this->tpg_category = $this->tpg_archive_category;
|
32 |
}
|
33 |
|
34 |
public function get_script_depends() {
|
35 |
$scripts = [];
|
36 |
array_push( $scripts, 'imagesloaded' );
|
|
|
37 |
array_push( $scripts, 'rt-tpg' );
|
38 |
array_push( $scripts, 'rt-tpg-el-pro' );
|
39 |
|
@@ -42,7 +47,7 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
42 |
|
43 |
public function get_style_depends() {
|
44 |
$settings = get_option( rtTPG()->options['settings'] );
|
45 |
-
$style
|
46 |
|
47 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
48 |
array_push( $style, 'rt-fontawsome' );
|
@@ -58,13 +63,13 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
58 |
* =============
|
59 |
*/
|
60 |
|
61 |
-
//Layout
|
62 |
rtTPGElementorHelper::grid_layouts( $this, 'single' );
|
63 |
|
64 |
-
//Query
|
65 |
rtTPGElementorHelper::query_builder( $this, 'single' );
|
66 |
|
67 |
-
//Links
|
68 |
rtTPGElementorHelper::links( $this );
|
69 |
|
70 |
/**
|
@@ -72,74 +77,73 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
72 |
* =============
|
73 |
*/
|
74 |
|
75 |
-
//Field Selection
|
76 |
rtTPGElementorHelper::field_selection( $this );
|
77 |
|
78 |
-
//Section Title Settings
|
79 |
rtTPGElementorHelper::section_title_settings( $this, 'single' );
|
80 |
|
81 |
-
//Title Settings
|
82 |
rtTPGElementorHelper::post_title_settings( $this );
|
83 |
|
84 |
-
//Thumbnail Settings
|
85 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
86 |
|
87 |
-
//Excerpt Settings
|
88 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
89 |
|
90 |
-
//Meta Settings
|
91 |
rtTPGElementorHelper::post_meta_settings( $this );
|
92 |
|
93 |
-
//Advanced Custom Field ACF Settings
|
94 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
95 |
|
96 |
-
//Readmore Settings
|
97 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
98 |
|
99 |
-
//Slider Settings
|
100 |
rtTPGElementorHelper::slider_settings( $this, 'single' );
|
101 |
|
102 |
-
|
103 |
/**
|
104 |
* Style Tabs
|
105 |
* =============
|
106 |
*/
|
107 |
|
108 |
-
//Section Title
|
109 |
rtTPGElementorHelper::sectionTitle( $this );
|
110 |
|
111 |
-
// Title Style
|
112 |
rtTPGElementorHelper::titleStyle( $this );
|
113 |
|
114 |
-
//Thumbnail Style
|
115 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
116 |
|
117 |
-
// Content Style
|
118 |
rtTPGElementorHelper::contentStyle( $this );
|
119 |
|
120 |
-
// Meta Info Style
|
121 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
122 |
|
123 |
-
//ACF Style
|
124 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
125 |
|
126 |
-
//Social Style
|
127 |
rtTPGElementorHelper::socialShareStyle( $this );
|
128 |
|
129 |
-
//Read more style
|
130 |
rtTPGElementorHelper::readmoreStyle( $this );
|
131 |
|
132 |
-
//Slider Style
|
133 |
rtTPGElementorHelper::slider_style( $this, 'single' );
|
134 |
rtTPGElementorHelper::slider_thumb_style( $this );
|
135 |
|
136 |
-
//Link Style
|
137 |
rtTPGElementorHelper::linkStyle( $this );
|
138 |
|
139 |
-
//Box Settings
|
140 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
141 |
|
142 |
-
//Promotions
|
143 |
rtTPGElementorHelper::promotions( $this );
|
144 |
}
|
145 |
|
@@ -149,8 +153,31 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
149 |
$data['last_post_id'] = $this->last_post_id;
|
150 |
$_prefix = $this->prefix;
|
151 |
$enable_related_slider = $data['enable_related_slider'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
152 |
if ( ! rtTPG()->hasPro() ) { ?>
|
153 |
-
<h3 style="text-align: center"><?php echo esc_html__( 'Please upgrade to pro for slider layout!', 'the-post-grid' ) ?></h3>
|
154 |
<?php
|
155 |
return;
|
156 |
}
|
@@ -162,15 +189,15 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
162 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ], 1 );
|
163 |
}
|
164 |
|
165 |
-
if ( 'show' == $data['show_pagination'] && 'pagination_ajax' == $data['pagination_type'] ) {
|
166 |
-
|
167 |
-
}
|
168 |
|
169 |
-
//Query
|
170 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix, 'single' );
|
171 |
$query = new WP_Query( $query_args );
|
172 |
-
$rand =
|
173 |
-
$layoutID =
|
174 |
$posts_per_page = $data['post_limit'];
|
175 |
|
176 |
/**
|
@@ -184,34 +211,34 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
184 |
/**
|
185 |
* Post type render
|
186 |
*/
|
|
|
|
|
|
|
187 |
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
if ( empty( $_taxonomies ) ) {
|
192 |
-
continue;
|
193 |
-
}
|
194 |
-
$post_data[ $data['post_type'] . '_taxonomy' ] = isset($data[ $data['post_type'] . '_taxonomy' ]) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
195 |
-
$post_data[ $data['post_type'] . '_tags' ] = isset($data[ $data['post_type'] . '_tags' ]) ? $data[ $data['post_type'] . '_tags' ] : '';
|
196 |
-
}
|
197 |
|
198 |
-
|
|
|
|
|
199 |
|
|
|
200 |
|
201 |
$default_gird_column_desktop = $enable_related_slider ? '3' : '4';
|
202 |
$default_gird_column_tab = $enable_related_slider ? '2' : '6';
|
203 |
$default_gird_column_mobile = $enable_related_slider ? '1' : '12';
|
204 |
|
205 |
-
|
206 |
$gird_column_desktop = '0' !== $post_data['gird_column'] ? $post_data['gird_column'] : $default_gird_column_desktop;
|
207 |
$gird_column_tab = '0' !== $post_data['gird_column_tablet'] ? $post_data['gird_column_tablet'] : $default_gird_column_tab;
|
208 |
$gird_column_mobile = '0' !== $post_data['gird_column_mobile'] ? $post_data['gird_column_mobile'] : $default_gird_column_mobile;
|
209 |
|
210 |
$item_column = "rt-col-md-{$gird_column_desktop} rt-col-sm-{$gird_column_tab} rt-col-xs-{$gird_column_mobile}";
|
211 |
|
212 |
-
$slider_main_class = $enable_related_slider ?
|
213 |
|
214 |
-
if ( $query->have_posts() ) :
|
|
|
215 |
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper <?php echo esc_attr( $_layout . '-main' . ' ' . $slider_main_class ); ?>"
|
216 |
id="<?php echo esc_attr( $layoutID ); ?>"
|
217 |
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
@@ -223,7 +250,6 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
223 |
data-el-query=''
|
224 |
>
|
225 |
<?php
|
226 |
-
|
227 |
$settings = get_option( rtTPG()->options['settings'] );
|
228 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
229 |
?>
|
@@ -266,19 +292,19 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
266 |
|
267 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
268 |
|
269 |
-
//section title settings
|
270 |
$this->get_section_title( $data );
|
271 |
|
272 |
$slider_data = [
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
];
|
283 |
|
284 |
if ( $data['enable_2_rows'] == 'yes' ) {
|
@@ -286,35 +312,36 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
286 |
}
|
287 |
|
288 |
$col_start_class = $col_end_class = null;
|
289 |
-
|
290 |
?>
|
291 |
|
292 |
<?php if ( $enable_related_slider ) { ?>
|
293 |
-
<div class="slider-main-wrapper <?php echo esc_attr( $_layout ) ?>">
|
294 |
|
295 |
<div class="rt-swiper-holder swiper"
|
296 |
-
data-rtowl-options='<?php echo wp_json_encode( $slider_data ) ?>'
|
297 |
dir="<?php echo esc_attr( $data['slider_direction'] ); ?>">
|
298 |
-
<div class="swiper-wrapper <?php echo esc_attr( implode( ' ', $wrapper_class ) ) ?>">
|
299 |
<?php } else { ?>
|
300 |
-
<div class="rt-row rt-content-loader <?php echo esc_attr( implode( ' ', $wrapper_class ) ) ?>">
|
301 |
<?php
|
302 |
-
}
|
|
|
303 |
|
304 |
<?php
|
305 |
$pCount = 1;
|
|
|
306 |
while ( $query->have_posts() ) {
|
307 |
$query->the_post();
|
308 |
set_query_var( 'tpg_post_count', $pCount );
|
309 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
310 |
?>
|
311 |
-
<?php if (
|
312 |
-
<div class='<?php echo esc_attr( $item_column ) ?>'>
|
313 |
<?php } ?>
|
314 |
<?php
|
315 |
$this->tpg_template( $post_data );
|
316 |
?>
|
317 |
-
<?php if (
|
318 |
</div>
|
319 |
<?php } ?>
|
320 |
<?php
|
@@ -322,6 +349,7 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
322 |
if ( $_layout == 'slider-layout10' && $pCount == 5 ) {
|
323 |
$pCount = 0;
|
324 |
}
|
|
|
325 |
$pCount ++;
|
326 |
}
|
327 |
wp_reset_postdata();
|
@@ -335,11 +363,11 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
335 |
|
336 |
|
337 |
<!--swiper-pagination-horizontal-->
|
338 |
-
<?php if ( $data['dots'] ==
|
339 |
<div class="swiper-pagination"></div>
|
340 |
<?php endif; ?>
|
341 |
|
342 |
-
<?php if ( $data['arrows'] ==
|
343 |
<div class="swiper-navigation">
|
344 |
<div class="slider-btn swiper-button-prev"></div>
|
345 |
<div class="slider-btn swiper-button-next"></div>
|
@@ -349,14 +377,11 @@ class TPGRelatedPost extends Custom_Widget_Base {
|
|
349 |
|
350 |
<?php } ?>
|
351 |
</div>
|
352 |
-
|
353 |
-
|
354 |
</div>
|
355 |
<?php
|
356 |
endif;
|
357 |
|
358 |
-
do_action('tpg_elementor_script');
|
359 |
-
|
360 |
}
|
361 |
|
362 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Related Post Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Related Post Class
|
17 |
+
*/
|
18 |
class TPGRelatedPost extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
+
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
31 |
$this->prefix = 'slider';
|
32 |
$this->tpg_name = esc_html__( 'TPG - Related Post', 'the-post-grid' );
|
33 |
$this->tpg_base = 'tpg-related-post';
|
34 |
+
$this->tpg_icon = 'eicon-posts-grid tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
$this->tpg_category = $this->tpg_archive_category;
|
36 |
}
|
37 |
|
38 |
public function get_script_depends() {
|
39 |
$scripts = [];
|
40 |
array_push( $scripts, 'imagesloaded' );
|
41 |
+
array_push( $scripts, 'swiper' );
|
42 |
array_push( $scripts, 'rt-tpg' );
|
43 |
array_push( $scripts, 'rt-tpg-el-pro' );
|
44 |
|
47 |
|
48 |
public function get_style_depends() {
|
49 |
$settings = get_option( rtTPG()->options['settings'] );
|
50 |
+
$style = [];
|
51 |
|
52 |
if ( isset( $settings['tpg_load_script'] ) ) {
|
53 |
array_push( $style, 'rt-fontawsome' );
|
63 |
* =============
|
64 |
*/
|
65 |
|
66 |
+
// Layout.
|
67 |
rtTPGElementorHelper::grid_layouts( $this, 'single' );
|
68 |
|
69 |
+
// Query.
|
70 |
rtTPGElementorHelper::query_builder( $this, 'single' );
|
71 |
|
72 |
+
// Links.
|
73 |
rtTPGElementorHelper::links( $this );
|
74 |
|
75 |
/**
|
77 |
* =============
|
78 |
*/
|
79 |
|
80 |
+
// Field Selection.
|
81 |
rtTPGElementorHelper::field_selection( $this );
|
82 |
|
83 |
+
// Section Title Settings.
|
84 |
rtTPGElementorHelper::section_title_settings( $this, 'single' );
|
85 |
|
86 |
+
// Title Settings.
|
87 |
rtTPGElementorHelper::post_title_settings( $this );
|
88 |
|
89 |
+
// Thumbnail Settings.
|
90 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
91 |
|
92 |
+
// Excerpt Settings.
|
93 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
94 |
|
95 |
+
// Meta Settings.
|
96 |
rtTPGElementorHelper::post_meta_settings( $this );
|
97 |
|
98 |
+
// Advanced Custom Field ACF Settings.
|
99 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
100 |
|
101 |
+
// Readmore Settings.
|
102 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
103 |
|
104 |
+
// Slider Settings.
|
105 |
rtTPGElementorHelper::slider_settings( $this, 'single' );
|
106 |
|
|
|
107 |
/**
|
108 |
* Style Tabs
|
109 |
* =============
|
110 |
*/
|
111 |
|
112 |
+
// Section Title.
|
113 |
rtTPGElementorHelper::sectionTitle( $this );
|
114 |
|
115 |
+
// Title Style.
|
116 |
rtTPGElementorHelper::titleStyle( $this );
|
117 |
|
118 |
+
// Thumbnail Style.
|
119 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
120 |
|
121 |
+
// Content Style.
|
122 |
rtTPGElementorHelper::contentStyle( $this );
|
123 |
|
124 |
+
// Meta Info Style.
|
125 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
126 |
|
127 |
+
// ACF Style.
|
128 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
129 |
|
130 |
+
// Social Style.
|
131 |
rtTPGElementorHelper::socialShareStyle( $this );
|
132 |
|
133 |
+
// Read more style.
|
134 |
rtTPGElementorHelper::readmoreStyle( $this );
|
135 |
|
136 |
+
// Slider Style.
|
137 |
rtTPGElementorHelper::slider_style( $this, 'single' );
|
138 |
rtTPGElementorHelper::slider_thumb_style( $this );
|
139 |
|
140 |
+
// Link Style.
|
141 |
rtTPGElementorHelper::linkStyle( $this );
|
142 |
|
143 |
+
// Box Settings.
|
144 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
145 |
|
146 |
+
// Promotions.
|
147 |
rtTPGElementorHelper::promotions( $this );
|
148 |
}
|
149 |
|
153 |
$data['last_post_id'] = $this->last_post_id;
|
154 |
$_prefix = $this->prefix;
|
155 |
$enable_related_slider = $data['enable_related_slider'];
|
156 |
+
|
157 |
+
if ( $data['enable_related_slider'] !== 'yes' ) {
|
158 |
+
$column_arr = [ '_column', '_column_tablet', '_column_mobile' ];
|
159 |
+
foreach ( $column_arr as $device ) {
|
160 |
+
if ( ! ( isset( $data[ 'slider' . $device ] ) && $data[ 'slider' . $device ] ) ) {
|
161 |
+
continue;
|
162 |
+
}
|
163 |
+
if ( $data[ 'slider' . $device ] == '1' ) {
|
164 |
+
$data[ 'slider' . $device ] = '12';
|
165 |
+
} elseif ( $data[ 'slider' . $device ] == '2' ) {
|
166 |
+
$data[ 'slider' . $device ] = '6';
|
167 |
+
} elseif ( $data[ 'slider' . $device ] == '3' ) {
|
168 |
+
$data[ 'slider' . $device ] = '4';
|
169 |
+
} elseif ( $data[ 'slider' . $device ] == '4' ) {
|
170 |
+
$data[ 'slider' . $device ] = '3';
|
171 |
+
} elseif ( $data[ 'slider' . $device ] == '5' ) {
|
172 |
+
$data[ 'slider' . $device ] = '24';
|
173 |
+
} elseif ( $data[ 'slider' . $device ] == '6' ) {
|
174 |
+
$data[ 'slider' . $device ] = '2';
|
175 |
+
}
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
if ( ! rtTPG()->hasPro() ) { ?>
|
180 |
+
<h3 style="text-align: center"><?php echo esc_html__( 'Please upgrade to pro for slider layout!', 'the-post-grid' ); ?></h3>
|
181 |
<?php
|
182 |
return;
|
183 |
}
|
189 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ], 1 );
|
190 |
}
|
191 |
|
192 |
+
// if ( 'show' == $data['show_pagination'] && 'pagination_ajax' == $data['pagination_type'] ) {
|
193 |
+
// wp_enqueue_script( 'rt-pagination' );
|
194 |
+
// }
|
195 |
|
196 |
+
// Query.
|
197 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix, 'single' );
|
198 |
$query = new WP_Query( $query_args );
|
199 |
+
$rand = wp_rand();
|
200 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
201 |
$posts_per_page = $data['post_limit'];
|
202 |
|
203 |
/**
|
211 |
/**
|
212 |
* Post type render
|
213 |
*/
|
214 |
+
$post_types = Fns::get_post_types();
|
215 |
+
foreach ( $post_types as $post_type => $label ) {
|
216 |
+
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
217 |
|
218 |
+
if ( empty( $_taxonomies ) ) {
|
219 |
+
continue;
|
220 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
223 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
224 |
+
}
|
225 |
|
226 |
+
$post_data['enable_2_rows'] = false;
|
227 |
|
228 |
$default_gird_column_desktop = $enable_related_slider ? '3' : '4';
|
229 |
$default_gird_column_tab = $enable_related_slider ? '2' : '6';
|
230 |
$default_gird_column_mobile = $enable_related_slider ? '1' : '12';
|
231 |
|
|
|
232 |
$gird_column_desktop = '0' !== $post_data['gird_column'] ? $post_data['gird_column'] : $default_gird_column_desktop;
|
233 |
$gird_column_tab = '0' !== $post_data['gird_column_tablet'] ? $post_data['gird_column_tablet'] : $default_gird_column_tab;
|
234 |
$gird_column_mobile = '0' !== $post_data['gird_column_mobile'] ? $post_data['gird_column_mobile'] : $default_gird_column_mobile;
|
235 |
|
236 |
$item_column = "rt-col-md-{$gird_column_desktop} rt-col-sm-{$gird_column_tab} rt-col-xs-{$gird_column_mobile}";
|
237 |
|
238 |
+
$slider_main_class = $enable_related_slider ? 'slider-layout-main loading' : 'slider-is-disable';
|
239 |
|
240 |
+
if ( $query->have_posts() ) :
|
241 |
+
?>
|
242 |
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper <?php echo esc_attr( $_layout . '-main' . ' ' . $slider_main_class ); ?>"
|
243 |
id="<?php echo esc_attr( $layoutID ); ?>"
|
244 |
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
250 |
data-el-query=''
|
251 |
>
|
252 |
<?php
|
|
|
253 |
$settings = get_option( rtTPG()->options['settings'] );
|
254 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
255 |
?>
|
292 |
|
293 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
294 |
|
295 |
+
// section title settings.
|
296 |
$this->get_section_title( $data );
|
297 |
|
298 |
$slider_data = [
|
299 |
+
'speed' => $data['speed'],
|
300 |
+
'autoPlayTimeOut' => $data['autoplaySpeed'],
|
301 |
+
'autoPlay' => $data['autoplay'] == 'yes' ? true : false,
|
302 |
+
'stopOnHover' => $data['stopOnHover'] == 'yes' ? true : false,
|
303 |
+
'nav' => $data['arrows'] == 'yes' ? true : false,
|
304 |
+
'dots' => $data['dots'] == 'yes' ? true : false,
|
305 |
+
'loop' => $data['infinite'] == 'yes' ? true : false,
|
306 |
+
'lazyLoad' => $data['lazyLoad'] == 'yes' ? true : false,
|
307 |
+
'autoHeight' => $data['autoHeight'] == 'yes' ? true : false,
|
308 |
];
|
309 |
|
310 |
if ( $data['enable_2_rows'] == 'yes' ) {
|
312 |
}
|
313 |
|
314 |
$col_start_class = $col_end_class = null;
|
|
|
315 |
?>
|
316 |
|
317 |
<?php if ( $enable_related_slider ) { ?>
|
318 |
+
<div class="slider-main-wrapper <?php echo esc_attr( $_layout ); ?>">
|
319 |
|
320 |
<div class="rt-swiper-holder swiper"
|
321 |
+
data-rtowl-options='<?php echo wp_json_encode( $slider_data ); ?>'
|
322 |
dir="<?php echo esc_attr( $data['slider_direction'] ); ?>">
|
323 |
+
<div class="swiper-wrapper <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
324 |
<?php } else { ?>
|
325 |
+
<div class="rt-row rt-content-loader <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
326 |
<?php
|
327 |
+
}
|
328 |
+
?>
|
329 |
|
330 |
<?php
|
331 |
$pCount = 1;
|
332 |
+
|
333 |
while ( $query->have_posts() ) {
|
334 |
$query->the_post();
|
335 |
set_query_var( 'tpg_post_count', $pCount );
|
336 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
337 |
?>
|
338 |
+
<?php if ( ! $enable_related_slider ) { ?>
|
339 |
+
<div class='<?php echo esc_attr( $item_column ); ?>'>
|
340 |
<?php } ?>
|
341 |
<?php
|
342 |
$this->tpg_template( $post_data );
|
343 |
?>
|
344 |
+
<?php if ( ! $enable_related_slider ) { ?>
|
345 |
</div>
|
346 |
<?php } ?>
|
347 |
<?php
|
349 |
if ( $_layout == 'slider-layout10' && $pCount == 5 ) {
|
350 |
$pCount = 0;
|
351 |
}
|
352 |
+
|
353 |
$pCount ++;
|
354 |
}
|
355 |
wp_reset_postdata();
|
363 |
|
364 |
|
365 |
<!--swiper-pagination-horizontal-->
|
366 |
+
<?php if ( $data['dots'] == 'yes' ) : ?>
|
367 |
<div class="swiper-pagination"></div>
|
368 |
<?php endif; ?>
|
369 |
|
370 |
+
<?php if ( $data['arrows'] == 'yes' ) : ?>
|
371 |
<div class="swiper-navigation">
|
372 |
<div class="slider-btn swiper-button-prev"></div>
|
373 |
<div class="slider-btn swiper-button-next"></div>
|
377 |
|
378 |
<?php } ?>
|
379 |
</div>
|
|
|
|
|
380 |
</div>
|
381 |
<?php
|
382 |
endif;
|
383 |
|
384 |
+
do_action( 'tpg_elementor_script' );
|
|
|
385 |
}
|
386 |
|
387 |
+
}
|
app/Widgets/elementor/widgets/slider-layout-archive.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
* @param array $data
|
20 |
-
* @param null
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
@@ -27,7 +31,7 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
27 |
$this->prefix = 'slider';
|
28 |
$this->tpg_name = esc_html__( 'TPG - Slider Layout Archive', 'the-post-grid' );
|
29 |
$this->tpg_base = 'tpg-slider-layout-archive';
|
30 |
-
$this->tpg_icon = 'eicon-post-slider tpg-grid-icon';
|
31 |
$this->tpg_category = $this->tpg_archive_category;
|
32 |
}
|
33 |
|
@@ -62,13 +66,13 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
62 |
* =============
|
63 |
*/
|
64 |
|
65 |
-
//Layout
|
66 |
rtTPGElementorHelper::grid_layouts( $this, 'archive' );
|
67 |
|
68 |
-
//Query
|
69 |
rtTPGElementorHelper::query_builder( $this );
|
70 |
|
71 |
-
//Links
|
72 |
rtTPGElementorHelper::links( $this );
|
73 |
|
74 |
/**
|
@@ -76,31 +80,31 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
76 |
* =============
|
77 |
*/
|
78 |
|
79 |
-
//Field Selection
|
80 |
rtTPGElementorHelper::field_selection( $this );
|
81 |
|
82 |
-
//Section Title Settings
|
83 |
rtTPGElementorHelper::section_title_settings( $this, 'archive' );
|
84 |
|
85 |
-
//Title Settings
|
86 |
rtTPGElementorHelper::post_title_settings( $this );
|
87 |
|
88 |
-
//Thumbnail Settings
|
89 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
90 |
|
91 |
-
//Excerpt Settings
|
92 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
93 |
|
94 |
-
//Meta Settings
|
95 |
rtTPGElementorHelper::post_meta_settings( $this );
|
96 |
|
97 |
-
//Advanced Custom Field ACF Settings
|
98 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
99 |
|
100 |
-
//Readmore Settings
|
101 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
102 |
|
103 |
-
//Slider Settings
|
104 |
rtTPGElementorHelper::slider_settings( $this );
|
105 |
|
106 |
/**
|
@@ -108,41 +112,41 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
108 |
* =============
|
109 |
*/
|
110 |
|
111 |
-
//Section Title
|
112 |
rtTPGElementorHelper::sectionTitle( $this, 'archive' );
|
113 |
|
114 |
-
// Title Style
|
115 |
rtTPGElementorHelper::titleStyle( $this );
|
116 |
|
117 |
-
//Thumbnail Style
|
118 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
119 |
|
120 |
-
// Content Style
|
121 |
rtTPGElementorHelper::contentStyle( $this );
|
122 |
|
123 |
-
// Meta Info Style
|
124 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
125 |
|
126 |
-
//Social Style
|
127 |
rtTPGElementorHelper::socialShareStyle( $this );
|
128 |
|
129 |
-
//ACF Style
|
130 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
131 |
|
132 |
-
//Read more style
|
133 |
rtTPGElementorHelper::readmoreStyle( $this );
|
134 |
|
135 |
-
//Link Style
|
136 |
rtTPGElementorHelper::linkStyle( $this );
|
137 |
|
138 |
-
//Slider Style
|
139 |
rtTPGElementorHelper::slider_style( $this );
|
140 |
rtTPGElementorHelper::slider_thumb_style( $this );
|
141 |
|
142 |
-
//Box Settings
|
143 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
144 |
|
145 |
-
//Promotions
|
146 |
rtTPGElementorHelper::promotions( $this );
|
147 |
}
|
148 |
|
@@ -152,7 +156,7 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
152 |
$data['post_type'] = 'post';
|
153 |
|
154 |
if ( ! rtTPG()->hasPro() ) { ?>
|
155 |
-
|
156 |
<?php
|
157 |
return;
|
158 |
}
|
@@ -164,12 +168,11 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
164 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ], 1 );
|
165 |
}
|
166 |
|
167 |
-
|
168 |
-
//Query
|
169 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix );
|
170 |
$query = new WP_Query( $query_args );
|
171 |
$rand = mt_rand();
|
172 |
-
$layoutID =
|
173 |
$posts_per_page = $data['post_limit'];
|
174 |
|
175 |
/**
|
@@ -183,15 +186,16 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
183 |
/**
|
184 |
* Post type render
|
185 |
*/
|
186 |
-
|
187 |
$post_types = Fns::get_post_types();
|
188 |
foreach ( $post_types as $post_type => $label ) {
|
189 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
|
|
190 |
if ( empty( $_taxonomies ) ) {
|
191 |
continue;
|
192 |
}
|
193 |
-
|
194 |
-
$post_data[ $data['post_type'] . '
|
|
|
195 |
}
|
196 |
|
197 |
$post_data['enable_2_rows'] = $data['enable_2_rows'];
|
@@ -210,37 +214,35 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
210 |
$gird_column_tab = '0' !== $post_data['gird_column_tablet'] ? $post_data['gird_column_tablet'] : $default_gird_column_tab;
|
211 |
$gird_column_mobile = '0' !== $post_data['gird_column_mobile'] ? $post_data['gird_column_mobile'] : $default_gird_column_mobile;
|
212 |
|
213 |
-
|
214 |
if ( in_array( $_layout, [ 'slider-layout10', 'slider-layout11' ] ) ) {
|
215 |
$gird_column_desktop = $gird_column_tab = $gird_column_mobile = '1';
|
216 |
}
|
217 |
|
218 |
?>
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
<?php
|
230 |
|
231 |
$settings = get_option( rtTPG()->options['settings'] );
|
232 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
233 |
?>
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
<?php
|
240 |
}
|
241 |
|
242 |
$wrapper_class = [];
|
243 |
-
// $wrapper_class[] = $_layout;
|
244 |
$wrapper_class[] = 'rt-content-loader grid-behaviour';
|
245 |
|
246 |
if ( $_layout == 'slider-layout1' ) {
|
@@ -271,24 +273,21 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
271 |
|
272 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
273 |
|
274 |
-
//section title settings
|
275 |
$this->get_section_title( $data );
|
276 |
|
277 |
-
//$data['carousel_overflow']
|
278 |
-
//$data['slider_gap']
|
279 |
-
|
280 |
$slider_data = [
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
];
|
293 |
|
294 |
if ( $data['enable_2_rows'] == 'yes' ) {
|
@@ -296,14 +295,15 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
296 |
}
|
297 |
?>
|
298 |
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
<?php
|
305 |
if ( $query->have_posts() ) {
|
306 |
$pCount = 1;
|
|
|
307 |
while ( $query->have_posts() ) {
|
308 |
$query->the_post();
|
309 |
set_query_var( 'tpg_post_count', $pCount );
|
@@ -324,55 +324,55 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
324 |
}
|
325 |
wp_reset_postdata();
|
326 |
?>
|
327 |
-
|
328 |
|
329 |
-
|
330 |
|
331 |
|
332 |
<?php if ( ! in_array( $_layout, [ 'slider-layout11', 'slider-layout12' ] ) ) : ?>
|
333 |
-
|
334 |
-
<?php if ( $data['dots'] ==
|
335 |
-
|
336 |
<?php endif; ?>
|
337 |
|
338 |
-
<?php if ( $data['arrows'] ==
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
<?php endif; ?>
|
344 |
<?php endif; ?>
|
345 |
|
346 |
<?php if ( in_array( $_layout, [ 'slider-layout11', 'slider-layout12' ] ) ) : ?>
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
<?php
|
351 |
if ( $query->have_posts() ) {
|
352 |
$pCount = 1;
|
|
|
353 |
while ( $query->have_posts() ) {
|
354 |
$query->the_post();
|
355 |
set_query_var( 'tpg_post_count', $pCount );
|
356 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
357 |
-
// $this->tpg_template( $post_data );
|
358 |
?>
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
<?php echo get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
<?php
|
367 |
$_cat_id = $data['post_type'] . '_taxonomy';
|
368 |
echo get_the_term_list( get_the_ID(), $data[ $_cat_id ], null, '<span class="rt-separator">,</span>' );
|
369 |
?>
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
<?php
|
377 |
$pCount ++;
|
378 |
}
|
@@ -385,19 +385,14 @@ class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
|
385 |
}
|
386 |
wp_reset_postdata();
|
387 |
?>
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
<?php endif; ?>
|
393 |
-
|
394 |
-
|
395 |
-
</div>
|
396 |
-
|
397 |
-
|
398 |
-
</div>
|
399 |
<?php
|
400 |
do_action( 'tpg_elementor_script' );
|
401 |
}
|
402 |
-
|
403 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Slider Layout Archive Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Slider Layout Archive Class
|
17 |
+
*/
|
18 |
class TPGSliderLayoutArchive extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
31 |
$this->prefix = 'slider';
|
32 |
$this->tpg_name = esc_html__( 'TPG - Slider Layout Archive', 'the-post-grid' );
|
33 |
$this->tpg_base = 'tpg-slider-layout-archive';
|
34 |
+
$this->tpg_icon = 'eicon-post-slider tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
$this->tpg_category = $this->tpg_archive_category;
|
36 |
}
|
37 |
|
66 |
* =============
|
67 |
*/
|
68 |
|
69 |
+
// Layout.
|
70 |
rtTPGElementorHelper::grid_layouts( $this, 'archive' );
|
71 |
|
72 |
+
// Query.
|
73 |
rtTPGElementorHelper::query_builder( $this );
|
74 |
|
75 |
+
// Links.
|
76 |
rtTPGElementorHelper::links( $this );
|
77 |
|
78 |
/**
|
80 |
* =============
|
81 |
*/
|
82 |
|
83 |
+
// Field Selection.
|
84 |
rtTPGElementorHelper::field_selection( $this );
|
85 |
|
86 |
+
// Section Title Settings.
|
87 |
rtTPGElementorHelper::section_title_settings( $this, 'archive' );
|
88 |
|
89 |
+
// Title Settings.
|
90 |
rtTPGElementorHelper::post_title_settings( $this );
|
91 |
|
92 |
+
// Thumbnail Settings.
|
93 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
94 |
|
95 |
+
// Excerpt Settings.
|
96 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
97 |
|
98 |
+
// Meta Settings.
|
99 |
rtTPGElementorHelper::post_meta_settings( $this );
|
100 |
|
101 |
+
// Advanced Custom Field ACF Settings.
|
102 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
103 |
|
104 |
+
// Readmore Settings.
|
105 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
106 |
|
107 |
+
// Slider Settings.
|
108 |
rtTPGElementorHelper::slider_settings( $this );
|
109 |
|
110 |
/**
|
112 |
* =============
|
113 |
*/
|
114 |
|
115 |
+
// Section Title.
|
116 |
rtTPGElementorHelper::sectionTitle( $this, 'archive' );
|
117 |
|
118 |
+
// Title Style.
|
119 |
rtTPGElementorHelper::titleStyle( $this );
|
120 |
|
121 |
+
// Thumbnail Style.
|
122 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
123 |
|
124 |
+
// Content Style.
|
125 |
rtTPGElementorHelper::contentStyle( $this );
|
126 |
|
127 |
+
// Meta Info Style.
|
128 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
129 |
|
130 |
+
// Social Style.
|
131 |
rtTPGElementorHelper::socialShareStyle( $this );
|
132 |
|
133 |
+
// ACF Style.
|
134 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
135 |
|
136 |
+
// Read more style.
|
137 |
rtTPGElementorHelper::readmoreStyle( $this );
|
138 |
|
139 |
+
// Link Style.
|
140 |
rtTPGElementorHelper::linkStyle( $this );
|
141 |
|
142 |
+
// Slider Style.
|
143 |
rtTPGElementorHelper::slider_style( $this );
|
144 |
rtTPGElementorHelper::slider_thumb_style( $this );
|
145 |
|
146 |
+
// Box Settings.
|
147 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
148 |
|
149 |
+
// Promotions.
|
150 |
rtTPGElementorHelper::promotions( $this );
|
151 |
}
|
152 |
|
156 |
$data['post_type'] = 'post';
|
157 |
|
158 |
if ( ! rtTPG()->hasPro() ) { ?>
|
159 |
+
<h3 style="text-align: center"><?php echo esc_html__( 'Please upgrade to pro for slider layout!', 'the-post-grid' ); ?></h3>
|
160 |
<?php
|
161 |
return;
|
162 |
}
|
168 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ], 1 );
|
169 |
}
|
170 |
|
171 |
+
// Query.
|
|
|
172 |
$query_args = rtTPGElementorQuery::post_query_builder( $data, $_prefix );
|
173 |
$query = new WP_Query( $query_args );
|
174 |
$rand = mt_rand();
|
175 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
176 |
$posts_per_page = $data['post_limit'];
|
177 |
|
178 |
/**
|
186 |
/**
|
187 |
* Post type render
|
188 |
*/
|
|
|
189 |
$post_types = Fns::get_post_types();
|
190 |
foreach ( $post_types as $post_type => $label ) {
|
191 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
192 |
+
|
193 |
if ( empty( $_taxonomies ) ) {
|
194 |
continue;
|
195 |
}
|
196 |
+
|
197 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
198 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
199 |
}
|
200 |
|
201 |
$post_data['enable_2_rows'] = $data['enable_2_rows'];
|
214 |
$gird_column_tab = '0' !== $post_data['gird_column_tablet'] ? $post_data['gird_column_tablet'] : $default_gird_column_tab;
|
215 |
$gird_column_mobile = '0' !== $post_data['gird_column_mobile'] ? $post_data['gird_column_mobile'] : $default_gird_column_mobile;
|
216 |
|
|
|
217 |
if ( in_array( $_layout, [ 'slider-layout10', 'slider-layout11' ] ) ) {
|
218 |
$gird_column_desktop = $gird_column_tab = $gird_column_mobile = '1';
|
219 |
}
|
220 |
|
221 |
?>
|
222 |
+
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper slider-layout-main loading <?php echo esc_attr( $_layout . '-main' ); ?>"
|
223 |
+
id="<?php echo esc_attr( $layoutID ); ?>"
|
224 |
+
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
225 |
+
data-grid-style=""
|
226 |
+
data-desktop-col="<?php echo esc_attr( $gird_column_desktop ); ?>"
|
227 |
+
data-tab-col="<?php echo esc_attr( $gird_column_tab ); ?>"
|
228 |
+
data-mobile-col="<?php echo esc_attr( $gird_column_mobile ); ?>"
|
229 |
+
data-sc-id="elementor"
|
230 |
+
data-el-query=''
|
231 |
+
>
|
232 |
<?php
|
233 |
|
234 |
$settings = get_option( rtTPG()->options['settings'] );
|
235 |
if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
|
236 |
?>
|
237 |
+
<div id="bottom-script-loader" class="bottom-script-loader">
|
238 |
+
<div class="rt-ball-clip-rotate">
|
239 |
+
<div></div>
|
240 |
+
</div>
|
241 |
+
</div>
|
242 |
<?php
|
243 |
}
|
244 |
|
245 |
$wrapper_class = [];
|
|
|
246 |
$wrapper_class[] = 'rt-content-loader grid-behaviour';
|
247 |
|
248 |
if ( $_layout == 'slider-layout1' ) {
|
273 |
|
274 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
275 |
|
276 |
+
// section title settings.
|
277 |
$this->get_section_title( $data );
|
278 |
|
|
|
|
|
|
|
279 |
$slider_data = [
|
280 |
+
'speed' => $data['speed'],
|
281 |
+
'autoPlayTimeOut' => $data['autoplaySpeed'],
|
282 |
+
'autoPlay' => $data['autoplay'] == 'yes' ? true : false,
|
283 |
+
'stopOnHover' => $data['stopOnHover'] == 'yes' ? true : false,
|
284 |
+
'nav' => $data['arrows'] == 'yes' ? true : false,
|
285 |
+
'dots' => $data['dots'] == 'yes' ? true : false,
|
286 |
+
'loop' => $data['infinite'] == 'yes' ? true : false,
|
287 |
+
'lazyLoad' => $data['lazyLoad'] == 'yes' ? true : false,
|
288 |
+
'autoHeight' => $data['autoHeight'] == 'yes' ? true : false,
|
289 |
+
'dynamic_dots' => $data['dynamic_dots'] == 'yes' ? true : false,
|
290 |
+
'grabCursor' => $data['grabCursor'] == 'yes' ? true : false,
|
291 |
];
|
292 |
|
293 |
if ( $data['enable_2_rows'] == 'yes' ) {
|
295 |
}
|
296 |
?>
|
297 |
|
298 |
+
<div class="slider-main-wrapper <?php echo esc_attr( $_layout ); ?>">
|
299 |
+
<div class="rt-swiper-holder swiper"
|
300 |
+
data-rtowl-options='<?php echo wp_json_encode( $slider_data ); ?>'
|
301 |
+
dir="<?php echo esc_attr( $data['slider_direction'] ); ?>">
|
302 |
+
<div class="swiper-wrapper <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
303 |
<?php
|
304 |
if ( $query->have_posts() ) {
|
305 |
$pCount = 1;
|
306 |
+
|
307 |
while ( $query->have_posts() ) {
|
308 |
$query->the_post();
|
309 |
set_query_var( 'tpg_post_count', $pCount );
|
324 |
}
|
325 |
wp_reset_postdata();
|
326 |
?>
|
327 |
+
</div>
|
328 |
|
329 |
+
</div>
|
330 |
|
331 |
|
332 |
<?php if ( ! in_array( $_layout, [ 'slider-layout11', 'slider-layout12' ] ) ) : ?>
|
333 |
+
<!--swiper-pagination-horizontal-->
|
334 |
+
<?php if ( $data['dots'] == 'yes' ) : ?>
|
335 |
+
<div class="swiper-pagination"></div>
|
336 |
<?php endif; ?>
|
337 |
|
338 |
+
<?php if ( $data['arrows'] == 'yes' ) : ?>
|
339 |
+
<div class="swiper-navigation">
|
340 |
+
<div class="slider-btn swiper-button-prev"></div>
|
341 |
+
<div class="slider-btn swiper-button-next"></div>
|
342 |
+
</div>
|
343 |
<?php endif; ?>
|
344 |
<?php endif; ?>
|
345 |
|
346 |
<?php if ( in_array( $_layout, [ 'slider-layout11', 'slider-layout12' ] ) ) : ?>
|
347 |
+
<div class="slider-thumb-main-wrapper">
|
348 |
+
<div class="swiper-thumb-wrapper gallery-thumbs swiper">
|
349 |
+
<div class="swiper-wrapper">
|
350 |
<?php
|
351 |
if ( $query->have_posts() ) {
|
352 |
$pCount = 1;
|
353 |
+
|
354 |
while ( $query->have_posts() ) {
|
355 |
$query->the_post();
|
356 |
set_query_var( 'tpg_post_count', $pCount );
|
357 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
|
|
358 |
?>
|
359 |
+
<div class="swiper-slide">
|
360 |
+
<div class="post-thumbnail-wrap">
|
361 |
+
<div class="p-thumbnail">
|
362 |
<?php echo get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>
|
363 |
+
</div>
|
364 |
+
<div class="p-content">
|
365 |
+
<div class="post-taxonomy">
|
366 |
<?php
|
367 |
$_cat_id = $data['post_type'] . '_taxonomy';
|
368 |
echo get_the_term_list( get_the_ID(), $data[ $_cat_id ], null, '<span class="rt-separator">,</span>' );
|
369 |
?>
|
370 |
+
</div>
|
371 |
+
<h3 class="thumb-title"><?php echo get_the_title(); ?></h3>
|
372 |
+
<span class="thumb-date"><?php echo get_the_date(); ?></span>
|
373 |
+
</div>
|
374 |
+
</div>
|
375 |
+
</div>
|
376 |
<?php
|
377 |
$pCount ++;
|
378 |
}
|
385 |
}
|
386 |
wp_reset_postdata();
|
387 |
?>
|
388 |
+
</div>
|
389 |
+
<div class="swiper-thumb-pagination"></div>
|
390 |
+
</div>
|
391 |
+
</div>
|
392 |
<?php endif; ?>
|
393 |
+
</div>
|
394 |
+
</div>
|
|
|
|
|
|
|
|
|
395 |
<?php
|
396 |
do_action( 'tpg_elementor_script' );
|
397 |
}
|
398 |
+
}
|
|
app/Widgets/elementor/widgets/slider-layout.php
CHANGED
@@ -1,23 +1,27 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
*
|
4 |
-
*
|
5 |
-
* @
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
|
|
10 |
if ( ! defined( 'ABSPATH' ) ) {
|
11 |
-
exit;
|
12 |
}
|
13 |
|
|
|
|
|
|
|
14 |
class TPGSliderLayout extends Custom_Widget_Base {
|
15 |
|
16 |
/**
|
17 |
* GridLayout constructor.
|
18 |
*
|
19 |
* @param array $data
|
20 |
-
* @param null
|
21 |
*
|
22 |
* @throws \Exception
|
23 |
*/
|
@@ -27,7 +31,7 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
27 |
$this->prefix = 'slider';
|
28 |
$this->tpg_name = esc_html__( 'TPG - Slider Layout', 'the-post-grid' );
|
29 |
$this->tpg_base = 'tpg-slider-layout';
|
30 |
-
$this->tpg_icon = 'eicon-post-slider tpg-grid-icon';
|
31 |
}
|
32 |
|
33 |
public function get_script_depends() {
|
@@ -54,20 +58,19 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
54 |
return $style;
|
55 |
}
|
56 |
|
57 |
-
|
58 |
protected function register_controls() {
|
59 |
/**
|
60 |
* Content Tabs
|
61 |
* =============
|
62 |
*/
|
63 |
|
64 |
-
//Layout
|
65 |
rtTPGElementorHelper::grid_layouts( $this );
|
66 |
|
67 |
-
//Query
|
68 |
rtTPGElementorHelper::query( $this );
|
69 |
|
70 |
-
//Links
|
71 |
rtTPGElementorHelper::links( $this );
|
72 |
|
73 |
/**
|
@@ -75,74 +78,73 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
75 |
* =============
|
76 |
*/
|
77 |
|
78 |
-
//Field Selection
|
79 |
rtTPGElementorHelper::field_selection( $this );
|
80 |
|
81 |
-
//Section Title Settings
|
82 |
rtTPGElementorHelper::section_title_settings( $this );
|
83 |
|
84 |
-
//Title Settings
|
85 |
rtTPGElementorHelper::post_title_settings( $this );
|
86 |
|
87 |
-
//Thumbnail Settings
|
88 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
89 |
|
90 |
-
//Excerpt Settings
|
91 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
92 |
|
93 |
-
//Meta Settings
|
94 |
rtTPGElementorHelper::post_meta_settings( $this );
|
95 |
|
96 |
-
//Advanced Custom Field ACF Settings
|
97 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
98 |
|
99 |
-
//Readmore Settings
|
100 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
101 |
|
102 |
-
//Slider Settings
|
103 |
rtTPGElementorHelper::slider_settings( $this );
|
104 |
|
105 |
-
|
106 |
/**
|
107 |
* Style Tabs
|
108 |
* =============
|
109 |
*/
|
110 |
|
111 |
-
//Section Title
|
112 |
rtTPGElementorHelper::sectionTitle( $this );
|
113 |
|
114 |
-
// Title Style
|
115 |
rtTPGElementorHelper::titleStyle( $this );
|
116 |
|
117 |
-
//Thumbnail Style
|
118 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
119 |
|
120 |
-
// Content Style
|
121 |
rtTPGElementorHelper::contentStyle( $this );
|
122 |
|
123 |
-
// Meta Info Style
|
124 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
125 |
|
126 |
-
//Social Style
|
127 |
rtTPGElementorHelper::socialShareStyle( $this );
|
128 |
|
129 |
-
//ACF Style
|
130 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
131 |
|
132 |
-
//Read more style
|
133 |
rtTPGElementorHelper::readmoreStyle( $this );
|
134 |
|
135 |
-
//Slider Style
|
136 |
rtTPGElementorHelper::slider_style( $this );
|
137 |
rtTPGElementorHelper::slider_thumb_style( $this );
|
138 |
|
139 |
-
//Link Style
|
140 |
rtTPGElementorHelper::linkStyle( $this );
|
141 |
|
142 |
-
//Box Settings
|
143 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
144 |
|
145 |
-
//Promotions
|
146 |
rtTPGElementorHelper::promotions( $this );
|
147 |
}
|
148 |
|
@@ -150,7 +152,7 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
150 |
$data = $this->get_settings();
|
151 |
$_prefix = $this->prefix;
|
152 |
if ( ! rtTPG()->hasPro() ) { ?>
|
153 |
-
|
154 |
<?php
|
155 |
return;
|
156 |
}
|
@@ -162,12 +164,11 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
162 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ], 1 );
|
163 |
}
|
164 |
|
165 |
-
|
166 |
-
//Query
|
167 |
$query_args = rtTPGElementorQuery::post_query( $data, $_prefix );
|
168 |
$query = new WP_Query( $query_args );
|
169 |
$rand = mt_rand();
|
170 |
-
$layoutID =
|
171 |
$posts_per_page = $data['post_limit'];
|
172 |
|
173 |
/**
|
@@ -181,21 +182,20 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
181 |
/**
|
182 |
* Post type render
|
183 |
*/
|
184 |
-
|
185 |
$post_types = Fns::get_post_types();
|
186 |
foreach ( $post_types as $post_type => $label ) {
|
187 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
|
|
188 |
if ( empty( $_taxonomies ) ) {
|
189 |
continue;
|
190 |
}
|
191 |
-
$post_data[ $data['post_type'] . '_taxonomy' ] = isset($data[ $data['post_type'] . '_taxonomy' ]) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
192 |
-
$post_data[ $data['post_type'] . '_tags' ] = isset($data[ $data['post_type'] . '_tags' ]) ? $data[ $data['post_type'] . '_tags' ] : '';
|
193 |
-
}
|
194 |
|
|
|
|
|
|
|
195 |
|
196 |
$post_data['enable_2_rows'] = $data['enable_2_rows'];
|
197 |
|
198 |
-
|
199 |
$default_gird_column_desktop = '3';
|
200 |
$default_gird_column_tab = '2';
|
201 |
$default_gird_column_mobile = '1';
|
@@ -210,26 +210,24 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
210 |
$gird_column_tab = '0' !== $post_data['gird_column_tablet'] ? $post_data['gird_column_tablet'] : $default_gird_column_tab;
|
211 |
$gird_column_mobile = '0' !== $post_data['gird_column_mobile'] ? $post_data['gird_column_mobile'] : $default_gird_column_mobile;
|
212 |
|
213 |
-
|
214 |
if ( in_array( $_layout, [ 'slider-layout10', 'slider-layout11' ] ) ) {
|
215 |
$gird_column_desktop = $gird_column_tab = $gird_column_mobile = '1';
|
216 |
}
|
217 |
|
218 |
?>
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
<?php
|
230 |
|
231 |
$wrapper_class = [];
|
232 |
-
// $wrapper_class[] = $_layout;
|
233 |
$wrapper_class[] = 'rt-content-loader grid-behaviour';
|
234 |
|
235 |
if ( $_layout == 'slider-layout1' ) {
|
@@ -260,24 +258,21 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
260 |
|
261 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
262 |
|
263 |
-
//section title settings
|
264 |
$this->get_section_title( $data );
|
265 |
|
266 |
-
//$data['carousel_overflow']
|
267 |
-
//$data['slider_gap']
|
268 |
-
|
269 |
$slider_data = [
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
];
|
282 |
|
283 |
if ( $data['enable_2_rows'] == 'yes' ) {
|
@@ -285,15 +280,16 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
285 |
}
|
286 |
?>
|
287 |
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
<?php
|
295 |
if ( $query->have_posts() ) {
|
296 |
$pCount = 1;
|
|
|
297 |
while ( $query->have_posts() ) {
|
298 |
$query->the_post();
|
299 |
set_query_var( 'tpg_post_count', $pCount );
|
@@ -303,6 +299,7 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
303 |
if ( $_layout == 'slider-layout10' && $pCount == 5 ) {
|
304 |
$pCount = 0;
|
305 |
}
|
|
|
306 |
$pCount ++;
|
307 |
}
|
308 |
} else {
|
@@ -314,29 +311,29 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
314 |
}
|
315 |
wp_reset_postdata();
|
316 |
?>
|
317 |
-
|
318 |
|
319 |
-
|
320 |
|
321 |
|
322 |
<?php if ( ! in_array( $_layout, [ 'slider-layout11', 'slider-layout12' ] ) ) : ?>
|
323 |
-
|
324 |
-
<?php if ( $data['dots'] ==
|
325 |
-
|
326 |
<?php endif; ?>
|
327 |
|
328 |
-
<?php if ( $data['arrows'] ==
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
<?php endif; ?>
|
334 |
<?php endif; ?>
|
335 |
|
336 |
<?php if ( in_array( $_layout, [ 'slider-layout11', 'slider-layout12' ] ) ) : ?>
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
<?php
|
341 |
if ( $query->have_posts() ) {
|
342 |
$pCount = 1;
|
@@ -345,23 +342,23 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
345 |
set_query_var( 'tpg_post_count', $pCount );
|
346 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
347 |
?>
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
<?php echo get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
<?php
|
356 |
$_cat_id = $data['post_type'] . '_taxonomy';
|
357 |
echo get_the_term_list( get_the_ID(), $data[ $_cat_id ], null, '<span class="rt-separator">,</span>' );
|
358 |
?>
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
<?php
|
366 |
$pCount ++;
|
367 |
}
|
@@ -374,15 +371,14 @@ class TPGSliderLayout extends Custom_Widget_Base {
|
|
374 |
}
|
375 |
wp_reset_postdata();
|
376 |
?>
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
<?php endif; ?>
|
382 |
-
|
383 |
-
|
384 |
<?php
|
385 |
do_action( 'tpg_elementor_script' );
|
386 |
}
|
387 |
-
|
388 |
-
}
|
1 |
<?php
|
2 |
/**
|
3 |
+
* Slider Layout Class
|
4 |
+
*
|
5 |
+
* @package RT_TPG
|
6 |
*/
|
7 |
|
8 |
use RT\ThePostGrid\Helpers\Fns;
|
9 |
|
10 |
+
// Do not allow directly accessing this file.
|
11 |
if ( ! defined( 'ABSPATH' ) ) {
|
12 |
+
exit( 'This script cannot be accessed directly.' );
|
13 |
}
|
14 |
|
15 |
+
/**
|
16 |
+
* Slider Layout Class
|
17 |
+
*/
|
18 |
class TPGSliderLayout extends Custom_Widget_Base {
|
19 |
|
20 |
/**
|
21 |
* GridLayout constructor.
|
22 |
*
|
23 |
* @param array $data
|
24 |
+
* @param null $args
|
25 |
*
|
26 |
* @throws \Exception
|
27 |
*/
|
31 |
$this->prefix = 'slider';
|
32 |
$this->tpg_name = esc_html__( 'TPG - Slider Layout', 'the-post-grid' );
|
33 |
$this->tpg_base = 'tpg-slider-layout';
|
34 |
+
$this->tpg_icon = 'eicon-post-slider tpg-grid-icon'; // .tpg-grid-icon class for just style
|
35 |
}
|
36 |
|
37 |
public function get_script_depends() {
|
58 |
return $style;
|
59 |
}
|
60 |
|
|
|
61 |
protected function register_controls() {
|
62 |
/**
|
63 |
* Content Tabs
|
64 |
* =============
|
65 |
*/
|
66 |
|
67 |
+
// Layout.
|
68 |
rtTPGElementorHelper::grid_layouts( $this );
|
69 |
|
70 |
+
// Query.
|
71 |
rtTPGElementorHelper::query( $this );
|
72 |
|
73 |
+
// Links.
|
74 |
rtTPGElementorHelper::links( $this );
|
75 |
|
76 |
/**
|
78 |
* =============
|
79 |
*/
|
80 |
|
81 |
+
// Field Selection.
|
82 |
rtTPGElementorHelper::field_selection( $this );
|
83 |
|
84 |
+
// Section Title Settings.
|
85 |
rtTPGElementorHelper::section_title_settings( $this );
|
86 |
|
87 |
+
// Title Settings.
|
88 |
rtTPGElementorHelper::post_title_settings( $this );
|
89 |
|
90 |
+
// Thumbnail Settings.
|
91 |
rtTPGElementorHelper::post_thumbnail_settings( $this );
|
92 |
|
93 |
+
// Excerpt Settings.
|
94 |
rtTPGElementorHelper::post_excerpt_settings( $this );
|
95 |
|
96 |
+
// Meta Settings.
|
97 |
rtTPGElementorHelper::post_meta_settings( $this );
|
98 |
|
99 |
+
// Advanced Custom Field ACF Settings.
|
100 |
rtTPGElementorHelper::tpg_acf_settings( $this );
|
101 |
|
102 |
+
// Readmore Settings.
|
103 |
rtTPGElementorHelper::post_readmore_settings( $this );
|
104 |
|
105 |
+
// Slider Settings.
|
106 |
rtTPGElementorHelper::slider_settings( $this );
|
107 |
|
|
|
108 |
/**
|
109 |
* Style Tabs
|
110 |
* =============
|
111 |
*/
|
112 |
|
113 |
+
// Section Title.
|
114 |
rtTPGElementorHelper::sectionTitle( $this );
|
115 |
|
116 |
+
// Title Style.
|
117 |
rtTPGElementorHelper::titleStyle( $this );
|
118 |
|
119 |
+
// Thumbnail Style.
|
120 |
rtTPGElementorHelper::thumbnailStyle( $this );
|
121 |
|
122 |
+
// Content Style.
|
123 |
rtTPGElementorHelper::contentStyle( $this );
|
124 |
|
125 |
+
// Meta Info Style.
|
126 |
rtTPGElementorHelper::metaInfoStyle( $this );
|
127 |
|
128 |
+
// Social Style.
|
129 |
rtTPGElementorHelper::socialShareStyle( $this );
|
130 |
|
131 |
+
// ACF Style.
|
132 |
rtTPGElementorHelper::tpg_acf_style( $this );
|
133 |
|
134 |
+
// Read more style.
|
135 |
rtTPGElementorHelper::readmoreStyle( $this );
|
136 |
|
137 |
+
// Slider Style.
|
138 |
rtTPGElementorHelper::slider_style( $this );
|
139 |
rtTPGElementorHelper::slider_thumb_style( $this );
|
140 |
|
141 |
+
// Link Style.
|
142 |
rtTPGElementorHelper::linkStyle( $this );
|
143 |
|
144 |
+
// Box Settings.
|
145 |
rtTPGElementorHelper::articlBoxSettings( $this );
|
146 |
|
147 |
+
// Promotions.
|
148 |
rtTPGElementorHelper::promotions( $this );
|
149 |
}
|
150 |
|
152 |
$data = $this->get_settings();
|
153 |
$_prefix = $this->prefix;
|
154 |
if ( ! rtTPG()->hasPro() ) { ?>
|
155 |
+
<h3 style="text-align: center"><?php echo esc_html__( 'Please upgrade to pro for slider layout!', 'the-post-grid' ); ?></h3>
|
156 |
<?php
|
157 |
return;
|
158 |
}
|
164 |
add_action( 'wp_footer', [ $this, 'get_modal_markup' ], 1 );
|
165 |
}
|
166 |
|
167 |
+
// Query.
|
|
|
168 |
$query_args = rtTPGElementorQuery::post_query( $data, $_prefix );
|
169 |
$query = new WP_Query( $query_args );
|
170 |
$rand = mt_rand();
|
171 |
+
$layoutID = 'rt-tpg-container-' . $rand;
|
172 |
$posts_per_page = $data['post_limit'];
|
173 |
|
174 |
/**
|
182 |
/**
|
183 |
* Post type render
|
184 |
*/
|
|
|
185 |
$post_types = Fns::get_post_types();
|
186 |
foreach ( $post_types as $post_type => $label ) {
|
187 |
$_taxonomies = get_object_taxonomies( $post_type, 'object' );
|
188 |
+
|
189 |
if ( empty( $_taxonomies ) ) {
|
190 |
continue;
|
191 |
}
|
|
|
|
|
|
|
192 |
|
193 |
+
$post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
|
194 |
+
$post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
|
195 |
+
}
|
196 |
|
197 |
$post_data['enable_2_rows'] = $data['enable_2_rows'];
|
198 |
|
|
|
199 |
$default_gird_column_desktop = '3';
|
200 |
$default_gird_column_tab = '2';
|
201 |
$default_gird_column_mobile = '1';
|
210 |
$gird_column_tab = '0' !== $post_data['gird_column_tablet'] ? $post_data['gird_column_tablet'] : $default_gird_column_tab;
|
211 |
$gird_column_mobile = '0' !== $post_data['gird_column_mobile'] ? $post_data['gird_column_mobile'] : $default_gird_column_mobile;
|
212 |
|
|
|
213 |
if ( in_array( $_layout, [ 'slider-layout10', 'slider-layout11' ] ) ) {
|
214 |
$gird_column_desktop = $gird_column_tab = $gird_column_mobile = '1';
|
215 |
}
|
216 |
|
217 |
?>
|
218 |
+
<div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper slider-layout-main loading <?php echo esc_attr( $_layout . '-main' ); ?>"
|
219 |
+
id="<?php echo esc_attr( $layoutID ); ?>"
|
220 |
+
data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
|
221 |
+
data-grid-style=""
|
222 |
+
data-desktop-col="<?php echo esc_attr( $gird_column_desktop ); ?>"
|
223 |
+
data-tab-col="<?php echo esc_attr( $gird_column_tab ); ?>"
|
224 |
+
data-mobile-col="<?php echo esc_attr( $gird_column_mobile ); ?>"
|
225 |
+
data-sc-id="elementor"
|
226 |
+
data-el-query=''
|
227 |
+
>
|
228 |
<?php
|
229 |
|
230 |
$wrapper_class = [];
|
|
|
231 |
$wrapper_class[] = 'rt-content-loader grid-behaviour';
|
232 |
|
233 |
if ( $_layout == 'slider-layout1' ) {
|
258 |
|
259 |
$wrapper_class[] = $_prefix . '_layout_wrapper';
|
260 |
|
261 |
+
// section title settings.
|
262 |
$this->get_section_title( $data );
|
263 |
|
|
|
|
|
|
|
264 |
$slider_data = [
|
265 |
+
'speed' => $data['speed'],
|
266 |
+
'autoPlayTimeOut' => $data['autoplaySpeed'],
|
267 |
+
'autoPlay' => $data['autoplay'] == 'yes' ? true : false,
|
268 |
+
'stopOnHover' => $data['stopOnHover'] == 'yes' ? true : false,
|
269 |
+
'nav' => $data['arrows'] == 'yes' ? true : false,
|
270 |
+
'dots' => $data['dots'] == 'yes' ? true : false,
|
271 |
+
'loop' => $data['infinite'] == 'yes' ? true : false,
|
272 |
+
'lazyLoad' => $data['lazyLoad'] == 'yes' ? true : false,
|
273 |
+
'autoHeight' => $data['autoHeight'] == 'yes' ? true : false,
|
274 |
+
'dynamic_dots' => $data['dynamic_dots'] == 'yes' ? true : false,
|
275 |
+
'grabCursor' => $data['grabCursor'] == 'yes' ? true : false,
|
276 |
];
|
277 |
|
278 |
if ( $data['enable_2_rows'] == 'yes' ) {
|
280 |
}
|
281 |
?>
|
282 |
|
283 |
+
<div class="slider-main-wrapper <?php echo esc_attr( $_layout ); ?>">
|
284 |
+
<div class="rt-swiper-holder swiper"
|
285 |
+
data-rtowl-options='<?php echo wp_json_encode( $slider_data ); ?>'
|
286 |
+
dir="<?php echo esc_attr( $data['slider_direction'] ); ?>"
|
287 |
+
>
|
288 |
+
<div class="swiper-wrapper <?php echo esc_attr( implode( ' ', $wrapper_class ) ); ?>">
|
289 |
<?php
|
290 |
if ( $query->have_posts() ) {
|
291 |
$pCount = 1;
|
292 |
+
|
293 |
while ( $query->have_posts() ) {
|
294 |
$query->the_post();
|
295 |
set_query_var( 'tpg_post_count', $pCount );
|
299 |
if ( $_layout == 'slider-layout10' && $pCount == 5 ) {
|
300 |
$pCount = 0;
|
301 |
}
|
302 |
+
|
303 |
$pCount ++;
|
304 |
}
|
305 |
} else {
|
311 |
}
|
312 |
wp_reset_postdata();
|
313 |
?>
|
314 |
+
</div>
|
315 |
|
316 |
+
</div>
|
317 |
|
318 |
|
319 |
<?php if ( ! in_array( $_layout, [ 'slider-layout11', 'slider-layout12' ] ) ) : ?>
|
320 |
+
<!--swiper-pagination-horizontal-->
|
321 |
+
<?php if ( $data['dots'] == 'yes' ) : ?>
|
322 |
+
<div class="swiper-pagination"></div>
|
323 |
<?php endif; ?>
|
324 |
|
325 |
+
<?php if ( $data['arrows'] == 'yes' ) : ?>
|
326 |
+
<div class="swiper-navigation">
|
327 |
+
<div class="slider-btn swiper-button-prev"></div>
|
328 |
+
<div class="slider-btn swiper-button-next"></div>
|
329 |
+
</div>
|
330 |
<?php endif; ?>
|
331 |
<?php endif; ?>
|
332 |
|
333 |
<?php if ( in_array( $_layout, [ 'slider-layout11', 'slider-layout12' ] ) ) : ?>
|
334 |
+
<div class="slider-thumb-main-wrapper">
|
335 |
+
<div class="swiper-thumb-wrapper gallery-thumbs swiper">
|
336 |
+
<div class="swiper-wrapper">
|
337 |
<?php
|
338 |
if ( $query->have_posts() ) {
|
339 |
$pCount = 1;
|
342 |
set_query_var( 'tpg_post_count', $pCount );
|
343 |
set_query_var( 'tpg_total_posts', $query->post_count );
|
344 |
?>
|
345 |
+
<div class="swiper-slide">
|
346 |
+
<div class="post-thumbnail-wrap">
|
347 |
+
<div class="p-thumbnail">
|
348 |
<?php echo get_the_post_thumbnail( get_the_ID(), 'thumbnail' ); ?>
|
349 |
+
</div>
|
350 |
+
<div class="p-content">
|
351 |
+
<div class="post-taxonomy">
|
352 |
<?php
|
353 |
$_cat_id = $data['post_type'] . '_taxonomy';
|
354 |
echo get_the_term_list( get_the_ID(), $data[ $_cat_id ], null, '<span class="rt-separator">,</span>' );
|
355 |
?>
|
356 |
+
</div>
|
357 |
+
<h3 class="thumb-title"><?php echo get_the_title(); ?></h3>
|
358 |
+
<span class="thumb-date"><?php echo get_the_date(); ?></span>
|
359 |
+
</div>
|
360 |
+
</div>
|
361 |
+
</div>
|
362 |
<?php
|
363 |
$pCount ++;
|
364 |
}
|
371 |
}
|
372 |
wp_reset_postdata();
|
373 |
?>
|
374 |
+
</div>
|
375 |
+
<div class="swiper-thumb-pagination"></div>
|
376 |
+
</div>
|
377 |
+
</div>
|
378 |
<?php endif; ?>
|
379 |
+
</div>
|
380 |
+
</div>
|
381 |
<?php
|
382 |
do_action( 'tpg_elementor_script' );
|
383 |
}
|
384 |
+
}
|
|
assets/css/admin/admin.css
CHANGED
@@ -1102,6 +1102,9 @@ body .rt-admin-btn:hover {
|
|
1102 |
margin-right: 10px;
|
1103 |
display: inline-block;
|
1104 |
margin-bottom: 10px;
|
|
|
|
|
|
|
1105 |
}
|
1106 |
|
1107 |
.rttpg-radio-image [type=radio] {
|
@@ -1195,7 +1198,7 @@ body .rt-admin-btn:hover {
|
|
1195 |
-webkit-transform: rotate(45deg);
|
1196 |
width: 67px;
|
1197 |
display: block;
|
1198 |
-
background: linear-gradient(#f70505
|
1199 |
box-shadow: 0 3px 10px -5px #000;
|
1200 |
position: absolute;
|
1201 |
top: 7px;
|
@@ -1543,14 +1546,14 @@ input:checked + .rttm-switch-slider:before {
|
|
1543 |
#tpg_common_settings_heading_holder {
|
1544 |
display: flex;
|
1545 |
flex-direction: column;
|
1546 |
-
background: #db1f31!important;
|
1547 |
padding: 13px 19px 15px;
|
1548 |
margin-top: -15px;
|
1549 |
margin-left: -15px;
|
1550 |
margin-right: -15px;
|
1551 |
}
|
1552 |
|
1553 |
-
#tpg_common_settings_heading_holder .field{
|
1554 |
background: none;
|
1555 |
border: none;
|
1556 |
padding: 10px 0 0;
|
@@ -1559,10 +1562,11 @@ input:checked + .rttm-switch-slider:before {
|
|
1559 |
#tpg_common_settings_heading_holder.field-holder .field-label {
|
1560 |
width: 100%;
|
1561 |
font-size: 21px;
|
1562 |
-
border-bottom: 1px solid rgba(0,0,0
|
1563 |
padding-bottom: 11px;
|
1564 |
color: #ffffff;
|
1565 |
}
|
|
|
1566 |
#tpg_common_settings_heading_holder.field-holder .description {
|
1567 |
color: #ffffff;
|
1568 |
font-size: 17px;
|
@@ -1593,7 +1597,7 @@ body .rt-tpg-container .swiper-navigation .slider-btn {
|
|
1593 |
}
|
1594 |
|
1595 |
label[for="popup-fields-tpg_default_value"],
|
1596 |
-
label[for="item-fields-tpg_default_value"]{
|
1597 |
display: none !important;
|
1598 |
pointer-events: none;
|
1599 |
text-indent: -99999px;
|
@@ -1800,11 +1804,12 @@ Date Picker CSS
|
|
1800 |
margin: 6px 0 0 2px;
|
1801 |
}
|
1802 |
|
1803 |
-
.ui-datepicker .ui-state-default.ui-state-highlight{
|
1804 |
border-color: #dcdcdc;
|
1805 |
background-color: #cff3f8 !important;
|
1806 |
color: #3e9aba !important;
|
1807 |
}
|
|
|
1808 |
.openemr-calendar .ui-state-default {
|
1809 |
font-size: 10px;
|
1810 |
margin: 0;
|
@@ -1897,3 +1902,8 @@ Date Picker CSS
|
|
1897 |
.openemr-calendar .ui-datepicker-month {
|
1898 |
margin-right: 10px !important;
|
1899 |
}
|
|
|
|
|
|
|
|
|
|
1102 |
margin-right: 10px;
|
1103 |
display: inline-block;
|
1104 |
margin-bottom: 10px;
|
1105 |
+
width: auto;
|
1106 |
+
max-width: initial;
|
1107 |
+
min-width: initial;
|
1108 |
}
|
1109 |
|
1110 |
.rttpg-radio-image [type=radio] {
|
1198 |
-webkit-transform: rotate(45deg);
|
1199 |
width: 67px;
|
1200 |
display: block;
|
1201 |
+
background: linear-gradient(#f70505, #8f0808);
|
1202 |
box-shadow: 0 3px 10px -5px #000;
|
1203 |
position: absolute;
|
1204 |
top: 7px;
|
1546 |
#tpg_common_settings_heading_holder {
|
1547 |
display: flex;
|
1548 |
flex-direction: column;
|
1549 |
+
background: #db1f31 !important;
|
1550 |
padding: 13px 19px 15px;
|
1551 |
margin-top: -15px;
|
1552 |
margin-left: -15px;
|
1553 |
margin-right: -15px;
|
1554 |
}
|
1555 |
|
1556 |
+
#tpg_common_settings_heading_holder .field {
|
1557 |
background: none;
|
1558 |
border: none;
|
1559 |
padding: 10px 0 0;
|
1562 |
#tpg_common_settings_heading_holder.field-holder .field-label {
|
1563 |
width: 100%;
|
1564 |
font-size: 21px;
|
1565 |
+
border-bottom: 1px solid rgba(0, 0, 0, .2);
|
1566 |
padding-bottom: 11px;
|
1567 |
color: #ffffff;
|
1568 |
}
|
1569 |
+
|
1570 |
#tpg_common_settings_heading_holder.field-holder .description {
|
1571 |
color: #ffffff;
|
1572 |
font-size: 17px;
|
1597 |
}
|
1598 |
|
1599 |
label[for="popup-fields-tpg_default_value"],
|
1600 |
+
label[for="item-fields-tpg_default_value"] {
|
1601 |
display: none !important;
|
1602 |
pointer-events: none;
|
1603 |
text-indent: -99999px;
|
1804 |
margin: 6px 0 0 2px;
|
1805 |
}
|
1806 |
|
1807 |
+
.ui-datepicker .ui-state-default.ui-state-highlight {
|
1808 |
border-color: #dcdcdc;
|
1809 |
background-color: #cff3f8 !important;
|
1810 |
color: #3e9aba !important;
|
1811 |
}
|
1812 |
+
|
1813 |
.openemr-calendar .ui-state-default {
|
1814 |
font-size: 10px;
|
1815 |
margin: 0;
|
1902 |
.openemr-calendar .ui-datepicker-month {
|
1903 |
margin-right: 10px !important;
|
1904 |
}
|
1905 |
+
|
1906 |
+
.rt-pagination .pagination-list > li > a,
|
1907 |
+
.rt-pagination .pagination-list > li > span {
|
1908 |
+
pointer-events: none;
|
1909 |
+
}
|
assets/js/admin.js
CHANGED
@@ -4,6 +4,7 @@
|
|
4 |
var postType = $( "#rt-sc-post-type" ).val();
|
5 |
$( document ).on( 'change', '#post_filter input[type=checkbox]', function () {
|
6 |
var id = $( this ).val();
|
|
|
7 |
if ( id == 'tpg_taxonomy' ) {
|
8 |
if ( this.checked ) {
|
9 |
rtTPGTaxonomyListByPostType( postType, $( this ) );
|
@@ -863,4 +864,4 @@
|
|
863 |
} );
|
864 |
}
|
865 |
|
866 |
-
} )( this, jQuery );
|
4 |
var postType = $( "#rt-sc-post-type" ).val();
|
5 |
$( document ).on( 'change', '#post_filter input[type=checkbox]', function () {
|
6 |
var id = $( this ).val();
|
7 |
+
var postType = $( "#rt-sc-post-type" ).val();
|
8 |
if ( id == 'tpg_taxonomy' ) {
|
9 |
if ( this.checked ) {
|
10 |
rtTPGTaxonomyListByPostType( postType, $( this ) );
|
864 |
} );
|
865 |
}
|
866 |
|
867 |
+
} )( this, jQuery );
|
assets/vendor/isotope/imagesloaded.pkgd.min.js
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* imagesLoaded PACKAGED v4.1.4
|
3 |
-
* JavaScript is all like "You images are done yet or what?"
|
4 |
-
* MIT License
|
5 |
-
*/
|
6 |
-
|
7 |
-
!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){if(e&&t){var i=this._events=this._events||{},n=i[e]=i[e]||[];return n.indexOf(t)==-1&&n.push(t),this}},t.once=function(e,t){if(e&&t){this.on(e,t);var i=this._onceEvents=this._onceEvents||{},n=i[e]=i[e]||{};return n[t]=!0,this}},t.off=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){var n=i.indexOf(t);return n!=-1&&i.splice(n,1),this}},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(e,r),delete n[r]),r.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(e,t){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(i){return t(e,i)}):"object"==typeof module&&module.exports?module.exports=t(e,require("ev-emitter")):e.imagesLoaded=t(e,e.EvEmitter)}("undefined"!=typeof window?window:this,function(e,t){function i(e,t){for(var i in t)e[i]=t[i];return e}function n(e){if(Array.isArray(e))return e;var t="object"==typeof e&&"number"==typeof e.length;return t?d.call(e):[e]}function o(e,t,r){if(!(this instanceof o))return new o(e,t,r);var s=e;return"string"==typeof e&&(s=document.querySelectorAll(e)),s?(this.elements=n(s),this.options=i({},this.options),"function"==typeof t?r=t:i(this.options,t),r&&this.on("always",r),this.getImages(),h&&(this.jqDeferred=new h.Deferred),void setTimeout(this.check.bind(this))):void a.error("Bad element for imagesLoaded "+(s||e))}function r(e){this.img=e}function s(e,t){this.url=e,this.element=t,this.img=new Image}var h=e.jQuery,a=e.console,d=Array.prototype.slice;o.prototype=Object.create(t.prototype),o.prototype.options={},o.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},o.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),this.options.background===!0&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&u[t]){for(var i=e.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background){var r=e.querySelectorAll(this.options.background);for(n=0;n<r.length;n++){var s=r[n];this.addElementBackgroundImages(s)}}}};var u={1:!0,9:!0,11:!0};return o.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},o.prototype.addImage=function(e){var t=new r(e);this.images.push(t)},o.prototype.addBackground=function(e,t){var i=new s(e,t);this.images.push(i)},o.prototype.check=function(){function e(e,i,n){setTimeout(function(){t.progress(e,i,n)})}var t=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(t){t.once("progress",e),t.check()}):void this.complete()},o.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&a&&a.log("progress: "+i,e,t)},o.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred){var t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},r.prototype=Object.create(t.prototype),r.prototype.check=function(){var e=this.getIsImageComplete();return e?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},r.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},r.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},r.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},r.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},r.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},r.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype=Object.create(r.prototype),s.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url;var e=this.getIsImageComplete();e&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},s.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},s.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.element,t])},o.makeJQueryPlugin=function(t){t=t||e.jQuery,t&&(h=t,h.fn.imagesLoaded=function(e,t){var i=new o(this,e,t);return i.jqDeferred.promise(h(this))})},o.makeJQueryPlugin(),o});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/vendor/isotope/isotope.pkgd.js
DELETED
@@ -1,3563 +0,0 @@
|
|
1 |
-
/*!
|
2 |
-
* Isotope PACKAGED v3.0.6
|
3 |
-
*
|
4 |
-
* Licensed GPLv3 for open source use
|
5 |
-
* or Isotope Commercial License for commercial use
|
6 |
-
*
|
7 |
-
* https://isotope.metafizzy.co
|
8 |
-
* Copyright 2010-2018 Metafizzy
|
9 |
-
*/
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Bridget makes jQuery widgets
|
13 |
-
* v2.0.1
|
14 |
-
* MIT license
|
15 |
-
*/
|
16 |
-
|
17 |
-
/* jshint browser: true, strict: true, undef: true, unused: true */
|
18 |
-
|
19 |
-
( function( window, factory ) {
|
20 |
-
// universal module definition
|
21 |
-
/*jshint strict: false */ /* globals define, module, require */
|
22 |
-
if ( typeof define == 'function' && define.amd ) {
|
23 |
-
// AMD
|
24 |
-
define( 'jquery-bridget/jquery-bridget',[ 'jquery' ], function( jQuery ) {
|
25 |
-
return factory( window, jQuery );
|
26 |
-
});
|
27 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
28 |
-
// CommonJS
|
29 |
-
module.exports = factory(
|
30 |
-
window,
|
31 |
-
require('jquery')
|
32 |
-
);
|
33 |
-
} else {
|
34 |
-
// browser global
|
35 |
-
window.jQueryBridget = factory(
|
36 |
-
window,
|
37 |
-
window.jQuery
|
38 |
-
);
|
39 |
-
}
|
40 |
-
|
41 |
-
}( window, function factory( window, jQuery ) {
|
42 |
-
'use strict';
|
43 |
-
|
44 |
-
// ----- utils ----- //
|
45 |
-
|
46 |
-
var arraySlice = Array.prototype.slice;
|
47 |
-
|
48 |
-
// helper function for logging errors
|
49 |
-
// $.error breaks jQuery chaining
|
50 |
-
var console = window.console;
|
51 |
-
var logError = typeof console == 'undefined' ? function() {} :
|
52 |
-
function( message ) {
|
53 |
-
console.error( message );
|
54 |
-
};
|
55 |
-
|
56 |
-
// ----- jQueryBridget ----- //
|
57 |
-
|
58 |
-
function jQueryBridget( namespace, PluginClass, $ ) {
|
59 |
-
$ = $ || jQuery || window.jQuery;
|
60 |
-
if ( !$ ) {
|
61 |
-
return;
|
62 |
-
}
|
63 |
-
|
64 |
-
// add option method -> $().plugin('option', {...})
|
65 |
-
if ( !PluginClass.prototype.option ) {
|
66 |
-
// option setter
|
67 |
-
PluginClass.prototype.option = function( opts ) {
|
68 |
-
// bail out if not an object
|
69 |
-
if ( !$.isPlainObject( opts ) ){
|
70 |
-
return;
|
71 |
-
}
|
72 |
-
this.options = $.extend( true, this.options, opts );
|
73 |
-
};
|
74 |
-
}
|
75 |
-
|
76 |
-
// make jQuery plugin
|
77 |
-
$.fn[ namespace ] = function( arg0 /*, arg1 */ ) {
|
78 |
-
if ( typeof arg0 == 'string' ) {
|
79 |
-
// method call $().plugin( 'methodName', { options } )
|
80 |
-
// shift arguments by 1
|
81 |
-
var args = arraySlice.call( arguments, 1 );
|
82 |
-
return methodCall( this, arg0, args );
|
83 |
-
}
|
84 |
-
// just $().plugin({ options })
|
85 |
-
plainCall( this, arg0 );
|
86 |
-
return this;
|
87 |
-
};
|
88 |
-
|
89 |
-
// $().plugin('methodName')
|
90 |
-
function methodCall( $elems, methodName, args ) {
|
91 |
-
var returnValue;
|
92 |
-
var pluginMethodStr = '$().' + namespace + '("' + methodName + '")';
|
93 |
-
|
94 |
-
$elems.each( function( i, elem ) {
|
95 |
-
// get instance
|
96 |
-
var instance = $.data( elem, namespace );
|
97 |
-
if ( !instance ) {
|
98 |
-
logError( namespace + ' not initialized. Cannot call methods, i.e. ' +
|
99 |
-
pluginMethodStr );
|
100 |
-
return;
|
101 |
-
}
|
102 |
-
|
103 |
-
var method = instance[ methodName ];
|
104 |
-
if ( !method || methodName.charAt(0) == '_' ) {
|
105 |
-
logError( pluginMethodStr + ' is not a valid method' );
|
106 |
-
return;
|
107 |
-
}
|
108 |
-
|
109 |
-
// apply method, get return value
|
110 |
-
var value = method.apply( instance, args );
|
111 |
-
// set return value if value is returned, use only first value
|
112 |
-
returnValue = returnValue === undefined ? value : returnValue;
|
113 |
-
});
|
114 |
-
|
115 |
-
return returnValue !== undefined ? returnValue : $elems;
|
116 |
-
}
|
117 |
-
|
118 |
-
function plainCall( $elems, options ) {
|
119 |
-
$elems.each( function( i, elem ) {
|
120 |
-
var instance = $.data( elem, namespace );
|
121 |
-
if ( instance ) {
|
122 |
-
// set options & init
|
123 |
-
instance.option( options );
|
124 |
-
instance._init();
|
125 |
-
} else {
|
126 |
-
// initialize new instance
|
127 |
-
instance = new PluginClass( elem, options );
|
128 |
-
$.data( elem, namespace, instance );
|
129 |
-
}
|
130 |
-
});
|
131 |
-
}
|
132 |
-
|
133 |
-
updateJQuery( $ );
|
134 |
-
|
135 |
-
}
|
136 |
-
|
137 |
-
// ----- updateJQuery ----- //
|
138 |
-
|
139 |
-
// set $.bridget for v1 backwards compatibility
|
140 |
-
function updateJQuery( $ ) {
|
141 |
-
if ( !$ || ( $ && $.bridget ) ) {
|
142 |
-
return;
|
143 |
-
}
|
144 |
-
$.bridget = jQueryBridget;
|
145 |
-
}
|
146 |
-
|
147 |
-
updateJQuery( jQuery || window.jQuery );
|
148 |
-
|
149 |
-
// ----- ----- //
|
150 |
-
|
151 |
-
return jQueryBridget;
|
152 |
-
|
153 |
-
}));
|
154 |
-
|
155 |
-
/**
|
156 |
-
* EvEmitter v1.1.0
|
157 |
-
* Lil' event emitter
|
158 |
-
* MIT License
|
159 |
-
*/
|
160 |
-
|
161 |
-
/* jshint unused: true, undef: true, strict: true */
|
162 |
-
|
163 |
-
( function( global, factory ) {
|
164 |
-
// universal module definition
|
165 |
-
/* jshint strict: false */ /* globals define, module, window */
|
166 |
-
if ( typeof define == 'function' && define.amd ) {
|
167 |
-
// AMD - RequireJS
|
168 |
-
define( 'ev-emitter/ev-emitter',factory );
|
169 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
170 |
-
// CommonJS - Browserify, Webpack
|
171 |
-
module.exports = factory();
|
172 |
-
} else {
|
173 |
-
// Browser globals
|
174 |
-
global.EvEmitter = factory();
|
175 |
-
}
|
176 |
-
|
177 |
-
}( typeof window != 'undefined' ? window : this, function() {
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
function EvEmitter() {}
|
182 |
-
|
183 |
-
var proto = EvEmitter.prototype;
|
184 |
-
|
185 |
-
proto.on = function( eventName, listener ) {
|
186 |
-
if ( !eventName || !listener ) {
|
187 |
-
return;
|
188 |
-
}
|
189 |
-
// set events hash
|
190 |
-
var events = this._events = this._events || {};
|
191 |
-
// set listeners array
|
192 |
-
var listeners = events[ eventName ] = events[ eventName ] || [];
|
193 |
-
// only add once
|
194 |
-
if ( listeners.indexOf( listener ) == -1 ) {
|
195 |
-
listeners.push( listener );
|
196 |
-
}
|
197 |
-
|
198 |
-
return this;
|
199 |
-
};
|
200 |
-
|
201 |
-
proto.once = function( eventName, listener ) {
|
202 |
-
if ( !eventName || !listener ) {
|
203 |
-
return;
|
204 |
-
}
|
205 |
-
// add event
|
206 |
-
this.on( eventName, listener );
|
207 |
-
// set once flag
|
208 |
-
// set onceEvents hash
|
209 |
-
var onceEvents = this._onceEvents = this._onceEvents || {};
|
210 |
-
// set onceListeners object
|
211 |
-
var onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};
|
212 |
-
// set flag
|
213 |
-
onceListeners[ listener ] = true;
|
214 |
-
|
215 |
-
return this;
|
216 |
-
};
|
217 |
-
|
218 |
-
proto.off = function( eventName, listener ) {
|
219 |
-
var listeners = this._events && this._events[ eventName ];
|
220 |
-
if ( !listeners || !listeners.length ) {
|
221 |
-
return;
|
222 |
-
}
|
223 |
-
var index = listeners.indexOf( listener );
|
224 |
-
if ( index != -1 ) {
|
225 |
-
listeners.splice( index, 1 );
|
226 |
-
}
|
227 |
-
|
228 |
-
return this;
|
229 |
-
};
|
230 |
-
|
231 |
-
proto.emitEvent = function( eventName, args ) {
|
232 |
-
var listeners = this._events && this._events[ eventName ];
|
233 |
-
if ( !listeners || !listeners.length ) {
|
234 |
-
return;
|
235 |
-
}
|
236 |
-
// copy over to avoid interference if .off() in listener
|
237 |
-
listeners = listeners.slice(0);
|
238 |
-
args = args || [];
|
239 |
-
// once stuff
|
240 |
-
var onceListeners = this._onceEvents && this._onceEvents[ eventName ];
|
241 |
-
|
242 |
-
for ( var i=0; i < listeners.length; i++ ) {
|
243 |
-
var listener = listeners[i]
|
244 |
-
var isOnce = onceListeners && onceListeners[ listener ];
|
245 |
-
if ( isOnce ) {
|
246 |
-
// remove listener
|
247 |
-
// remove before trigger to prevent recursion
|
248 |
-
this.off( eventName, listener );
|
249 |
-
// unset once flag
|
250 |
-
delete onceListeners[ listener ];
|
251 |
-
}
|
252 |
-
// trigger listener
|
253 |
-
listener.apply( this, args );
|
254 |
-
}
|
255 |
-
|
256 |
-
return this;
|
257 |
-
};
|
258 |
-
|
259 |
-
proto.allOff = function() {
|
260 |
-
delete this._events;
|
261 |
-
delete this._onceEvents;
|
262 |
-
};
|
263 |
-
|
264 |
-
return EvEmitter;
|
265 |
-
|
266 |
-
}));
|
267 |
-
|
268 |
-
/*!
|
269 |
-
* getSize v2.0.3
|
270 |
-
* measure size of elements
|
271 |
-
* MIT license
|
272 |
-
*/
|
273 |
-
|
274 |
-
/* jshint browser: true, strict: true, undef: true, unused: true */
|
275 |
-
/* globals console: false */
|
276 |
-
|
277 |
-
( function( window, factory ) {
|
278 |
-
/* jshint strict: false */ /* globals define, module */
|
279 |
-
if ( typeof define == 'function' && define.amd ) {
|
280 |
-
// AMD
|
281 |
-
define( 'get-size/get-size',factory );
|
282 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
283 |
-
// CommonJS
|
284 |
-
module.exports = factory();
|
285 |
-
} else {
|
286 |
-
// browser global
|
287 |
-
window.getSize = factory();
|
288 |
-
}
|
289 |
-
|
290 |
-
})( window, function factory() {
|
291 |
-
'use strict';
|
292 |
-
|
293 |
-
// -------------------------- helpers -------------------------- //
|
294 |
-
|
295 |
-
// get a number from a string, not a percentage
|
296 |
-
function getStyleSize( value ) {
|
297 |
-
var num = parseFloat( value );
|
298 |
-
// not a percent like '100%', and a number
|
299 |
-
var isValid = value.indexOf('%') == -1 && !isNaN( num );
|
300 |
-
return isValid && num;
|
301 |
-
}
|
302 |
-
|
303 |
-
function noop() {}
|
304 |
-
|
305 |
-
var logError = typeof console == 'undefined' ? noop :
|
306 |
-
function( message ) {
|
307 |
-
console.error( message );
|
308 |
-
};
|
309 |
-
|
310 |
-
// -------------------------- measurements -------------------------- //
|
311 |
-
|
312 |
-
var measurements = [
|
313 |
-
'paddingLeft',
|
314 |
-
'paddingRight',
|
315 |
-
'paddingTop',
|
316 |
-
'paddingBottom',
|
317 |
-
'marginLeft',
|
318 |
-
'marginRight',
|
319 |
-
'marginTop',
|
320 |
-
'marginBottom',
|
321 |
-
'borderLeftWidth',
|
322 |
-
'borderRightWidth',
|
323 |
-
'borderTopWidth',
|
324 |
-
'borderBottomWidth'
|
325 |
-
];
|
326 |
-
|
327 |
-
var measurementsLength = measurements.length;
|
328 |
-
|
329 |
-
function getZeroSize() {
|
330 |
-
var size = {
|
331 |
-
width: 0,
|
332 |
-
height: 0,
|
333 |
-
innerWidth: 0,
|
334 |
-
innerHeight: 0,
|
335 |
-
outerWidth: 0,
|
336 |
-
outerHeight: 0
|
337 |
-
};
|
338 |
-
for ( var i=0; i < measurementsLength; i++ ) {
|
339 |
-
var measurement = measurements[i];
|
340 |
-
size[ measurement ] = 0;
|
341 |
-
}
|
342 |
-
return size;
|
343 |
-
}
|
344 |
-
|
345 |
-
// -------------------------- getStyle -------------------------- //
|
346 |
-
|
347 |
-
/**
|
348 |
-
* getStyle, get style of element, check for Firefox bug
|
349 |
-
* https://bugzilla.mozilla.org/show_bug.cgi?id=548397
|
350 |
-
*/
|
351 |
-
function getStyle( elem ) {
|
352 |
-
var style = getComputedStyle( elem );
|
353 |
-
if ( !style ) {
|
354 |
-
logError( 'Style returned ' + style +
|
355 |
-
'. Are you running this code in a hidden iframe on Firefox? ' +
|
356 |
-
'See https://bit.ly/getsizebug1' );
|
357 |
-
}
|
358 |
-
return style;
|
359 |
-
}
|
360 |
-
|
361 |
-
// -------------------------- setup -------------------------- //
|
362 |
-
|
363 |
-
var isSetup = false;
|
364 |
-
|
365 |
-
var isBoxSizeOuter;
|
366 |
-
|
367 |
-
/**
|
368 |
-
* setup
|
369 |
-
* check isBoxSizerOuter
|
370 |
-
* do on first getSize() rather than on page load for Firefox bug
|
371 |
-
*/
|
372 |
-
function setup() {
|
373 |
-
// setup once
|
374 |
-
if ( isSetup ) {
|
375 |
-
return;
|
376 |
-
}
|
377 |
-
isSetup = true;
|
378 |
-
|
379 |
-
// -------------------------- box sizing -------------------------- //
|
380 |
-
|
381 |
-
/**
|
382 |
-
* Chrome & Safari measure the outer-width on style.width on border-box elems
|
383 |
-
* IE11 & Firefox<29 measures the inner-width
|
384 |
-
*/
|
385 |
-
var div = document.createElement('div');
|
386 |
-
div.style.width = '200px';
|
387 |
-
div.style.padding = '1px 2px 3px 4px';
|
388 |
-
div.style.borderStyle = 'solid';
|
389 |
-
div.style.borderWidth = '1px 2px 3px 4px';
|
390 |
-
div.style.boxSizing = 'border-box';
|
391 |
-
|
392 |
-
var body = document.body || document.documentElement;
|
393 |
-
body.appendChild( div );
|
394 |
-
var style = getStyle( div );
|
395 |
-
// round value for browser zoom. desandro/masonry#928
|
396 |
-
isBoxSizeOuter = Math.round( getStyleSize( style.width ) ) == 200;
|
397 |
-
getSize.isBoxSizeOuter = isBoxSizeOuter;
|
398 |
-
|
399 |
-
body.removeChild( div );
|
400 |
-
}
|
401 |
-
|
402 |
-
// -------------------------- getSize -------------------------- //
|
403 |
-
|
404 |
-
function getSize( elem ) {
|
405 |
-
setup();
|
406 |
-
|
407 |
-
// use querySeletor if elem is string
|
408 |
-
if ( typeof elem == 'string' ) {
|
409 |
-
elem = document.querySelector( elem );
|
410 |
-
}
|
411 |
-
|
412 |
-
// do not proceed on non-objects
|
413 |
-
if ( !elem || typeof elem != 'object' || !elem.nodeType ) {
|
414 |
-
return;
|
415 |
-
}
|
416 |
-
|
417 |
-
var style = getStyle( elem );
|
418 |
-
|
419 |
-
// if hidden, everything is 0
|
420 |
-
if ( style.display == 'none' ) {
|
421 |
-
return getZeroSize();
|
422 |
-
}
|
423 |
-
|
424 |
-
var size = {};
|
425 |
-
size.width = elem.offsetWidth;
|
426 |
-
size.height = elem.offsetHeight;
|
427 |
-
|
428 |
-
var isBorderBox = size.isBorderBox = style.boxSizing == 'border-box';
|
429 |
-
|
430 |
-
// get all measurements
|
431 |
-
for ( var i=0; i < measurementsLength; i++ ) {
|
432 |
-
var measurement = measurements[i];
|
433 |
-
var value = style[ measurement ];
|
434 |
-
var num = parseFloat( value );
|
435 |
-
// any 'auto', 'medium' value will be 0
|
436 |
-
size[ measurement ] = !isNaN( num ) ? num : 0;
|
437 |
-
}
|
438 |
-
|
439 |
-
var paddingWidth = size.paddingLeft + size.paddingRight;
|
440 |
-
var paddingHeight = size.paddingTop + size.paddingBottom;
|
441 |
-
var marginWidth = size.marginLeft + size.marginRight;
|
442 |
-
var marginHeight = size.marginTop + size.marginBottom;
|
443 |
-
var borderWidth = size.borderLeftWidth + size.borderRightWidth;
|
444 |
-
var borderHeight = size.borderTopWidth + size.borderBottomWidth;
|
445 |
-
|
446 |
-
var isBorderBoxSizeOuter = isBorderBox && isBoxSizeOuter;
|
447 |
-
|
448 |
-
// overwrite width and height if we can get it from style
|
449 |
-
var styleWidth = getStyleSize( style.width );
|
450 |
-
if ( styleWidth !== false ) {
|
451 |
-
size.width = styleWidth +
|
452 |
-
// add padding and border unless it's already including it
|
453 |
-
( isBorderBoxSizeOuter ? 0 : paddingWidth + borderWidth );
|
454 |
-
}
|
455 |
-
|
456 |
-
var styleHeight = getStyleSize( style.height );
|
457 |
-
if ( styleHeight !== false ) {
|
458 |
-
size.height = styleHeight +
|
459 |
-
// add padding and border unless it's already including it
|
460 |
-
( isBorderBoxSizeOuter ? 0 : paddingHeight + borderHeight );
|
461 |
-
}
|
462 |
-
|
463 |
-
size.innerWidth = size.width - ( paddingWidth + borderWidth );
|
464 |
-
size.innerHeight = size.height - ( paddingHeight + borderHeight );
|
465 |
-
|
466 |
-
size.outerWidth = size.width + marginWidth;
|
467 |
-
size.outerHeight = size.height + marginHeight;
|
468 |
-
|
469 |
-
return size;
|
470 |
-
}
|
471 |
-
|
472 |
-
return getSize;
|
473 |
-
|
474 |
-
});
|
475 |
-
|
476 |
-
/**
|
477 |
-
* matchesSelector v2.0.2
|
478 |
-
* matchesSelector( element, '.selector' )
|
479 |
-
* MIT license
|
480 |
-
*/
|
481 |
-
|
482 |
-
/*jshint browser: true, strict: true, undef: true, unused: true */
|
483 |
-
|
484 |
-
( function( window, factory ) {
|
485 |
-
/*global define: false, module: false */
|
486 |
-
'use strict';
|
487 |
-
// universal module definition
|
488 |
-
if ( typeof define == 'function' && define.amd ) {
|
489 |
-
// AMD
|
490 |
-
define( 'desandro-matches-selector/matches-selector',factory );
|
491 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
492 |
-
// CommonJS
|
493 |
-
module.exports = factory();
|
494 |
-
} else {
|
495 |
-
// browser global
|
496 |
-
window.matchesSelector = factory();
|
497 |
-
}
|
498 |
-
|
499 |
-
}( window, function factory() {
|
500 |
-
'use strict';
|
501 |
-
|
502 |
-
var matchesMethod = ( function() {
|
503 |
-
var ElemProto = window.Element.prototype;
|
504 |
-
// check for the standard method name first
|
505 |
-
if ( ElemProto.matches ) {
|
506 |
-
return 'matches';
|
507 |
-
}
|
508 |
-
// check un-prefixed
|
509 |
-
if ( ElemProto.matchesSelector ) {
|
510 |
-
return 'matchesSelector';
|
511 |
-
}
|
512 |
-
// check vendor prefixes
|
513 |
-
var prefixes = [ 'webkit', 'moz', 'ms', 'o' ];
|
514 |
-
|
515 |
-
for ( var i=0; i < prefixes.length; i++ ) {
|
516 |
-
var prefix = prefixes[i];
|
517 |
-
var method = prefix + 'MatchesSelector';
|
518 |
-
if ( ElemProto[ method ] ) {
|
519 |
-
return method;
|
520 |
-
}
|
521 |
-
}
|
522 |
-
})();
|
523 |
-
|
524 |
-
return function matchesSelector( elem, selector ) {
|
525 |
-
return elem[ matchesMethod ]( selector );
|
526 |
-
};
|
527 |
-
|
528 |
-
}));
|
529 |
-
|
530 |
-
/**
|
531 |
-
* Fizzy UI utils v2.0.7
|
532 |
-
* MIT license
|
533 |
-
*/
|
534 |
-
|
535 |
-
/*jshint browser: true, undef: true, unused: true, strict: true */
|
536 |
-
|
537 |
-
( function( window, factory ) {
|
538 |
-
// universal module definition
|
539 |
-
/*jshint strict: false */ /*globals define, module, require */
|
540 |
-
|
541 |
-
if ( typeof define == 'function' && define.amd ) {
|
542 |
-
// AMD
|
543 |
-
define( 'fizzy-ui-utils/utils',[
|
544 |
-
'desandro-matches-selector/matches-selector'
|
545 |
-
], function( matchesSelector ) {
|
546 |
-
return factory( window, matchesSelector );
|
547 |
-
});
|
548 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
549 |
-
// CommonJS
|
550 |
-
module.exports = factory(
|
551 |
-
window,
|
552 |
-
require('desandro-matches-selector')
|
553 |
-
);
|
554 |
-
} else {
|
555 |
-
// browser global
|
556 |
-
window.fizzyUIUtils = factory(
|
557 |
-
window,
|
558 |
-
window.matchesSelector
|
559 |
-
);
|
560 |
-
}
|
561 |
-
|
562 |
-
}( window, function factory( window, matchesSelector ) {
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
var utils = {};
|
567 |
-
|
568 |
-
// ----- extend ----- //
|
569 |
-
|
570 |
-
// extends objects
|
571 |
-
utils.extend = function( a, b ) {
|
572 |
-
for ( var prop in b ) {
|
573 |
-
a[ prop ] = b[ prop ];
|
574 |
-
}
|
575 |
-
return a;
|
576 |
-
};
|
577 |
-
|
578 |
-
// ----- modulo ----- //
|
579 |
-
|
580 |
-
utils.modulo = function( num, div ) {
|
581 |
-
return ( ( num % div ) + div ) % div;
|
582 |
-
};
|
583 |
-
|
584 |
-
// ----- makeArray ----- //
|
585 |
-
|
586 |
-
var arraySlice = Array.prototype.slice;
|
587 |
-
|
588 |
-
// turn element or nodeList into an array
|
589 |
-
utils.makeArray = function( obj ) {
|
590 |
-
if ( Array.isArray( obj ) ) {
|
591 |
-
// use object if already an array
|
592 |
-
return obj;
|
593 |
-
}
|
594 |
-
// return empty array if undefined or null. #6
|
595 |
-
if ( obj === null || obj === undefined ) {
|
596 |
-
return [];
|
597 |
-
}
|
598 |
-
|
599 |
-
var isArrayLike = typeof obj == 'object' && typeof obj.length == 'number';
|
600 |
-
if ( isArrayLike ) {
|
601 |
-
// convert nodeList to array
|
602 |
-
return arraySlice.call( obj );
|
603 |
-
}
|
604 |
-
|
605 |
-
// array of single index
|
606 |
-
return [ obj ];
|
607 |
-
};
|
608 |
-
|
609 |
-
// ----- removeFrom ----- //
|
610 |
-
|
611 |
-
utils.removeFrom = function( ary, obj ) {
|
612 |
-
var index = ary.indexOf( obj );
|
613 |
-
if ( index != -1 ) {
|
614 |
-
ary.splice( index, 1 );
|
615 |
-
}
|
616 |
-
};
|
617 |
-
|
618 |
-
// ----- getParent ----- //
|
619 |
-
|
620 |
-
utils.getParent = function( elem, selector ) {
|
621 |
-
while ( elem.parentNode && elem != document.body ) {
|
622 |
-
elem = elem.parentNode;
|
623 |
-
if ( matchesSelector( elem, selector ) ) {
|
624 |
-
return elem;
|
625 |
-
}
|
626 |
-
}
|
627 |
-
};
|
628 |
-
|
629 |
-
// ----- getQueryElement ----- //
|
630 |
-
|
631 |
-
// use element as selector string
|
632 |
-
utils.getQueryElement = function( elem ) {
|
633 |
-
if ( typeof elem == 'string' ) {
|
634 |
-
return document.querySelector( elem );
|
635 |
-
}
|
636 |
-
return elem;
|
637 |
-
};
|
638 |
-
|
639 |
-
// ----- handleEvent ----- //
|
640 |
-
|
641 |
-
// enable .ontype to trigger from .addEventListener( elem, 'type' )
|
642 |
-
utils.handleEvent = function( event ) {
|
643 |
-
var method = 'on' + event.type;
|
644 |
-
if ( this[ method ] ) {
|
645 |
-
this[ method ]( event );
|
646 |
-
}
|
647 |
-
};
|
648 |
-
|
649 |
-
// ----- filterFindElements ----- //
|
650 |
-
|
651 |
-
utils.filterFindElements = function( elems, selector ) {
|
652 |
-
// make array of elems
|
653 |
-
elems = utils.makeArray( elems );
|
654 |
-
var ffElems = [];
|
655 |
-
|
656 |
-
elems.forEach( function( elem ) {
|
657 |
-
// check that elem is an actual element
|
658 |
-
if ( !( elem instanceof HTMLElement ) ) {
|
659 |
-
return;
|
660 |
-
}
|
661 |
-
// add elem if no selector
|
662 |
-
if ( !selector ) {
|
663 |
-
ffElems.push( elem );
|
664 |
-
return;
|
665 |
-
}
|
666 |
-
// filter & find items if we have a selector
|
667 |
-
// filter
|
668 |
-
if ( matchesSelector( elem, selector ) ) {
|
669 |
-
ffElems.push( elem );
|
670 |
-
}
|
671 |
-
// find children
|
672 |
-
var childElems = elem.querySelectorAll( selector );
|
673 |
-
// concat childElems to filterFound array
|
674 |
-
for ( var i=0; i < childElems.length; i++ ) {
|
675 |
-
ffElems.push( childElems[i] );
|
676 |
-
}
|
677 |
-
});
|
678 |
-
|
679 |
-
return ffElems;
|
680 |
-
};
|
681 |
-
|
682 |
-
// ----- debounceMethod ----- //
|
683 |
-
|
684 |
-
utils.debounceMethod = function( _class, methodName, threshold ) {
|
685 |
-
threshold = threshold || 100;
|
686 |
-
// original method
|
687 |
-
var method = _class.prototype[ methodName ];
|
688 |
-
var timeoutName = methodName + 'Timeout';
|
689 |
-
|
690 |
-
_class.prototype[ methodName ] = function() {
|
691 |
-
var timeout = this[ timeoutName ];
|
692 |
-
clearTimeout( timeout );
|
693 |
-
|
694 |
-
var args = arguments;
|
695 |
-
var _this = this;
|
696 |
-
this[ timeoutName ] = setTimeout( function() {
|
697 |
-
method.apply( _this, args );
|
698 |
-
delete _this[ timeoutName ];
|
699 |
-
}, threshold );
|
700 |
-
};
|
701 |
-
};
|
702 |
-
|
703 |
-
// ----- docReady ----- //
|
704 |
-
|
705 |
-
utils.docReady = function( callback ) {
|
706 |
-
var readyState = document.readyState;
|
707 |
-
if ( readyState == 'complete' || readyState == 'interactive' ) {
|
708 |
-
// do async to allow for other scripts to run. metafizzy/flickity#441
|
709 |
-
setTimeout( callback );
|
710 |
-
} else {
|
711 |
-
document.addEventListener( 'DOMContentLoaded', callback );
|
712 |
-
}
|
713 |
-
};
|
714 |
-
|
715 |
-
// ----- htmlInit ----- //
|
716 |
-
|
717 |
-
// http://jamesroberts.name/blog/2010/02/22/string-functions-for-javascript-trim-to-camel-case-to-dashed-and-to-underscore/
|
718 |
-
utils.toDashed = function( str ) {
|
719 |
-
return str.replace( /(.)([A-Z])/g, function( match, $1, $2 ) {
|
720 |
-
return $1 + '-' + $2;
|
721 |
-
}).toLowerCase();
|
722 |
-
};
|
723 |
-
|
724 |
-
var console = window.console;
|
725 |
-
/**
|
726 |
-
* allow user to initialize classes via [data-namespace] or .js-namespace class
|
727 |
-
* htmlInit( Widget, 'widgetName' )
|
728 |
-
* options are parsed from data-namespace-options
|
729 |
-
*/
|
730 |
-
utils.htmlInit = function( WidgetClass, namespace ) {
|
731 |
-
utils.docReady( function() {
|
732 |
-
var dashedNamespace = utils.toDashed( namespace );
|
733 |
-
var dataAttr = 'data-' + dashedNamespace;
|
734 |
-
var dataAttrElems = document.querySelectorAll( '[' + dataAttr + ']' );
|
735 |
-
var jsDashElems = document.querySelectorAll( '.js-' + dashedNamespace );
|
736 |
-
var elems = utils.makeArray( dataAttrElems )
|
737 |
-
.concat( utils.makeArray( jsDashElems ) );
|
738 |
-
var dataOptionsAttr = dataAttr + '-options';
|
739 |
-
var jQuery = window.jQuery;
|
740 |
-
|
741 |
-
elems.forEach( function( elem ) {
|
742 |
-
var attr = elem.getAttribute( dataAttr ) ||
|
743 |
-
elem.getAttribute( dataOptionsAttr );
|
744 |
-
var options;
|
745 |
-
try {
|
746 |
-
options = attr && JSON.parse( attr );
|
747 |
-
} catch ( error ) {
|
748 |
-
// log error, do not initialize
|
749 |
-
if ( console ) {
|
750 |
-
console.error( 'Error parsing ' + dataAttr + ' on ' + elem.className +
|
751 |
-
': ' + error );
|
752 |
-
}
|
753 |
-
return;
|
754 |
-
}
|
755 |
-
// initialize
|
756 |
-
var instance = new WidgetClass( elem, options );
|
757 |
-
// make available via $().data('namespace')
|
758 |
-
if ( jQuery ) {
|
759 |
-
jQuery.data( elem, namespace, instance );
|
760 |
-
}
|
761 |
-
});
|
762 |
-
|
763 |
-
});
|
764 |
-
};
|
765 |
-
|
766 |
-
// ----- ----- //
|
767 |
-
|
768 |
-
return utils;
|
769 |
-
|
770 |
-
}));
|
771 |
-
|
772 |
-
/**
|
773 |
-
* Outlayer Item
|
774 |
-
*/
|
775 |
-
|
776 |
-
( function( window, factory ) {
|
777 |
-
// universal module definition
|
778 |
-
/* jshint strict: false */ /* globals define, module, require */
|
779 |
-
if ( typeof define == 'function' && define.amd ) {
|
780 |
-
// AMD - RequireJS
|
781 |
-
define( 'outlayer/item',[
|
782 |
-
'ev-emitter/ev-emitter',
|
783 |
-
'get-size/get-size'
|
784 |
-
],
|
785 |
-
factory
|
786 |
-
);
|
787 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
788 |
-
// CommonJS - Browserify, Webpack
|
789 |
-
module.exports = factory(
|
790 |
-
require('ev-emitter'),
|
791 |
-
require('get-size')
|
792 |
-
);
|
793 |
-
} else {
|
794 |
-
// browser global
|
795 |
-
window.Outlayer = {};
|
796 |
-
window.Outlayer.Item = factory(
|
797 |
-
window.EvEmitter,
|
798 |
-
window.getSize
|
799 |
-
);
|
800 |
-
}
|
801 |
-
|
802 |
-
}( window, function factory( EvEmitter, getSize ) {
|
803 |
-
'use strict';
|
804 |
-
|
805 |
-
// ----- helpers ----- //
|
806 |
-
|
807 |
-
function isEmptyObj( obj ) {
|
808 |
-
for ( var prop in obj ) {
|
809 |
-
return false;
|
810 |
-
}
|
811 |
-
prop = null;
|
812 |
-
return true;
|
813 |
-
}
|
814 |
-
|
815 |
-
// -------------------------- CSS3 support -------------------------- //
|
816 |
-
|
817 |
-
|
818 |
-
var docElemStyle = document.documentElement.style;
|
819 |
-
|
820 |
-
var transitionProperty = typeof docElemStyle.transition == 'string' ?
|
821 |
-
'transition' : 'WebkitTransition';
|
822 |
-
var transformProperty = typeof docElemStyle.transform == 'string' ?
|
823 |
-
'transform' : 'WebkitTransform';
|
824 |
-
|
825 |
-
var transitionEndEvent = {
|
826 |
-
WebkitTransition: 'webkitTransitionEnd',
|
827 |
-
transition: 'transitionend'
|
828 |
-
}[ transitionProperty ];
|
829 |
-
|
830 |
-
// cache all vendor properties that could have vendor prefix
|
831 |
-
var vendorProperties = {
|
832 |
-
transform: transformProperty,
|
833 |
-
transition: transitionProperty,
|
834 |
-
transitionDuration: transitionProperty + 'Duration',
|
835 |
-
transitionProperty: transitionProperty + 'Property',
|
836 |
-
transitionDelay: transitionProperty + 'Delay'
|
837 |
-
};
|
838 |
-
|
839 |
-
// -------------------------- Item -------------------------- //
|
840 |
-
|
841 |
-
function Item( element, layout ) {
|
842 |
-
if ( !element ) {
|
843 |
-
return;
|
844 |
-
}
|
845 |
-
|
846 |
-
this.element = element;
|
847 |
-
// parent layout class, i.e. Masonry, Isotope, or Packery
|
848 |
-
this.layout = layout;
|
849 |
-
this.position = {
|
850 |
-
x: 0,
|
851 |
-
y: 0
|
852 |
-
};
|
853 |
-
|
854 |
-
this._create();
|
855 |
-
}
|
856 |
-
|
857 |
-
// inherit EvEmitter
|
858 |
-
var proto = Item.prototype = Object.create( EvEmitter.prototype );
|
859 |
-
proto.constructor = Item;
|
860 |
-
|
861 |
-
proto._create = function() {
|
862 |
-
// transition objects
|
863 |
-
this._transn = {
|
864 |
-
ingProperties: {},
|
865 |
-
clean: {},
|
866 |
-
onEnd: {}
|
867 |
-
};
|
868 |
-
|
869 |
-
this.css({
|
870 |
-
position: 'absolute'
|
871 |
-
});
|
872 |
-
};
|
873 |
-
|
874 |
-
// trigger specified handler for event type
|
875 |
-
proto.handleEvent = function( event ) {
|
876 |
-
var method = 'on' + event.type;
|
877 |
-
if ( this[ method ] ) {
|
878 |
-
this[ method ]( event );
|
879 |
-
}
|
880 |
-
};
|
881 |
-
|
882 |
-
proto.getSize = function() {
|
883 |
-
this.size = getSize( this.element );
|
884 |
-
};
|
885 |
-
|
886 |
-
/**
|
887 |
-
* apply CSS styles to element
|
888 |
-
* @param {Object} style
|
889 |
-
*/
|
890 |
-
proto.css = function( style ) {
|
891 |
-
var elemStyle = this.element.style;
|
892 |
-
|
893 |
-
for ( var prop in style ) {
|
894 |
-
// use vendor property if available
|
895 |
-
var supportedProp = vendorProperties[ prop ] || prop;
|
896 |
-
elemStyle[ supportedProp ] = style[ prop ];
|
897 |
-
}
|
898 |
-
};
|
899 |
-
|
900 |
-
// measure position, and sets it
|
901 |
-
proto.getPosition = function() {
|
902 |
-
var style = getComputedStyle( this.element );
|
903 |
-
var isOriginLeft = this.layout._getOption('originLeft');
|
904 |
-
var isOriginTop = this.layout._getOption('originTop');
|
905 |
-
var xValue = style[ isOriginLeft ? 'left' : 'right' ];
|
906 |
-
var yValue = style[ isOriginTop ? 'top' : 'bottom' ];
|
907 |
-
var x = parseFloat( xValue );
|
908 |
-
var y = parseFloat( yValue );
|
909 |
-
// convert percent to pixels
|
910 |
-
var layoutSize = this.layout.size;
|
911 |
-
if ( xValue.indexOf('%') != -1 ) {
|
912 |
-
x = ( x / 100 ) * layoutSize.width;
|
913 |
-
}
|
914 |
-
if ( yValue.indexOf('%') != -1 ) {
|
915 |
-
y = ( y / 100 ) * layoutSize.height;
|
916 |
-
}
|
917 |
-
// clean up 'auto' or other non-integer values
|
918 |
-
x = isNaN( x ) ? 0 : x;
|
919 |
-
y = isNaN( y ) ? 0 : y;
|
920 |
-
// remove padding from measurement
|
921 |
-
x -= isOriginLeft ? layoutSize.paddingLeft : layoutSize.paddingRight;
|
922 |
-
y -= isOriginTop ? layoutSize.paddingTop : layoutSize.paddingBottom;
|
923 |
-
|
924 |
-
this.position.x = x;
|
925 |
-
this.position.y = y;
|
926 |
-
};
|
927 |
-
|
928 |
-
// set settled position, apply padding
|
929 |
-
proto.layoutPosition = function() {
|
930 |
-
var layoutSize = this.layout.size;
|
931 |
-
var style = {};
|
932 |
-
var isOriginLeft = this.layout._getOption('originLeft');
|
933 |
-
var isOriginTop = this.layout._getOption('originTop');
|
934 |
-
|
935 |
-
// x
|
936 |
-
var xPadding = isOriginLeft ? 'paddingLeft' : 'paddingRight';
|
937 |
-
var xProperty = isOriginLeft ? 'left' : 'right';
|
938 |
-
var xResetProperty = isOriginLeft ? 'right' : 'left';
|
939 |
-
|
940 |
-
var x = this.position.x + layoutSize[ xPadding ];
|
941 |
-
// set in percentage or pixels
|
942 |
-
style[ xProperty ] = this.getXValue( x );
|
943 |
-
// reset other property
|
944 |
-
style[ xResetProperty ] = '';
|
945 |
-
|
946 |
-
// y
|
947 |
-
var yPadding = isOriginTop ? 'paddingTop' : 'paddingBottom';
|
948 |
-
var yProperty = isOriginTop ? 'top' : 'bottom';
|
949 |
-
var yResetProperty = isOriginTop ? 'bottom' : 'top';
|
950 |
-
|
951 |
-
var y = this.position.y + layoutSize[ yPadding ];
|
952 |
-
// set in percentage or pixels
|
953 |
-
style[ yProperty ] = this.getYValue( y );
|
954 |
-
// reset other property
|
955 |
-
style[ yResetProperty ] = '';
|
956 |
-
|
957 |
-
this.css( style );
|
958 |
-
this.emitEvent( 'layout', [ this ] );
|
959 |
-
};
|
960 |
-
|
961 |
-
proto.getXValue = function( x ) {
|
962 |
-
var isHorizontal = this.layout._getOption('horizontal');
|
963 |
-
return this.layout.options.percentPosition && !isHorizontal ?
|
964 |
-
( ( x / this.layout.size.width ) * 100 ) + '%' : x + 'px';
|
965 |
-
};
|
966 |
-
|
967 |
-
proto.getYValue = function( y ) {
|
968 |
-
var isHorizontal = this.layout._getOption('horizontal');
|
969 |
-
return this.layout.options.percentPosition && isHorizontal ?
|
970 |
-
( ( y / this.layout.size.height ) * 100 ) + '%' : y + 'px';
|
971 |
-
};
|
972 |
-
|
973 |
-
proto._transitionTo = function( x, y ) {
|
974 |
-
this.getPosition();
|
975 |
-
// get current x & y from top/left
|
976 |
-
var curX = this.position.x;
|
977 |
-
var curY = this.position.y;
|
978 |
-
|
979 |
-
var didNotMove = x == this.position.x && y == this.position.y;
|
980 |
-
|
981 |
-
// save end position
|
982 |
-
this.setPosition( x, y );
|
983 |
-
|
984 |
-
// if did not move and not transitioning, just go to layout
|
985 |
-
if ( didNotMove && !this.isTransitioning ) {
|
986 |
-
this.layoutPosition();
|
987 |
-
return;
|
988 |
-
}
|
989 |
-
|
990 |
-
var transX = x - curX;
|
991 |
-
var transY = y - curY;
|
992 |
-
var transitionStyle = {};
|
993 |
-
transitionStyle.transform = this.getTranslate( transX, transY );
|
994 |
-
|
995 |
-
this.transition({
|
996 |
-
to: transitionStyle,
|
997 |
-
onTransitionEnd: {
|
998 |
-
transform: this.layoutPosition
|
999 |
-
},
|
1000 |
-
isCleaning: true
|
1001 |
-
});
|
1002 |
-
};
|
1003 |
-
|
1004 |
-
proto.getTranslate = function( x, y ) {
|
1005 |
-
// flip cooridinates if origin on right or bottom
|
1006 |
-
var isOriginLeft = this.layout._getOption('originLeft');
|
1007 |
-
var isOriginTop = this.layout._getOption('originTop');
|
1008 |
-
x = isOriginLeft ? x : -x;
|
1009 |
-
y = isOriginTop ? y : -y;
|
1010 |
-
return 'translate3d(' + x + 'px, ' + y + 'px, 0)';
|
1011 |
-
};
|
1012 |
-
|
1013 |
-
// non transition + transform support
|
1014 |
-
proto.goTo = function( x, y ) {
|
1015 |
-
this.setPosition( x, y );
|
1016 |
-
this.layoutPosition();
|
1017 |
-
};
|
1018 |
-
|
1019 |
-
proto.moveTo = proto._transitionTo;
|
1020 |
-
|
1021 |
-
proto.setPosition = function( x, y ) {
|
1022 |
-
this.position.x = parseFloat( x );
|
1023 |
-
this.position.y = parseFloat( y );
|
1024 |
-
};
|
1025 |
-
|
1026 |
-
// ----- transition ----- //
|
1027 |
-
|
1028 |
-
/**
|
1029 |
-
* @param {Object} style - CSS
|
1030 |
-
* @param {Function} onTransitionEnd
|
1031 |
-
*/
|
1032 |
-
|
1033 |
-
// non transition, just trigger callback
|
1034 |
-
proto._nonTransition = function( args ) {
|
1035 |
-
this.css( args.to );
|
1036 |
-
if ( args.isCleaning ) {
|
1037 |
-
this._removeStyles( args.to );
|
1038 |
-
}
|
1039 |
-
for ( var prop in args.onTransitionEnd ) {
|
1040 |
-
args.onTransitionEnd[ prop ].call( this );
|
1041 |
-
}
|
1042 |
-
};
|
1043 |
-
|
1044 |
-
/**
|
1045 |
-
* proper transition
|
1046 |
-
* @param {Object} args - arguments
|
1047 |
-
* @param {Object} to - style to transition to
|
1048 |
-
* @param {Object} from - style to start transition from
|
1049 |
-
* @param {Boolean} isCleaning - removes transition styles after transition
|
1050 |
-
* @param {Function} onTransitionEnd - callback
|
1051 |
-
*/
|
1052 |
-
proto.transition = function( args ) {
|
1053 |
-
// redirect to nonTransition if no transition duration
|
1054 |
-
if ( !parseFloat( this.layout.options.transitionDuration ) ) {
|
1055 |
-
this._nonTransition( args );
|
1056 |
-
return;
|
1057 |
-
}
|
1058 |
-
|
1059 |
-
var _transition = this._transn;
|
1060 |
-
// keep track of onTransitionEnd callback by css property
|
1061 |
-
for ( var prop in args.onTransitionEnd ) {
|
1062 |
-
_transition.onEnd[ prop ] = args.onTransitionEnd[ prop ];
|
1063 |
-
}
|
1064 |
-
// keep track of properties that are transitioning
|
1065 |
-
for ( prop in args.to ) {
|
1066 |
-
_transition.ingProperties[ prop ] = true;
|
1067 |
-
// keep track of properties to clean up when transition is done
|
1068 |
-
if ( args.isCleaning ) {
|
1069 |
-
_transition.clean[ prop ] = true;
|
1070 |
-
}
|
1071 |
-
}
|
1072 |
-
|
1073 |
-
// set from styles
|
1074 |
-
if ( args.from ) {
|
1075 |
-
this.css( args.from );
|
1076 |
-
// force redraw. http://blog.alexmaccaw.com/css-transitions
|
1077 |
-
var h = this.element.offsetHeight;
|
1078 |
-
// hack for JSHint to hush about unused var
|
1079 |
-
h = null;
|
1080 |
-
}
|
1081 |
-
// enable transition
|
1082 |
-
this.enableTransition( args.to );
|
1083 |
-
// set styles that are transitioning
|
1084 |
-
this.css( args.to );
|
1085 |
-
|
1086 |
-
this.isTransitioning = true;
|
1087 |
-
|
1088 |
-
};
|
1089 |
-
|
1090 |
-
// dash before all cap letters, including first for
|
1091 |
-
// WebkitTransform => -webkit-transform
|
1092 |
-
function toDashedAll( str ) {
|
1093 |
-
return str.replace( /([A-Z])/g, function( $1 ) {
|
1094 |
-
return '-' + $1.toLowerCase();
|
1095 |
-
});
|
1096 |
-
}
|
1097 |
-
|
1098 |
-
var transitionProps = 'opacity,' + toDashedAll( transformProperty );
|
1099 |
-
|
1100 |
-
proto.enableTransition = function(/* style */) {
|
1101 |
-
// HACK changing transitionProperty during a transition
|
1102 |
-
// will cause transition to jump
|
1103 |
-
if ( this.isTransitioning ) {
|
1104 |
-
return;
|
1105 |
-
}
|
1106 |
-
|
1107 |
-
// make `transition: foo, bar, baz` from style object
|
1108 |
-
// HACK un-comment this when enableTransition can work
|
1109 |
-
// while a transition is happening
|
1110 |
-
// var transitionValues = [];
|
1111 |
-
// for ( var prop in style ) {
|
1112 |
-
// // dash-ify camelCased properties like WebkitTransition
|
1113 |
-
// prop = vendorProperties[ prop ] || prop;
|
1114 |
-
// transitionValues.push( toDashedAll( prop ) );
|
1115 |
-
// }
|
1116 |
-
// munge number to millisecond, to match stagger
|
1117 |
-
var duration = this.layout.options.transitionDuration;
|
1118 |
-
duration = typeof duration == 'number' ? duration + 'ms' : duration;
|
1119 |
-
// enable transition styles
|
1120 |
-
this.css({
|
1121 |
-
transitionProperty: transitionProps,
|
1122 |
-
transitionDuration: duration,
|
1123 |
-
transitionDelay: this.staggerDelay || 0
|
1124 |
-
});
|
1125 |
-
// listen for transition end event
|
1126 |
-
this.element.addEventListener( transitionEndEvent, this, false );
|
1127 |
-
};
|
1128 |
-
|
1129 |
-
// ----- events ----- //
|
1130 |
-
|
1131 |
-
proto.onwebkitTransitionEnd = function( event ) {
|
1132 |
-
this.ontransitionend( event );
|
1133 |
-
};
|
1134 |
-
|
1135 |
-
proto.onotransitionend = function( event ) {
|
1136 |
-
this.ontransitionend( event );
|
1137 |
-
};
|
1138 |
-
|
1139 |
-
// properties that I munge to make my life easier
|
1140 |
-
var dashedVendorProperties = {
|
1141 |
-
'-webkit-transform': 'transform'
|
1142 |
-
};
|
1143 |
-
|
1144 |
-
proto.ontransitionend = function( event ) {
|
1145 |
-
// disregard bubbled events from children
|
1146 |
-
if ( event.target !== this.element ) {
|
1147 |
-
return;
|
1148 |
-
}
|
1149 |
-
var _transition = this._transn;
|
1150 |
-
// get property name of transitioned property, convert to prefix-free
|
1151 |
-
var propertyName = dashedVendorProperties[ event.propertyName ] || event.propertyName;
|
1152 |
-
|
1153 |
-
// remove property that has completed transitioning
|
1154 |
-
delete _transition.ingProperties[ propertyName ];
|
1155 |
-
// check if any properties are still transitioning
|
1156 |
-
if ( isEmptyObj( _transition.ingProperties ) ) {
|
1157 |
-
// all properties have completed transitioning
|
1158 |
-
this.disableTransition();
|
1159 |
-
}
|
1160 |
-
// clean style
|
1161 |
-
if ( propertyName in _transition.clean ) {
|
1162 |
-
// clean up style
|
1163 |
-
this.element.style[ event.propertyName ] = '';
|
1164 |
-
delete _transition.clean[ propertyName ];
|
1165 |
-
}
|
1166 |
-
// trigger onTransitionEnd callback
|
1167 |
-
if ( propertyName in _transition.onEnd ) {
|
1168 |
-
var onTransitionEnd = _transition.onEnd[ propertyName ];
|
1169 |
-
onTransitionEnd.call( this );
|
1170 |
-
delete _transition.onEnd[ propertyName ];
|
1171 |
-
}
|
1172 |
-
|
1173 |
-
this.emitEvent( 'transitionEnd', [ this ] );
|
1174 |
-
};
|
1175 |
-
|
1176 |
-
proto.disableTransition = function() {
|
1177 |
-
this.removeTransitionStyles();
|
1178 |
-
this.element.removeEventListener( transitionEndEvent, this, false );
|
1179 |
-
this.isTransitioning = false;
|
1180 |
-
};
|
1181 |
-
|
1182 |
-
/**
|
1183 |
-
* removes style property from element
|
1184 |
-
* @param {Object} style
|
1185 |
-
**/
|
1186 |
-
proto._removeStyles = function( style ) {
|
1187 |
-
// clean up transition styles
|
1188 |
-
var cleanStyle = {};
|
1189 |
-
for ( var prop in style ) {
|
1190 |
-
cleanStyle[ prop ] = '';
|
1191 |
-
}
|
1192 |
-
this.css( cleanStyle );
|
1193 |
-
};
|
1194 |
-
|
1195 |
-
var cleanTransitionStyle = {
|
1196 |
-
transitionProperty: '',
|
1197 |
-
transitionDuration: '',
|
1198 |
-
transitionDelay: ''
|
1199 |
-
};
|
1200 |
-
|
1201 |
-
proto.removeTransitionStyles = function() {
|
1202 |
-
// remove transition
|
1203 |
-
this.css( cleanTransitionStyle );
|
1204 |
-
};
|
1205 |
-
|
1206 |
-
// ----- stagger ----- //
|
1207 |
-
|
1208 |
-
proto.stagger = function( delay ) {
|
1209 |
-
delay = isNaN( delay ) ? 0 : delay;
|
1210 |
-
this.staggerDelay = delay + 'ms';
|
1211 |
-
};
|
1212 |
-
|
1213 |
-
// ----- show/hide/remove ----- //
|
1214 |
-
|
1215 |
-
// remove element from DOM
|
1216 |
-
proto.removeElem = function() {
|
1217 |
-
this.element.parentNode.removeChild( this.element );
|
1218 |
-
// remove display: none
|
1219 |
-
this.css({ display: '' });
|
1220 |
-
this.emitEvent( 'remove', [ this ] );
|
1221 |
-
};
|
1222 |
-
|
1223 |
-
proto.remove = function() {
|
1224 |
-
// just remove element if no transition support or no transition
|
1225 |
-
if ( !transitionProperty || !parseFloat( this.layout.options.transitionDuration ) ) {
|
1226 |
-
this.removeElem();
|
1227 |
-
return;
|
1228 |
-
}
|
1229 |
-
|
1230 |
-
// start transition
|
1231 |
-
this.once( 'transitionEnd', function() {
|
1232 |
-
this.removeElem();
|
1233 |
-
});
|
1234 |
-
this.hide();
|
1235 |
-
};
|
1236 |
-
|
1237 |
-
proto.reveal = function() {
|
1238 |
-
delete this.isHidden;
|
1239 |
-
// remove display: none
|
1240 |
-
this.css({ display: '' });
|
1241 |
-
|
1242 |
-
var options = this.layout.options;
|
1243 |
-
|
1244 |
-
var onTransitionEnd = {};
|
1245 |
-
var transitionEndProperty = this.getHideRevealTransitionEndProperty('visibleStyle');
|
1246 |
-
onTransitionEnd[ transitionEndProperty ] = this.onRevealTransitionEnd;
|
1247 |
-
|
1248 |
-
this.transition({
|
1249 |
-
from: options.hiddenStyle,
|
1250 |
-
to: options.visibleStyle,
|
1251 |
-
isCleaning: true,
|
1252 |
-
onTransitionEnd: onTransitionEnd
|
1253 |
-
});
|
1254 |
-
};
|
1255 |
-
|
1256 |
-
proto.onRevealTransitionEnd = function() {
|
1257 |
-
// check if still visible
|
1258 |
-
// during transition, item may have been hidden
|
1259 |
-
if ( !this.isHidden ) {
|
1260 |
-
this.emitEvent('reveal');
|
1261 |
-
}
|
1262 |
-
};
|
1263 |
-
|
1264 |
-
/**
|
1265 |
-
* get style property use for hide/reveal transition end
|
1266 |
-
* @param {String} styleProperty - hiddenStyle/visibleStyle
|
1267 |
-
* @returns {String}
|
1268 |
-
*/
|
1269 |
-
proto.getHideRevealTransitionEndProperty = function( styleProperty ) {
|
1270 |
-
var optionStyle = this.layout.options[ styleProperty ];
|
1271 |
-
// use opacity
|
1272 |
-
if ( optionStyle.opacity ) {
|
1273 |
-
return 'opacity';
|
1274 |
-
}
|
1275 |
-
// get first property
|
1276 |
-
for ( var prop in optionStyle ) {
|
1277 |
-
return prop;
|
1278 |
-
}
|
1279 |
-
};
|
1280 |
-
|
1281 |
-
proto.hide = function() {
|
1282 |
-
// set flag
|
1283 |
-
this.isHidden = true;
|
1284 |
-
// remove display: none
|
1285 |
-
this.css({ display: '' });
|
1286 |
-
|
1287 |
-
var options = this.layout.options;
|
1288 |
-
|
1289 |
-
var onTransitionEnd = {};
|
1290 |
-
var transitionEndProperty = this.getHideRevealTransitionEndProperty('hiddenStyle');
|
1291 |
-
onTransitionEnd[ transitionEndProperty ] = this.onHideTransitionEnd;
|
1292 |
-
|
1293 |
-
this.transition({
|
1294 |
-
from: options.visibleStyle,
|
1295 |
-
to: options.hiddenStyle,
|
1296 |
-
// keep hidden stuff hidden
|
1297 |
-
isCleaning: true,
|
1298 |
-
onTransitionEnd: onTransitionEnd
|
1299 |
-
});
|
1300 |
-
};
|
1301 |
-
|
1302 |
-
proto.onHideTransitionEnd = function() {
|
1303 |
-
// check if still hidden
|
1304 |
-
// during transition, item may have been un-hidden
|
1305 |
-
if ( this.isHidden ) {
|
1306 |
-
this.css({ display: 'none' });
|
1307 |
-
this.emitEvent('hide');
|
1308 |
-
}
|
1309 |
-
};
|
1310 |
-
|
1311 |
-
proto.destroy = function() {
|
1312 |
-
this.css({
|
1313 |
-
position: '',
|
1314 |
-
left: '',
|
1315 |
-
right: '',
|
1316 |
-
top: '',
|
1317 |
-
bottom: '',
|
1318 |
-
transition: '',
|
1319 |
-
transform: ''
|
1320 |
-
});
|
1321 |
-
};
|
1322 |
-
|
1323 |
-
return Item;
|
1324 |
-
|
1325 |
-
}));
|
1326 |
-
|
1327 |
-
/*!
|
1328 |
-
* Outlayer v2.1.1
|
1329 |
-
* the brains and guts of a layout library
|
1330 |
-
* MIT license
|
1331 |
-
*/
|
1332 |
-
|
1333 |
-
( function( window, factory ) {
|
1334 |
-
'use strict';
|
1335 |
-
// universal module definition
|
1336 |
-
/* jshint strict: false */ /* globals define, module, require */
|
1337 |
-
if ( typeof define == 'function' && define.amd ) {
|
1338 |
-
// AMD - RequireJS
|
1339 |
-
define( 'outlayer/outlayer',[
|
1340 |
-
'ev-emitter/ev-emitter',
|
1341 |
-
'get-size/get-size',
|
1342 |
-
'fizzy-ui-utils/utils',
|
1343 |
-
'./item'
|
1344 |
-
],
|
1345 |
-
function( EvEmitter, getSize, utils, Item ) {
|
1346 |
-
return factory( window, EvEmitter, getSize, utils, Item);
|
1347 |
-
}
|
1348 |
-
);
|
1349 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
1350 |
-
// CommonJS - Browserify, Webpack
|
1351 |
-
module.exports = factory(
|
1352 |
-
window,
|
1353 |
-
require('ev-emitter'),
|
1354 |
-
require('get-size'),
|
1355 |
-
require('fizzy-ui-utils'),
|
1356 |
-
require('./item')
|
1357 |
-
);
|
1358 |
-
} else {
|
1359 |
-
// browser global
|
1360 |
-
window.Outlayer = factory(
|
1361 |
-
window,
|
1362 |
-
window.EvEmitter,
|
1363 |
-
window.getSize,
|
1364 |
-
window.fizzyUIUtils,
|
1365 |
-
window.Outlayer.Item
|
1366 |
-
);
|
1367 |
-
}
|
1368 |
-
|
1369 |
-
}( window, function factory( window, EvEmitter, getSize, utils, Item ) {
|
1370 |
-
'use strict';
|
1371 |
-
|
1372 |
-
// ----- vars ----- //
|
1373 |
-
|
1374 |
-
var console = window.console;
|
1375 |
-
var jQuery = window.jQuery;
|
1376 |
-
var noop = function() {};
|
1377 |
-
|
1378 |
-
// -------------------------- Outlayer -------------------------- //
|
1379 |
-
|
1380 |
-
// globally unique identifiers
|
1381 |
-
var GUID = 0;
|
1382 |
-
// internal store of all Outlayer intances
|
1383 |
-
var instances = {};
|
1384 |
-
|
1385 |
-
|
1386 |
-
/**
|
1387 |
-
* @param {Element, String} element
|
1388 |
-
* @param {Object} options
|
1389 |
-
* @constructor
|
1390 |
-
*/
|
1391 |
-
function Outlayer( element, options ) {
|
1392 |
-
var queryElement = utils.getQueryElement( element );
|
1393 |
-
if ( !queryElement ) {
|
1394 |
-
if ( console ) {
|
1395 |
-
console.error( 'Bad element for ' + this.constructor.namespace +
|
1396 |
-
': ' + ( queryElement || element ) );
|
1397 |
-
}
|
1398 |
-
return;
|
1399 |
-
}
|
1400 |
-
this.element = queryElement;
|
1401 |
-
// add jQuery
|
1402 |
-
if ( jQuery ) {
|
1403 |
-
this.$element = jQuery( this.element );
|
1404 |
-
}
|
1405 |
-
|
1406 |
-
// options
|
1407 |
-
this.options = utils.extend( {}, this.constructor.defaults );
|
1408 |
-
this.option( options );
|
1409 |
-
|
1410 |
-
// add id for Outlayer.getFromElement
|
1411 |
-
var id = ++GUID;
|
1412 |
-
this.element.outlayerGUID = id; // expando
|
1413 |
-
instances[ id ] = this; // associate via id
|
1414 |
-
|
1415 |
-
// kick it off
|
1416 |
-
this._create();
|
1417 |
-
|
1418 |
-
var isInitLayout = this._getOption('initLayout');
|
1419 |
-
if ( isInitLayout ) {
|
1420 |
-
this.layout();
|
1421 |
-
}
|
1422 |
-
}
|
1423 |
-
|
1424 |
-
// settings are for internal use only
|
1425 |
-
Outlayer.namespace = 'outlayer';
|
1426 |
-
Outlayer.Item = Item;
|
1427 |
-
|
1428 |
-
// default options
|
1429 |
-
Outlayer.defaults = {
|
1430 |
-
containerStyle: {
|
1431 |
-
position: 'relative'
|
1432 |
-
},
|
1433 |
-
initLayout: true,
|
1434 |
-
originLeft: true,
|
1435 |
-
originTop: true,
|
1436 |
-
resize: true,
|
1437 |
-
resizeContainer: true,
|
1438 |
-
// item options
|
1439 |
-
transitionDuration: '0.4s',
|
1440 |
-
hiddenStyle: {
|
1441 |
-
opacity: 0,
|
1442 |
-
transform: 'scale(0.001)'
|
1443 |
-
},
|
1444 |
-
visibleStyle: {
|
1445 |
-
opacity: 1,
|
1446 |
-
transform: 'scale(1)'
|
1447 |
-
}
|
1448 |
-
};
|
1449 |
-
|
1450 |
-
var proto = Outlayer.prototype;
|
1451 |
-
// inherit EvEmitter
|
1452 |
-
utils.extend( proto, EvEmitter.prototype );
|
1453 |
-
|
1454 |
-
/**
|
1455 |
-
* set options
|
1456 |
-
* @param {Object} opts
|
1457 |
-
*/
|
1458 |
-
proto.option = function( opts ) {
|
1459 |
-
utils.extend( this.options, opts );
|
1460 |
-
};
|
1461 |
-
|
1462 |
-
/**
|
1463 |
-
* get backwards compatible option value, check old name
|
1464 |
-
*/
|
1465 |
-
proto._getOption = function( option ) {
|
1466 |
-
var oldOption = this.constructor.compatOptions[ option ];
|
1467 |
-
return oldOption && this.options[ oldOption ] !== undefined ?
|
1468 |
-
this.options[ oldOption ] : this.options[ option ];
|
1469 |
-
};
|
1470 |
-
|
1471 |
-
Outlayer.compatOptions = {
|
1472 |
-
// currentName: oldName
|
1473 |
-
initLayout: 'isInitLayout',
|
1474 |
-
horizontal: 'isHorizontal',
|
1475 |
-
layoutInstant: 'isLayoutInstant',
|
1476 |
-
originLeft: 'isOriginLeft',
|
1477 |
-
originTop: 'isOriginTop',
|
1478 |
-
resize: 'isResizeBound',
|
1479 |
-
resizeContainer: 'isResizingContainer'
|
1480 |
-
};
|
1481 |
-
|
1482 |
-
proto._create = function() {
|
1483 |
-
// get items from children
|
1484 |
-
this.reloadItems();
|
1485 |
-
// elements that affect layout, but are not laid out
|
1486 |
-
this.stamps = [];
|
1487 |
-
this.stamp( this.options.stamp );
|
1488 |
-
// set container style
|
1489 |
-
utils.extend( this.element.style, this.options.containerStyle );
|
1490 |
-
|
1491 |
-
// bind resize method
|
1492 |
-
var canBindResize = this._getOption('resize');
|
1493 |
-
if ( canBindResize ) {
|
1494 |
-
this.bindResize();
|
1495 |
-
}
|
1496 |
-
};
|
1497 |
-
|
1498 |
-
// goes through all children again and gets bricks in proper order
|
1499 |
-
proto.reloadItems = function() {
|
1500 |
-
// collection of item elements
|
1501 |
-
this.items = this._itemize( this.element.children );
|
1502 |
-
};
|
1503 |
-
|
1504 |
-
|
1505 |
-
/**
|
1506 |
-
* turn elements into Outlayer.Items to be used in layout
|
1507 |
-
* @param {Array or NodeList or HTMLElement} elems
|
1508 |
-
* @returns {Array} items - collection of new Outlayer Items
|
1509 |
-
*/
|
1510 |
-
proto._itemize = function( elems ) {
|
1511 |
-
|
1512 |
-
var itemElems = this._filterFindItemElements( elems );
|
1513 |
-
var Item = this.constructor.Item;
|
1514 |
-
|
1515 |
-
// create new Outlayer Items for collection
|
1516 |
-
var items = [];
|
1517 |
-
for ( var i=0; i < itemElems.length; i++ ) {
|
1518 |
-
var elem = itemElems[i];
|
1519 |
-
var item = new Item( elem, this );
|
1520 |
-
items.push( item );
|
1521 |
-
}
|
1522 |
-
|
1523 |
-
return items;
|
1524 |
-
};
|
1525 |
-
|
1526 |
-
/**
|
1527 |
-
* get item elements to be used in layout
|
1528 |
-
* @param {Array or NodeList or HTMLElement} elems
|
1529 |
-
* @returns {Array} items - item elements
|
1530 |
-
*/
|
1531 |
-
proto._filterFindItemElements = function( elems ) {
|
1532 |
-
return utils.filterFindElements( elems, this.options.itemSelector );
|
1533 |
-
};
|
1534 |
-
|
1535 |
-
/**
|
1536 |
-
* getter method for getting item elements
|
1537 |
-
* @returns {Array} elems - collection of item elements
|
1538 |
-
*/
|
1539 |
-
proto.getItemElements = function() {
|
1540 |
-
return this.items.map( function( item ) {
|
1541 |
-
return item.element;
|
1542 |
-
});
|
1543 |
-
};
|
1544 |
-
|
1545 |
-
// ----- init & layout ----- //
|
1546 |
-
|
1547 |
-
/**
|
1548 |
-
* lays out all items
|
1549 |
-
*/
|
1550 |
-
proto.layout = function() {
|
1551 |
-
this._resetLayout();
|
1552 |
-
this._manageStamps();
|
1553 |
-
|
1554 |
-
// don't animate first layout
|
1555 |
-
var layoutInstant = this._getOption('layoutInstant');
|
1556 |
-
var isInstant = layoutInstant !== undefined ?
|
1557 |
-
layoutInstant : !this._isLayoutInited;
|
1558 |
-
this.layoutItems( this.items, isInstant );
|
1559 |
-
|
1560 |
-
// flag for initalized
|
1561 |
-
this._isLayoutInited = true;
|
1562 |
-
};
|
1563 |
-
|
1564 |
-
// _init is alias for layout
|
1565 |
-
proto._init = proto.layout;
|
1566 |
-
|
1567 |
-
/**
|
1568 |
-
* logic before any new layout
|
1569 |
-
*/
|
1570 |
-
proto._resetLayout = function() {
|
1571 |
-
this.getSize();
|
1572 |
-
};
|
1573 |
-
|
1574 |
-
|
1575 |
-
proto.getSize = function() {
|
1576 |
-
this.size = getSize( this.element );
|
1577 |
-
};
|
1578 |
-
|
1579 |
-
/**
|
1580 |
-
* get measurement from option, for columnWidth, rowHeight, gutter
|
1581 |
-
* if option is String -> get element from selector string, & get size of element
|
1582 |
-
* if option is Element -> get size of element
|
1583 |
-
* else use option as a number
|
1584 |
-
*
|
1585 |
-
* @param {String} measurement
|
1586 |
-
* @param {String} size - width or height
|
1587 |
-
* @private
|
1588 |
-
*/
|
1589 |
-
proto._getMeasurement = function( measurement, size ) {
|
1590 |
-
var option = this.options[ measurement ];
|
1591 |
-
var elem;
|
1592 |
-
if ( !option ) {
|
1593 |
-
// default to 0
|
1594 |
-
this[ measurement ] = 0;
|
1595 |
-
} else {
|
1596 |
-
// use option as an element
|
1597 |
-
if ( typeof option == 'string' ) {
|
1598 |
-
elem = this.element.querySelector( option );
|
1599 |
-
} else if ( option instanceof HTMLElement ) {
|
1600 |
-
elem = option;
|
1601 |
-
}
|
1602 |
-
// use size of element, if element
|
1603 |
-
this[ measurement ] = elem ? getSize( elem )[ size ] : option;
|
1604 |
-
}
|
1605 |
-
};
|
1606 |
-
|
1607 |
-
/**
|
1608 |
-
* layout a collection of item elements
|
1609 |
-
* @api public
|
1610 |
-
*/
|
1611 |
-
proto.layoutItems = function( items, isInstant ) {
|
1612 |
-
items = this._getItemsForLayout( items );
|
1613 |
-
|
1614 |
-
this._layoutItems( items, isInstant );
|
1615 |
-
|
1616 |
-
this._postLayout();
|
1617 |
-
};
|
1618 |
-
|
1619 |
-
/**
|
1620 |
-
* get the items to be laid out
|
1621 |
-
* you may want to skip over some items
|
1622 |
-
* @param {Array} items
|
1623 |
-
* @returns {Array} items
|
1624 |
-
*/
|
1625 |
-
proto._getItemsForLayout = function( items ) {
|
1626 |
-
return items.filter( function( item ) {
|
1627 |
-
return !item.isIgnored;
|
1628 |
-
});
|
1629 |
-
};
|
1630 |
-
|
1631 |
-
/**
|
1632 |
-
* layout items
|
1633 |
-
* @param {Array} items
|
1634 |
-
* @param {Boolean} isInstant
|
1635 |
-
*/
|
1636 |
-
proto._layoutItems = function( items, isInstant ) {
|
1637 |
-
this._emitCompleteOnItems( 'layout', items );
|
1638 |
-
|
1639 |
-
if ( !items || !items.length ) {
|
1640 |
-
// no items, emit event with empty array
|
1641 |
-
return;
|
1642 |
-
}
|
1643 |
-
|
1644 |
-
var queue = [];
|
1645 |
-
|
1646 |
-
items.forEach( function( item ) {
|
1647 |
-
// get x/y object from method
|
1648 |
-
var position = this._getItemLayoutPosition( item );
|
1649 |
-
// enqueue
|
1650 |
-
position.item = item;
|
1651 |
-
position.isInstant = isInstant || item.isLayoutInstant;
|
1652 |
-
queue.push( position );
|
1653 |
-
}, this );
|
1654 |
-
|
1655 |
-
this._processLayoutQueue( queue );
|
1656 |
-
};
|
1657 |
-
|
1658 |
-
/**
|
1659 |
-
* get item layout position
|
1660 |
-
* @param {Outlayer.Item} item
|
1661 |
-
* @returns {Object} x and y position
|
1662 |
-
*/
|
1663 |
-
proto._getItemLayoutPosition = function( /* item */ ) {
|
1664 |
-
return {
|
1665 |
-
x: 0,
|
1666 |
-
y: 0
|
1667 |
-
};
|
1668 |
-
};
|
1669 |
-
|
1670 |
-
/**
|
1671 |
-
* iterate over array and position each item
|
1672 |
-
* Reason being - separating this logic prevents 'layout invalidation'
|
1673 |
-
* thx @paul_irish
|
1674 |
-
* @param {Array} queue
|
1675 |
-
*/
|
1676 |
-
proto._processLayoutQueue = function( queue ) {
|
1677 |
-
this.updateStagger();
|
1678 |
-
queue.forEach( function( obj, i ) {
|
1679 |
-
this._positionItem( obj.item, obj.x, obj.y, obj.isInstant, i );
|
1680 |
-
}, this );
|
1681 |
-
};
|
1682 |
-
|
1683 |
-
// set stagger from option in milliseconds number
|
1684 |
-
proto.updateStagger = function() {
|
1685 |
-
var stagger = this.options.stagger;
|
1686 |
-
if ( stagger === null || stagger === undefined ) {
|
1687 |
-
this.stagger = 0;
|
1688 |
-
return;
|
1689 |
-
}
|
1690 |
-
this.stagger = getMilliseconds( stagger );
|
1691 |
-
return this.stagger;
|
1692 |
-
};
|
1693 |
-
|
1694 |
-
/**
|
1695 |
-
* Sets position of item in DOM
|
1696 |
-
* @param {Outlayer.Item} item
|
1697 |
-
* @param {Number} x - horizontal position
|
1698 |
-
* @param {Number} y - vertical position
|
1699 |
-
* @param {Boolean} isInstant - disables transitions
|
1700 |
-
*/
|
1701 |
-
proto._positionItem = function( item, x, y, isInstant, i ) {
|
1702 |
-
if ( isInstant ) {
|
1703 |
-
// if not transition, just set CSS
|
1704 |
-
item.goTo( x, y );
|
1705 |
-
} else {
|
1706 |
-
item.stagger( i * this.stagger );
|
1707 |
-
item.moveTo( x, y );
|
1708 |
-
}
|
1709 |
-
};
|
1710 |
-
|
1711 |
-
/**
|
1712 |
-
* Any logic you want to do after each layout,
|
1713 |
-
* i.e. size the container
|
1714 |
-
*/
|
1715 |
-
proto._postLayout = function() {
|
1716 |
-
this.resizeContainer();
|
1717 |
-
};
|
1718 |
-
|
1719 |
-
proto.resizeContainer = function() {
|
1720 |
-
var isResizingContainer = this._getOption('resizeContainer');
|
1721 |
-
if ( !isResizingContainer ) {
|
1722 |
-
return;
|
1723 |
-
}
|
1724 |
-
var size = this._getContainerSize();
|
1725 |
-
if ( size ) {
|
1726 |
-
this._setContainerMeasure( size.width, true );
|
1727 |
-
this._setContainerMeasure( size.height, false );
|
1728 |
-
}
|
1729 |
-
};
|
1730 |
-
|
1731 |
-
/**
|
1732 |
-
* Sets width or height of container if returned
|
1733 |
-
* @returns {Object} size
|
1734 |
-
* @param {Number} width
|
1735 |
-
* @param {Number} height
|
1736 |
-
*/
|
1737 |
-
proto._getContainerSize = noop;
|
1738 |
-
|
1739 |
-
/**
|
1740 |
-
* @param {Number} measure - size of width or height
|
1741 |
-
* @param {Boolean} isWidth
|
1742 |
-
*/
|
1743 |
-
proto._setContainerMeasure = function( measure, isWidth ) {
|
1744 |
-
if ( measure === undefined ) {
|
1745 |
-
return;
|
1746 |
-
}
|
1747 |
-
|
1748 |
-
var elemSize = this.size;
|
1749 |
-
// add padding and border width if border box
|
1750 |
-
if ( elemSize.isBorderBox ) {
|
1751 |
-
measure += isWidth ? elemSize.paddingLeft + elemSize.paddingRight +
|
1752 |
-
elemSize.borderLeftWidth + elemSize.borderRightWidth :
|
1753 |
-
elemSize.paddingBottom + elemSize.paddingTop +
|
1754 |
-
elemSize.borderTopWidth + elemSize.borderBottomWidth;
|
1755 |
-
}
|
1756 |
-
|
1757 |
-
measure = Math.max( measure, 0 );
|
1758 |
-
this.element.style[ isWidth ? 'width' : 'height' ] = measure + 'px';
|
1759 |
-
};
|
1760 |
-
|
1761 |
-
/**
|
1762 |
-
* emit eventComplete on a collection of items events
|
1763 |
-
* @param {String} eventName
|
1764 |
-
* @param {Array} items - Outlayer.Items
|
1765 |
-
*/
|
1766 |
-
proto._emitCompleteOnItems = function( eventName, items ) {
|
1767 |
-
var _this = this;
|
1768 |
-
function onComplete() {
|
1769 |
-
_this.dispatchEvent( eventName + 'Complete', null, [ items ] );
|
1770 |
-
}
|
1771 |
-
|
1772 |
-
var count = items.length;
|
1773 |
-
if ( !items || !count ) {
|
1774 |
-
onComplete();
|
1775 |
-
return;
|
1776 |
-
}
|
1777 |
-
|
1778 |
-
var doneCount = 0;
|
1779 |
-
function tick() {
|
1780 |
-
doneCount++;
|
1781 |
-
if ( doneCount == count ) {
|
1782 |
-
onComplete();
|
1783 |
-
}
|
1784 |
-
}
|
1785 |
-
|
1786 |
-
// bind callback
|
1787 |
-
items.forEach( function( item ) {
|
1788 |
-
item.once( eventName, tick );
|
1789 |
-
});
|
1790 |
-
};
|
1791 |
-
|
1792 |
-
/**
|
1793 |
-
* emits events via EvEmitter and jQuery events
|
1794 |
-
* @param {String} type - name of event
|
1795 |
-
* @param {Event} event - original event
|
1796 |
-
* @param {Array} args - extra arguments
|
1797 |
-
*/
|
1798 |
-
proto.dispatchEvent = function( type, event, args ) {
|
1799 |
-
// add original event to arguments
|
1800 |
-
var emitArgs = event ? [ event ].concat( args ) : args;
|
1801 |
-
this.emitEvent( type, emitArgs );
|
1802 |
-
|
1803 |
-
if ( jQuery ) {
|
1804 |
-
// set this.$element
|
1805 |
-
this.$element = this.$element || jQuery( this.element );
|
1806 |
-
if ( event ) {
|
1807 |
-
// create jQuery event
|
1808 |
-
var $event = jQuery.Event( event );
|
1809 |
-
$event.type = type;
|
1810 |
-
this.$element.trigger( $event, args );
|
1811 |
-
} else {
|
1812 |
-
// just trigger with type if no event available
|
1813 |
-
this.$element.trigger( type, args );
|
1814 |
-
}
|
1815 |
-
}
|
1816 |
-
};
|
1817 |
-
|
1818 |
-
// -------------------------- ignore & stamps -------------------------- //
|
1819 |
-
|
1820 |
-
|
1821 |
-
/**
|
1822 |
-
* keep item in collection, but do not lay it out
|
1823 |
-
* ignored items do not get skipped in layout
|
1824 |
-
* @param {Element} elem
|
1825 |
-
*/
|
1826 |
-
proto.ignore = function( elem ) {
|
1827 |
-
var item = this.getItem( elem );
|
1828 |
-
if ( item ) {
|
1829 |
-
item.isIgnored = true;
|
1830 |
-
}
|
1831 |
-
};
|
1832 |
-
|
1833 |
-
/**
|
1834 |
-
* return item to layout collection
|
1835 |
-
* @param {Element} elem
|
1836 |
-
*/
|
1837 |
-
proto.unignore = function( elem ) {
|
1838 |
-
var item = this.getItem( elem );
|
1839 |
-
if ( item ) {
|
1840 |
-
delete item.isIgnored;
|
1841 |
-
}
|
1842 |
-
};
|
1843 |
-
|
1844 |
-
/**
|
1845 |
-
* adds elements to stamps
|
1846 |
-
* @param {NodeList, Array, Element, or String} elems
|
1847 |
-
*/
|
1848 |
-
proto.stamp = function( elems ) {
|
1849 |
-
elems = this._find( elems );
|
1850 |
-
if ( !elems ) {
|
1851 |
-
return;
|
1852 |
-
}
|
1853 |
-
|
1854 |
-
this.stamps = this.stamps.concat( elems );
|
1855 |
-
// ignore
|
1856 |
-
elems.forEach( this.ignore, this );
|
1857 |
-
};
|
1858 |
-
|
1859 |
-
/**
|
1860 |
-
* removes elements to stamps
|
1861 |
-
* @param {NodeList, Array, or Element} elems
|
1862 |
-
*/
|
1863 |
-
proto.unstamp = function( elems ) {
|
1864 |
-
elems = this._find( elems );
|
1865 |
-
if ( !elems ){
|
1866 |
-
return;
|
1867 |
-
}
|
1868 |
-
|
1869 |
-
elems.forEach( function( elem ) {
|
1870 |
-
// filter out removed stamp elements
|
1871 |
-
utils.removeFrom( this.stamps, elem );
|
1872 |
-
this.unignore( elem );
|
1873 |
-
}, this );
|
1874 |
-
};
|
1875 |
-
|
1876 |
-
/**
|
1877 |
-
* finds child elements
|
1878 |
-
* @param {NodeList, Array, Element, or String} elems
|
1879 |
-
* @returns {Array} elems
|
1880 |
-
*/
|
1881 |
-
proto._find = function( elems ) {
|
1882 |
-
if ( !elems ) {
|
1883 |
-
return;
|
1884 |
-
}
|
1885 |
-
// if string, use argument as selector string
|
1886 |
-
if ( typeof elems == 'string' ) {
|
1887 |
-
elems = this.element.querySelectorAll( elems );
|
1888 |
-
}
|
1889 |
-
elems = utils.makeArray( elems );
|
1890 |
-
return elems;
|
1891 |
-
};
|
1892 |
-
|
1893 |
-
proto._manageStamps = function() {
|
1894 |
-
if ( !this.stamps || !this.stamps.length ) {
|
1895 |
-
return;
|
1896 |
-
}
|
1897 |
-
|
1898 |
-
this._getBoundingRect();
|
1899 |
-
|
1900 |
-
this.stamps.forEach( this._manageStamp, this );
|
1901 |
-
};
|
1902 |
-
|
1903 |
-
// update boundingLeft / Top
|
1904 |
-
proto._getBoundingRect = function() {
|
1905 |
-
// get bounding rect for container element
|
1906 |
-
var boundingRect = this.element.getBoundingClientRect();
|
1907 |
-
var size = this.size;
|
1908 |
-
this._boundingRect = {
|
1909 |
-
left: boundingRect.left + size.paddingLeft + size.borderLeftWidth,
|
1910 |
-
top: boundingRect.top + size.paddingTop + size.borderTopWidth,
|
1911 |
-
right: boundingRect.right - ( size.paddingRight + size.borderRightWidth ),
|
1912 |
-
bottom: boundingRect.bottom - ( size.paddingBottom + size.borderBottomWidth )
|
1913 |
-
};
|
1914 |
-
};
|
1915 |
-
|
1916 |
-
/**
|
1917 |
-
* @param {Element} stamp
|
1918 |
-
**/
|
1919 |
-
proto._manageStamp = noop;
|
1920 |
-
|
1921 |
-
/**
|
1922 |
-
* get x/y position of element relative to container element
|
1923 |
-
* @param {Element} elem
|
1924 |
-
* @returns {Object} offset - has left, top, right, bottom
|
1925 |
-
*/
|
1926 |
-
proto._getElementOffset = function( elem ) {
|
1927 |
-
var boundingRect = elem.getBoundingClientRect();
|
1928 |
-
var thisRect = this._boundingRect;
|
1929 |
-
var size = getSize( elem );
|
1930 |
-
var offset = {
|
1931 |
-
left: boundingRect.left - thisRect.left - size.marginLeft,
|
1932 |
-
top: boundingRect.top - thisRect.top - size.marginTop,
|
1933 |
-
right: thisRect.right - boundingRect.right - size.marginRight,
|
1934 |
-
bottom: thisRect.bottom - boundingRect.bottom - size.marginBottom
|
1935 |
-
};
|
1936 |
-
return offset;
|
1937 |
-
};
|
1938 |
-
|
1939 |
-
// -------------------------- resize -------------------------- //
|
1940 |
-
|
1941 |
-
// enable event handlers for listeners
|
1942 |
-
// i.e. resize -> onresize
|
1943 |
-
proto.handleEvent = utils.handleEvent;
|
1944 |
-
|
1945 |
-
/**
|
1946 |
-
* Bind layout to window resizing
|
1947 |
-
*/
|
1948 |
-
proto.bindResize = function() {
|
1949 |
-
window.addEventListener( 'resize', this );
|
1950 |
-
this.isResizeBound = true;
|
1951 |
-
};
|
1952 |
-
|
1953 |
-
/**
|
1954 |
-
* Unbind layout to window resizing
|
1955 |
-
*/
|
1956 |
-
proto.unbindResize = function() {
|
1957 |
-
window.removeEventListener( 'resize', this );
|
1958 |
-
this.isResizeBound = false;
|
1959 |
-
};
|
1960 |
-
|
1961 |
-
proto.onresize = function() {
|
1962 |
-
this.resize();
|
1963 |
-
};
|
1964 |
-
|
1965 |
-
utils.debounceMethod( Outlayer, 'onresize', 100 );
|
1966 |
-
|
1967 |
-
proto.resize = function() {
|
1968 |
-
// don't trigger if size did not change
|
1969 |
-
// or if resize was unbound. See #9
|
1970 |
-
if ( !this.isResizeBound || !this.needsResizeLayout() ) {
|
1971 |
-
return;
|
1972 |
-
}
|
1973 |
-
|
1974 |
-
this.layout();
|
1975 |
-
};
|
1976 |
-
|
1977 |
-
/**
|
1978 |
-
* check if layout is needed post layout
|
1979 |
-
* @returns Boolean
|
1980 |
-
*/
|
1981 |
-
proto.needsResizeLayout = function() {
|
1982 |
-
var size = getSize( this.element );
|
1983 |
-
// check that this.size and size are there
|
1984 |
-
// IE8 triggers resize on body size change, so they might not be
|
1985 |
-
var hasSizes = this.size && size;
|
1986 |
-
return hasSizes && size.innerWidth !== this.size.innerWidth;
|
1987 |
-
};
|
1988 |
-
|
1989 |
-
// -------------------------- methods -------------------------- //
|
1990 |
-
|
1991 |
-
/**
|
1992 |
-
* add items to Outlayer instance
|
1993 |
-
* @param {Array or NodeList or Element} elems
|
1994 |
-
* @returns {Array} items - Outlayer.Items
|
1995 |
-
**/
|
1996 |
-
proto.addItems = function( elems ) {
|
1997 |
-
var items = this._itemize( elems );
|
1998 |
-
// add items to collection
|
1999 |
-
if ( items.length ) {
|
2000 |
-
this.items = this.items.concat( items );
|
2001 |
-
}
|
2002 |
-
return items;
|
2003 |
-
};
|
2004 |
-
|
2005 |
-
/**
|
2006 |
-
* Layout newly-appended item elements
|
2007 |
-
* @param {Array or NodeList or Element} elems
|
2008 |
-
*/
|
2009 |
-
proto.appended = function( elems ) {
|
2010 |
-
var items = this.addItems( elems );
|
2011 |
-
if ( !items.length ) {
|
2012 |
-
return;
|
2013 |
-
}
|
2014 |
-
// layout and reveal just the new items
|
2015 |
-
this.layoutItems( items, true );
|
2016 |
-
this.reveal( items );
|
2017 |
-
};
|
2018 |
-
|
2019 |
-
/**
|
2020 |
-
* Layout prepended elements
|
2021 |
-
* @param {Array or NodeList or Element} elems
|
2022 |
-
*/
|
2023 |
-
proto.prepended = function( elems ) {
|
2024 |
-
var items = this._itemize( elems );
|
2025 |
-
if ( !items.length ) {
|
2026 |
-
return;
|
2027 |
-
}
|
2028 |
-
// add items to beginning of collection
|
2029 |
-
var previousItems = this.items.slice(0);
|
2030 |
-
this.items = items.concat( previousItems );
|
2031 |
-
// start new layout
|
2032 |
-
this._resetLayout();
|
2033 |
-
this._manageStamps();
|
2034 |
-
// layout new stuff without transition
|
2035 |
-
this.layoutItems( items, true );
|
2036 |
-
this.reveal( items );
|
2037 |
-
// layout previous items
|
2038 |
-
this.layoutItems( previousItems );
|
2039 |
-
};
|
2040 |
-
|
2041 |
-
/**
|
2042 |
-
* reveal a collection of items
|
2043 |
-
* @param {Array of Outlayer.Items} items
|
2044 |
-
*/
|
2045 |
-
proto.reveal = function( items ) {
|
2046 |
-
this._emitCompleteOnItems( 'reveal', items );
|
2047 |
-
if ( !items || !items.length ) {
|
2048 |
-
return;
|
2049 |
-
}
|
2050 |
-
var stagger = this.updateStagger();
|
2051 |
-
items.forEach( function( item, i ) {
|
2052 |
-
item.stagger( i * stagger );
|
2053 |
-
item.reveal();
|
2054 |
-
});
|
2055 |
-
};
|
2056 |
-
|
2057 |
-
/**
|
2058 |
-
* hide a collection of items
|
2059 |
-
* @param {Array of Outlayer.Items} items
|
2060 |
-
*/
|
2061 |
-
proto.hide = function( items ) {
|
2062 |
-
this._emitCompleteOnItems( 'hide', items );
|
2063 |
-
if ( !items || !items.length ) {
|
2064 |
-
return;
|
2065 |
-
}
|
2066 |
-
var stagger = this.updateStagger();
|
2067 |
-
items.forEach( function( item, i ) {
|
2068 |
-
item.stagger( i * stagger );
|
2069 |
-
item.hide();
|
2070 |
-
});
|
2071 |
-
};
|
2072 |
-
|
2073 |
-
/**
|
2074 |
-
* reveal item elements
|
2075 |
-
* @param {Array}, {Element}, {NodeList} items
|
2076 |
-
*/
|
2077 |
-
proto.revealItemElements = function( elems ) {
|
2078 |
-
var items = this.getItems( elems );
|
2079 |
-
this.reveal( items );
|
2080 |
-
};
|
2081 |
-
|
2082 |
-
/**
|
2083 |
-
* hide item elements
|
2084 |
-
* @param {Array}, {Element}, {NodeList} items
|
2085 |
-
*/
|
2086 |
-
proto.hideItemElements = function( elems ) {
|
2087 |
-
var items = this.getItems( elems );
|
2088 |
-
this.hide( items );
|
2089 |
-
};
|
2090 |
-
|
2091 |
-
/**
|
2092 |
-
* get Outlayer.Item, given an Element
|
2093 |
-
* @param {Element} elem
|
2094 |
-
* @param {Function} callback
|
2095 |
-
* @returns {Outlayer.Item} item
|
2096 |
-
*/
|
2097 |
-
proto.getItem = function( elem ) {
|
2098 |
-
// loop through items to get the one that matches
|
2099 |
-
for ( var i=0; i < this.items.length; i++ ) {
|
2100 |
-
var item = this.items[i];
|
2101 |
-
if ( item.element == elem ) {
|
2102 |
-
// return item
|
2103 |
-
return item;
|
2104 |
-
}
|
2105 |
-
}
|
2106 |
-
};
|
2107 |
-
|
2108 |
-
/**
|
2109 |
-
* get collection of Outlayer.Items, given Elements
|
2110 |
-
* @param {Array} elems
|
2111 |
-
* @returns {Array} items - Outlayer.Items
|
2112 |
-
*/
|
2113 |
-
proto.getItems = function( elems ) {
|
2114 |
-
elems = utils.makeArray( elems );
|
2115 |
-
var items = [];
|
2116 |
-
elems.forEach( function( elem ) {
|
2117 |
-
var item = this.getItem( elem );
|
2118 |
-
if ( item ) {
|
2119 |
-
items.push( item );
|
2120 |
-
}
|
2121 |
-
}, this );
|
2122 |
-
|
2123 |
-
return items;
|
2124 |
-
};
|
2125 |
-
|
2126 |
-
/**
|
2127 |
-
* remove element(s) from instance and DOM
|
2128 |
-
* @param {Array or NodeList or Element} elems
|
2129 |
-
*/
|
2130 |
-
proto.remove = function( elems ) {
|
2131 |
-
var removeItems = this.getItems( elems );
|
2132 |
-
|
2133 |
-
this._emitCompleteOnItems( 'remove', removeItems );
|
2134 |
-
|
2135 |
-
// bail if no items to remove
|
2136 |
-
if ( !removeItems || !removeItems.length ) {
|
2137 |
-
return;
|
2138 |
-
}
|
2139 |
-
|
2140 |
-
removeItems.forEach( function( item ) {
|
2141 |
-
item.remove();
|
2142 |
-
// remove item from collection
|
2143 |
-
utils.removeFrom( this.items, item );
|
2144 |
-
}, this );
|
2145 |
-
};
|
2146 |
-
|
2147 |
-
// ----- destroy ----- //
|
2148 |
-
|
2149 |
-
// remove and disable Outlayer instance
|
2150 |
-
proto.destroy = function() {
|
2151 |
-
// clean up dynamic styles
|
2152 |
-
var style = this.element.style;
|
2153 |
-
style.height = '';
|
2154 |
-
style.position = '';
|
2155 |
-
style.width = '';
|
2156 |
-
// destroy items
|
2157 |
-
this.items.forEach( function( item ) {
|
2158 |
-
item.destroy();
|
2159 |
-
});
|
2160 |
-
|
2161 |
-
this.unbindResize();
|
2162 |
-
|
2163 |
-
var id = this.element.outlayerGUID;
|
2164 |
-
delete instances[ id ]; // remove reference to instance by id
|
2165 |
-
delete this.element.outlayerGUID;
|
2166 |
-
// remove data for jQuery
|
2167 |
-
if ( jQuery ) {
|
2168 |
-
jQuery.removeData( this.element, this.constructor.namespace );
|
2169 |
-
}
|
2170 |
-
|
2171 |
-
};
|
2172 |
-
|
2173 |
-
// -------------------------- data -------------------------- //
|
2174 |
-
|
2175 |
-
/**
|
2176 |
-
* get Outlayer instance from element
|
2177 |
-
* @param {Element} elem
|
2178 |
-
* @returns {Outlayer}
|
2179 |
-
*/
|
2180 |
-
Outlayer.data = function( elem ) {
|
2181 |
-
elem = utils.getQueryElement( elem );
|
2182 |
-
var id = elem && elem.outlayerGUID;
|
2183 |
-
return id && instances[ id ];
|
2184 |
-
};
|
2185 |
-
|
2186 |
-
|
2187 |
-
// -------------------------- create Outlayer class -------------------------- //
|
2188 |
-
|
2189 |
-
/**
|
2190 |
-
* create a layout class
|
2191 |
-
* @param {String} namespace
|
2192 |
-
*/
|
2193 |
-
Outlayer.create = function( namespace, options ) {
|
2194 |
-
// sub-class Outlayer
|
2195 |
-
var Layout = subclass( Outlayer );
|
2196 |
-
// apply new options and compatOptions
|
2197 |
-
Layout.defaults = utils.extend( {}, Outlayer.defaults );
|
2198 |
-
utils.extend( Layout.defaults, options );
|
2199 |
-
Layout.compatOptions = utils.extend( {}, Outlayer.compatOptions );
|
2200 |
-
|
2201 |
-
Layout.namespace = namespace;
|
2202 |
-
|
2203 |
-
Layout.data = Outlayer.data;
|
2204 |
-
|
2205 |
-
// sub-class Item
|
2206 |
-
Layout.Item = subclass( Item );
|
2207 |
-
|
2208 |
-
// -------------------------- declarative -------------------------- //
|
2209 |
-
|
2210 |
-
utils.htmlInit( Layout, namespace );
|
2211 |
-
|
2212 |
-
// -------------------------- jQuery bridge -------------------------- //
|
2213 |
-
|
2214 |
-
// make into jQuery plugin
|
2215 |
-
if ( jQuery && jQuery.bridget ) {
|
2216 |
-
jQuery.bridget( namespace, Layout );
|
2217 |
-
}
|
2218 |
-
|
2219 |
-
return Layout;
|
2220 |
-
};
|
2221 |
-
|
2222 |
-
function subclass( Parent ) {
|
2223 |
-
function SubClass() {
|
2224 |
-
Parent.apply( this, arguments );
|
2225 |
-
}
|
2226 |
-
|
2227 |
-
SubClass.prototype = Object.create( Parent.prototype );
|
2228 |
-
SubClass.prototype.constructor = SubClass;
|
2229 |
-
|
2230 |
-
return SubClass;
|
2231 |
-
}
|
2232 |
-
|
2233 |
-
// ----- helpers ----- //
|
2234 |
-
|
2235 |
-
// how many milliseconds are in each unit
|
2236 |
-
var msUnits = {
|
2237 |
-
ms: 1,
|
2238 |
-
s: 1000
|
2239 |
-
};
|
2240 |
-
|
2241 |
-
// munge time-like parameter into millisecond number
|
2242 |
-
// '0.4s' -> 40
|
2243 |
-
function getMilliseconds( time ) {
|
2244 |
-
if ( typeof time == 'number' ) {
|
2245 |
-
return time;
|
2246 |
-
}
|
2247 |
-
var matches = time.match( /(^\d*\.?\d*)(\w*)/ );
|
2248 |
-
var num = matches && matches[1];
|
2249 |
-
var unit = matches && matches[2];
|
2250 |
-
if ( !num.length ) {
|
2251 |
-
return 0;
|
2252 |
-
}
|
2253 |
-
num = parseFloat( num );
|
2254 |
-
var mult = msUnits[ unit ] || 1;
|
2255 |
-
return num * mult;
|
2256 |
-
}
|
2257 |
-
|
2258 |
-
// ----- fin ----- //
|
2259 |
-
|
2260 |
-
// back in global
|
2261 |
-
Outlayer.Item = Item;
|
2262 |
-
|
2263 |
-
return Outlayer;
|
2264 |
-
|
2265 |
-
}));
|
2266 |
-
|
2267 |
-
/**
|
2268 |
-
* Isotope Item
|
2269 |
-
**/
|
2270 |
-
|
2271 |
-
( function( window, factory ) {
|
2272 |
-
// universal module definition
|
2273 |
-
/* jshint strict: false */ /*globals define, module, require */
|
2274 |
-
if ( typeof define == 'function' && define.amd ) {
|
2275 |
-
// AMD
|
2276 |
-
define( 'isotope-layout/js/item',[
|
2277 |
-
'outlayer/outlayer'
|
2278 |
-
],
|
2279 |
-
factory );
|
2280 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
2281 |
-
// CommonJS
|
2282 |
-
module.exports = factory(
|
2283 |
-
require('outlayer')
|
2284 |
-
);
|
2285 |
-
} else {
|
2286 |
-
// browser global
|
2287 |
-
window.Isotope = window.Isotope || {};
|
2288 |
-
window.Isotope.Item = factory(
|
2289 |
-
window.Outlayer
|
2290 |
-
);
|
2291 |
-
}
|
2292 |
-
|
2293 |
-
}( window, function factory( Outlayer ) {
|
2294 |
-
'use strict';
|
2295 |
-
|
2296 |
-
// -------------------------- Item -------------------------- //
|
2297 |
-
|
2298 |
-
// sub-class Outlayer Item
|
2299 |
-
function Item() {
|
2300 |
-
Outlayer.Item.apply( this, arguments );
|
2301 |
-
}
|
2302 |
-
|
2303 |
-
var proto = Item.prototype = Object.create( Outlayer.Item.prototype );
|
2304 |
-
|
2305 |
-
var _create = proto._create;
|
2306 |
-
proto._create = function() {
|
2307 |
-
// assign id, used for original-order sorting
|
2308 |
-
this.id = this.layout.itemGUID++;
|
2309 |
-
_create.call( this );
|
2310 |
-
this.sortData = {};
|
2311 |
-
};
|
2312 |
-
|
2313 |
-
proto.updateSortData = function() {
|
2314 |
-
if ( this.isIgnored ) {
|
2315 |
-
return;
|
2316 |
-
}
|
2317 |
-
// default sorters
|
2318 |
-
this.sortData.id = this.id;
|
2319 |
-
// for backward compatibility
|
2320 |
-
this.sortData['original-order'] = this.id;
|
2321 |
-
this.sortData.random = Math.random();
|
2322 |
-
// go thru getSortData obj and apply the sorters
|
2323 |
-
var getSortData = this.layout.options.getSortData;
|
2324 |
-
var sorters = this.layout._sorters;
|
2325 |
-
for ( var key in getSortData ) {
|
2326 |
-
var sorter = sorters[ key ];
|
2327 |
-
this.sortData[ key ] = sorter( this.element, this );
|
2328 |
-
}
|
2329 |
-
};
|
2330 |
-
|
2331 |
-
var _destroy = proto.destroy;
|
2332 |
-
proto.destroy = function() {
|
2333 |
-
// call super
|
2334 |
-
_destroy.apply( this, arguments );
|
2335 |
-
// reset display, #741
|
2336 |
-
this.css({
|
2337 |
-
display: ''
|
2338 |
-
});
|
2339 |
-
};
|
2340 |
-
|
2341 |
-
return Item;
|
2342 |
-
|
2343 |
-
}));
|
2344 |
-
|
2345 |
-
/**
|
2346 |
-
* Isotope LayoutMode
|
2347 |
-
*/
|
2348 |
-
|
2349 |
-
( function( window, factory ) {
|
2350 |
-
// universal module definition
|
2351 |
-
/* jshint strict: false */ /*globals define, module, require */
|
2352 |
-
if ( typeof define == 'function' && define.amd ) {
|
2353 |
-
// AMD
|
2354 |
-
define( 'isotope-layout/js/layout-mode',[
|
2355 |
-
'get-size/get-size',
|
2356 |
-
'outlayer/outlayer'
|
2357 |
-
],
|
2358 |
-
factory );
|
2359 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
2360 |
-
// CommonJS
|
2361 |
-
module.exports = factory(
|
2362 |
-
require('get-size'),
|
2363 |
-
require('outlayer')
|
2364 |
-
);
|
2365 |
-
} else {
|
2366 |
-
// browser global
|
2367 |
-
window.Isotope = window.Isotope || {};
|
2368 |
-
window.Isotope.LayoutMode = factory(
|
2369 |
-
window.getSize,
|
2370 |
-
window.Outlayer
|
2371 |
-
);
|
2372 |
-
}
|
2373 |
-
|
2374 |
-
}( window, function factory( getSize, Outlayer ) {
|
2375 |
-
'use strict';
|
2376 |
-
|
2377 |
-
// layout mode class
|
2378 |
-
function LayoutMode( isotope ) {
|
2379 |
-
this.isotope = isotope;
|
2380 |
-
// link properties
|
2381 |
-
if ( isotope ) {
|
2382 |
-
this.options = isotope.options[ this.namespace ];
|
2383 |
-
this.element = isotope.element;
|
2384 |
-
this.items = isotope.filteredItems;
|
2385 |
-
this.size = isotope.size;
|
2386 |
-
}
|
2387 |
-
}
|
2388 |
-
|
2389 |
-
var proto = LayoutMode.prototype;
|
2390 |
-
|
2391 |
-
/**
|
2392 |
-
* some methods should just defer to default Outlayer method
|
2393 |
-
* and reference the Isotope instance as `this`
|
2394 |
-
**/
|
2395 |
-
var facadeMethods = [
|
2396 |
-
'_resetLayout',
|
2397 |
-
'_getItemLayoutPosition',
|
2398 |
-
'_manageStamp',
|
2399 |
-
'_getContainerSize',
|
2400 |
-
'_getElementOffset',
|
2401 |
-
'needsResizeLayout',
|
2402 |
-
'_getOption'
|
2403 |
-
];
|
2404 |
-
|
2405 |
-
facadeMethods.forEach( function( methodName ) {
|
2406 |
-
proto[ methodName ] = function() {
|
2407 |
-
return Outlayer.prototype[ methodName ].apply( this.isotope, arguments );
|
2408 |
-
};
|
2409 |
-
});
|
2410 |
-
|
2411 |
-
// ----- ----- //
|
2412 |
-
|
2413 |
-
// for horizontal layout modes, check vertical size
|
2414 |
-
proto.needsVerticalResizeLayout = function() {
|
2415 |
-
// don't trigger if size did not change
|
2416 |
-
var size = getSize( this.isotope.element );
|
2417 |
-
// check that this.size and size are there
|
2418 |
-
// IE8 triggers resize on body size change, so they might not be
|
2419 |
-
var hasSizes = this.isotope.size && size;
|
2420 |
-
return hasSizes && size.innerHeight != this.isotope.size.innerHeight;
|
2421 |
-
};
|
2422 |
-
|
2423 |
-
// ----- measurements ----- //
|
2424 |
-
|
2425 |
-
proto._getMeasurement = function() {
|
2426 |
-
this.isotope._getMeasurement.apply( this, arguments );
|
2427 |
-
};
|
2428 |
-
|
2429 |
-
proto.getColumnWidth = function() {
|
2430 |
-
this.getSegmentSize( 'column', 'Width' );
|
2431 |
-
};
|
2432 |
-
|
2433 |
-
proto.getRowHeight = function() {
|
2434 |
-
this.getSegmentSize( 'row', 'Height' );
|
2435 |
-
};
|
2436 |
-
|
2437 |
-
/**
|
2438 |
-
* get columnWidth or rowHeight
|
2439 |
-
* segment: 'column' or 'row'
|
2440 |
-
* size 'Width' or 'Height'
|
2441 |
-
**/
|
2442 |
-
proto.getSegmentSize = function( segment, size ) {
|
2443 |
-
var segmentName = segment + size;
|
2444 |
-
var outerSize = 'outer' + size;
|
2445 |
-
// columnWidth / outerWidth // rowHeight / outerHeight
|
2446 |
-
this._getMeasurement( segmentName, outerSize );
|
2447 |
-
// got rowHeight or columnWidth, we can chill
|
2448 |
-
if ( this[ segmentName ] ) {
|
2449 |
-
return;
|
2450 |
-
}
|
2451 |
-
// fall back to item of first element
|
2452 |
-
var firstItemSize = this.getFirstItemSize();
|
2453 |
-
this[ segmentName ] = firstItemSize && firstItemSize[ outerSize ] ||
|
2454 |
-
// or size of container
|
2455 |
-
this.isotope.size[ 'inner' + size ];
|
2456 |
-
};
|
2457 |
-
|
2458 |
-
proto.getFirstItemSize = function() {
|
2459 |
-
var firstItem = this.isotope.filteredItems[0];
|
2460 |
-
return firstItem && firstItem.element && getSize( firstItem.element );
|
2461 |
-
};
|
2462 |
-
|
2463 |
-
// ----- methods that should reference isotope ----- //
|
2464 |
-
|
2465 |
-
proto.layout = function() {
|
2466 |
-
this.isotope.layout.apply( this.isotope, arguments );
|
2467 |
-
};
|
2468 |
-
|
2469 |
-
proto.getSize = function() {
|
2470 |
-
this.isotope.getSize();
|
2471 |
-
this.size = this.isotope.size;
|
2472 |
-
};
|
2473 |
-
|
2474 |
-
// -------------------------- create -------------------------- //
|
2475 |
-
|
2476 |
-
LayoutMode.modes = {};
|
2477 |
-
|
2478 |
-
LayoutMode.create = function( namespace, options ) {
|
2479 |
-
|
2480 |
-
function Mode() {
|
2481 |
-
LayoutMode.apply( this, arguments );
|
2482 |
-
}
|
2483 |
-
|
2484 |
-
Mode.prototype = Object.create( proto );
|
2485 |
-
Mode.prototype.constructor = Mode;
|
2486 |
-
|
2487 |
-
// default options
|
2488 |
-
if ( options ) {
|
2489 |
-
Mode.options = options;
|
2490 |
-
}
|
2491 |
-
|
2492 |
-
Mode.prototype.namespace = namespace;
|
2493 |
-
// register in Isotope
|
2494 |
-
LayoutMode.modes[ namespace ] = Mode;
|
2495 |
-
|
2496 |
-
return Mode;
|
2497 |
-
};
|
2498 |
-
|
2499 |
-
return LayoutMode;
|
2500 |
-
|
2501 |
-
}));
|
2502 |
-
|
2503 |
-
/*!
|
2504 |
-
* Masonry v4.2.1
|
2505 |
-
* Cascading grid layout library
|
2506 |
-
* https://masonry.desandro.com
|
2507 |
-
* MIT License
|
2508 |
-
* by David DeSandro
|
2509 |
-
*/
|
2510 |
-
|
2511 |
-
( function( window, factory ) {
|
2512 |
-
// universal module definition
|
2513 |
-
/* jshint strict: false */ /*globals define, module, require */
|
2514 |
-
if ( typeof define == 'function' && define.amd ) {
|
2515 |
-
// AMD
|
2516 |
-
define( 'masonry-layout/masonry',[
|
2517 |
-
'outlayer/outlayer',
|
2518 |
-
'get-size/get-size'
|
2519 |
-
],
|
2520 |
-
factory );
|
2521 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
2522 |
-
// CommonJS
|
2523 |
-
module.exports = factory(
|
2524 |
-
require('outlayer'),
|
2525 |
-
require('get-size')
|
2526 |
-
);
|
2527 |
-
} else {
|
2528 |
-
// browser global
|
2529 |
-
window.Masonry = factory(
|
2530 |
-
window.Outlayer,
|
2531 |
-
window.getSize
|
2532 |
-
);
|
2533 |
-
}
|
2534 |
-
|
2535 |
-
}( window, function factory( Outlayer, getSize ) {
|
2536 |
-
|
2537 |
-
|
2538 |
-
|
2539 |
-
// -------------------------- masonryDefinition -------------------------- //
|
2540 |
-
|
2541 |
-
// create an Outlayer layout class
|
2542 |
-
var Masonry = Outlayer.create('masonry');
|
2543 |
-
// isFitWidth -> fitWidth
|
2544 |
-
Masonry.compatOptions.fitWidth = 'isFitWidth';
|
2545 |
-
|
2546 |
-
var proto = Masonry.prototype;
|
2547 |
-
|
2548 |
-
proto._resetLayout = function() {
|
2549 |
-
this.getSize();
|
2550 |
-
this._getMeasurement( 'columnWidth', 'outerWidth' );
|
2551 |
-
this._getMeasurement( 'gutter', 'outerWidth' );
|
2552 |
-
this.measureColumns();
|
2553 |
-
|
2554 |
-
// reset column Y
|
2555 |
-
this.colYs = [];
|
2556 |
-
for ( var i=0; i < this.cols; i++ ) {
|
2557 |
-
this.colYs.push( 0 );
|
2558 |
-
}
|
2559 |
-
|
2560 |
-
this.maxY = 0;
|
2561 |
-
this.horizontalColIndex = 0;
|
2562 |
-
};
|
2563 |
-
|
2564 |
-
proto.measureColumns = function() {
|
2565 |
-
this.getContainerWidth();
|
2566 |
-
// if columnWidth is 0, default to outerWidth of first item
|
2567 |
-
if ( !this.columnWidth ) {
|
2568 |
-
var firstItem = this.items[0];
|
2569 |
-
var firstItemElem = firstItem && firstItem.element;
|
2570 |
-
// columnWidth fall back to item of first element
|
2571 |
-
this.columnWidth = firstItemElem && getSize( firstItemElem ).outerWidth ||
|
2572 |
-
// if first elem has no width, default to size of container
|
2573 |
-
this.containerWidth;
|
2574 |
-
}
|
2575 |
-
|
2576 |
-
var columnWidth = this.columnWidth += this.gutter;
|
2577 |
-
|
2578 |
-
// calculate columns
|
2579 |
-
var containerWidth = this.containerWidth + this.gutter;
|
2580 |
-
var cols = containerWidth / columnWidth;
|
2581 |
-
// fix rounding errors, typically with gutters
|
2582 |
-
var excess = columnWidth - containerWidth % columnWidth;
|
2583 |
-
// if overshoot is less than a pixel, round up, otherwise floor it
|
2584 |
-
var mathMethod = excess && excess < 1 ? 'round' : 'floor';
|
2585 |
-
cols = Math[ mathMethod ]( cols );
|
2586 |
-
this.cols = Math.max( cols, 1 );
|
2587 |
-
};
|
2588 |
-
|
2589 |
-
proto.getContainerWidth = function() {
|
2590 |
-
// container is parent if fit width
|
2591 |
-
var isFitWidth = this._getOption('fitWidth');
|
2592 |
-
var container = isFitWidth ? this.element.parentNode : this.element;
|
2593 |
-
// check that this.size and size are there
|
2594 |
-
// IE8 triggers resize on body size change, so they might not be
|
2595 |
-
var size = getSize( container );
|
2596 |
-
this.containerWidth = size && size.innerWidth;
|
2597 |
-
};
|
2598 |
-
|
2599 |
-
proto._getItemLayoutPosition = function( item ) {
|
2600 |
-
item.getSize();
|
2601 |
-
// how many columns does this brick span
|
2602 |
-
var remainder = item.size.outerWidth % this.columnWidth;
|
2603 |
-
var mathMethod = remainder && remainder < 1 ? 'round' : 'ceil';
|
2604 |
-
// round if off by 1 pixel, otherwise use ceil
|
2605 |
-
var colSpan = Math[ mathMethod ]( item.size.outerWidth / this.columnWidth );
|
2606 |
-
colSpan = Math.min( colSpan, this.cols );
|
2607 |
-
// use horizontal or top column position
|
2608 |
-
var colPosMethod = this.options.horizontalOrder ?
|
2609 |
-
'_getHorizontalColPosition' : '_getTopColPosition';
|
2610 |
-
var colPosition = this[ colPosMethod ]( colSpan, item );
|
2611 |
-
// position the brick
|
2612 |
-
var position = {
|
2613 |
-
x: this.columnWidth * colPosition.col,
|
2614 |
-
y: colPosition.y
|
2615 |
-
};
|
2616 |
-
// apply setHeight to necessary columns
|
2617 |
-
var setHeight = colPosition.y + item.size.outerHeight;
|
2618 |
-
var setMax = colSpan + colPosition.col;
|
2619 |
-
for ( var i = colPosition.col; i < setMax; i++ ) {
|
2620 |
-
this.colYs[i] = setHeight;
|
2621 |
-
}
|
2622 |
-
|
2623 |
-
return position;
|
2624 |
-
};
|
2625 |
-
|
2626 |
-
proto._getTopColPosition = function( colSpan ) {
|
2627 |
-
var colGroup = this._getTopColGroup( colSpan );
|
2628 |
-
// get the minimum Y value from the columns
|
2629 |
-
var minimumY = Math.min.apply( Math, colGroup );
|
2630 |
-
|
2631 |
-
return {
|
2632 |
-
col: colGroup.indexOf( minimumY ),
|
2633 |
-
y: minimumY,
|
2634 |
-
};
|
2635 |
-
};
|
2636 |
-
|
2637 |
-
/**
|
2638 |
-
* @param {Number} colSpan - number of columns the element spans
|
2639 |
-
* @returns {Array} colGroup
|
2640 |
-
*/
|
2641 |
-
proto._getTopColGroup = function( colSpan ) {
|
2642 |
-
if ( colSpan < 2 ) {
|
2643 |
-
// if brick spans only one column, use all the column Ys
|
2644 |
-
return this.colYs;
|
2645 |
-
}
|
2646 |
-
|
2647 |
-
var colGroup = [];
|
2648 |
-
// how many different places could this brick fit horizontally
|
2649 |
-
var groupCount = this.cols + 1 - colSpan;
|
2650 |
-
// for each group potential horizontal position
|
2651 |
-
for ( var i = 0; i < groupCount; i++ ) {
|
2652 |
-
colGroup[i] = this._getColGroupY( i, colSpan );
|
2653 |
-
}
|
2654 |
-
return colGroup;
|
2655 |
-
};
|
2656 |
-
|
2657 |
-
proto._getColGroupY = function( col, colSpan ) {
|
2658 |
-
if ( colSpan < 2 ) {
|
2659 |
-
return this.colYs[ col ];
|
2660 |
-
}
|
2661 |
-
// make an array of colY values for that one group
|
2662 |
-
var groupColYs = this.colYs.slice( col, col + colSpan );
|
2663 |
-
// and get the max value of the array
|
2664 |
-
return Math.max.apply( Math, groupColYs );
|
2665 |
-
};
|
2666 |
-
|
2667 |
-
// get column position based on horizontal index. #873
|
2668 |
-
proto._getHorizontalColPosition = function( colSpan, item ) {
|
2669 |
-
var col = this.horizontalColIndex % this.cols;
|
2670 |
-
var isOver = colSpan > 1 && col + colSpan > this.cols;
|
2671 |
-
// shift to next row if item can't fit on current row
|
2672 |
-
col = isOver ? 0 : col;
|
2673 |
-
// don't let zero-size items take up space
|
2674 |
-
var hasSize = item.size.outerWidth && item.size.outerHeight;
|
2675 |
-
this.horizontalColIndex = hasSize ? col + colSpan : this.horizontalColIndex;
|
2676 |
-
|
2677 |
-
return {
|
2678 |
-
col: col,
|
2679 |
-
y: this._getColGroupY( col, colSpan ),
|
2680 |
-
};
|
2681 |
-
};
|
2682 |
-
|
2683 |
-
proto._manageStamp = function( stamp ) {
|
2684 |
-
var stampSize = getSize( stamp );
|
2685 |
-
var offset = this._getElementOffset( stamp );
|
2686 |
-
// get the columns that this stamp affects
|
2687 |
-
var isOriginLeft = this._getOption('originLeft');
|
2688 |
-
var firstX = isOriginLeft ? offset.left : offset.right;
|
2689 |
-
var lastX = firstX + stampSize.outerWidth;
|
2690 |
-
var firstCol = Math.floor( firstX / this.columnWidth );
|
2691 |
-
firstCol = Math.max( 0, firstCol );
|
2692 |
-
var lastCol = Math.floor( lastX / this.columnWidth );
|
2693 |
-
// lastCol should not go over if multiple of columnWidth #425
|
2694 |
-
lastCol -= lastX % this.columnWidth ? 0 : 1;
|
2695 |
-
lastCol = Math.min( this.cols - 1, lastCol );
|
2696 |
-
// set colYs to bottom of the stamp
|
2697 |
-
|
2698 |
-
var isOriginTop = this._getOption('originTop');
|
2699 |
-
var stampMaxY = ( isOriginTop ? offset.top : offset.bottom ) +
|
2700 |
-
stampSize.outerHeight;
|
2701 |
-
for ( var i = firstCol; i <= lastCol; i++ ) {
|
2702 |
-
this.colYs[i] = Math.max( stampMaxY, this.colYs[i] );
|
2703 |
-
}
|
2704 |
-
};
|
2705 |
-
|
2706 |
-
proto._getContainerSize = function() {
|
2707 |
-
this.maxY = Math.max.apply( Math, this.colYs );
|
2708 |
-
var size = {
|
2709 |
-
height: this.maxY
|
2710 |
-
};
|
2711 |
-
|
2712 |
-
if ( this._getOption('fitWidth') ) {
|
2713 |
-
size.width = this._getContainerFitWidth();
|
2714 |
-
}
|
2715 |
-
|
2716 |
-
return size;
|
2717 |
-
};
|
2718 |
-
|
2719 |
-
proto._getContainerFitWidth = function() {
|
2720 |
-
var unusedCols = 0;
|
2721 |
-
// count unused columns
|
2722 |
-
var i = this.cols;
|
2723 |
-
while ( --i ) {
|
2724 |
-
if ( this.colYs[i] !== 0 ) {
|
2725 |
-
break;
|
2726 |
-
}
|
2727 |
-
unusedCols++;
|
2728 |
-
}
|
2729 |
-
// fit container to columns that have been used
|
2730 |
-
return ( this.cols - unusedCols ) * this.columnWidth - this.gutter;
|
2731 |
-
};
|
2732 |
-
|
2733 |
-
proto.needsResizeLayout = function() {
|
2734 |
-
var previousWidth = this.containerWidth;
|
2735 |
-
this.getContainerWidth();
|
2736 |
-
return previousWidth != this.containerWidth;
|
2737 |
-
};
|
2738 |
-
|
2739 |
-
return Masonry;
|
2740 |
-
|
2741 |
-
}));
|
2742 |
-
|
2743 |
-
/*!
|
2744 |
-
* Masonry layout mode
|
2745 |
-
* sub-classes Masonry
|
2746 |
-
* https://masonry.desandro.com
|
2747 |
-
*/
|
2748 |
-
|
2749 |
-
( function( window, factory ) {
|
2750 |
-
// universal module definition
|
2751 |
-
/* jshint strict: false */ /*globals define, module, require */
|
2752 |
-
if ( typeof define == 'function' && define.amd ) {
|
2753 |
-
// AMD
|
2754 |
-
define( 'isotope-layout/js/layout-modes/masonry',[
|
2755 |
-
'../layout-mode',
|
2756 |
-
'masonry-layout/masonry'
|
2757 |
-
],
|
2758 |
-
factory );
|
2759 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
2760 |
-
// CommonJS
|
2761 |
-
module.exports = factory(
|
2762 |
-
require('../layout-mode'),
|
2763 |
-
require('masonry-layout')
|
2764 |
-
);
|
2765 |
-
} else {
|
2766 |
-
// browser global
|
2767 |
-
factory(
|
2768 |
-
window.Isotope.LayoutMode,
|
2769 |
-
window.Masonry
|
2770 |
-
);
|
2771 |
-
}
|
2772 |
-
|
2773 |
-
}( window, function factory( LayoutMode, Masonry ) {
|
2774 |
-
'use strict';
|
2775 |
-
|
2776 |
-
// -------------------------- masonryDefinition -------------------------- //
|
2777 |
-
|
2778 |
-
// create an Outlayer layout class
|
2779 |
-
var MasonryMode = LayoutMode.create('masonry');
|
2780 |
-
|
2781 |
-
var proto = MasonryMode.prototype;
|
2782 |
-
|
2783 |
-
var keepModeMethods = {
|
2784 |
-
_getElementOffset: true,
|
2785 |
-
layout: true,
|
2786 |
-
_getMeasurement: true
|
2787 |
-
};
|
2788 |
-
|
2789 |
-
// inherit Masonry prototype
|
2790 |
-
for ( var method in Masonry.prototype ) {
|
2791 |
-
// do not inherit mode methods
|
2792 |
-
if ( !keepModeMethods[ method ] ) {
|
2793 |
-
proto[ method ] = Masonry.prototype[ method ];
|
2794 |
-
}
|
2795 |
-
}
|
2796 |
-
|
2797 |
-
var measureColumns = proto.measureColumns;
|
2798 |
-
proto.measureColumns = function() {
|
2799 |
-
// set items, used if measuring first item
|
2800 |
-
this.items = this.isotope.filteredItems;
|
2801 |
-
measureColumns.call( this );
|
2802 |
-
};
|
2803 |
-
|
2804 |
-
// point to mode options for fitWidth
|
2805 |
-
var _getOption = proto._getOption;
|
2806 |
-
proto._getOption = function( option ) {
|
2807 |
-
if ( option == 'fitWidth' ) {
|
2808 |
-
return this.options.isFitWidth !== undefined ?
|
2809 |
-
this.options.isFitWidth : this.options.fitWidth;
|
2810 |
-
}
|
2811 |
-
return _getOption.apply( this.isotope, arguments );
|
2812 |
-
};
|
2813 |
-
|
2814 |
-
return MasonryMode;
|
2815 |
-
|
2816 |
-
}));
|
2817 |
-
|
2818 |
-
/**
|
2819 |
-
* fitRows layout mode
|
2820 |
-
*/
|
2821 |
-
|
2822 |
-
( function( window, factory ) {
|
2823 |
-
// universal module definition
|
2824 |
-
/* jshint strict: false */ /*globals define, module, require */
|
2825 |
-
if ( typeof define == 'function' && define.amd ) {
|
2826 |
-
// AMD
|
2827 |
-
define( 'isotope-layout/js/layout-modes/fit-rows',[
|
2828 |
-
'../layout-mode'
|
2829 |
-
],
|
2830 |
-
factory );
|
2831 |
-
} else if ( typeof exports == 'object' ) {
|
2832 |
-
// CommonJS
|
2833 |
-
module.exports = factory(
|
2834 |
-
require('../layout-mode')
|
2835 |
-
);
|
2836 |
-
} else {
|
2837 |
-
// browser global
|
2838 |
-
factory(
|
2839 |
-
window.Isotope.LayoutMode
|
2840 |
-
);
|
2841 |
-
}
|
2842 |
-
|
2843 |
-
}( window, function factory( LayoutMode ) {
|
2844 |
-
'use strict';
|
2845 |
-
|
2846 |
-
var FitRows = LayoutMode.create('fitRows');
|
2847 |
-
|
2848 |
-
var proto = FitRows.prototype;
|
2849 |
-
|
2850 |
-
proto._resetLayout = function() {
|
2851 |
-
this.x = 0;
|
2852 |
-
this.y = 0;
|
2853 |
-
this.maxY = 0;
|
2854 |
-
this._getMeasurement( 'gutter', 'outerWidth' );
|
2855 |
-
};
|
2856 |
-
|
2857 |
-
proto._getItemLayoutPosition = function( item ) {
|
2858 |
-
item.getSize();
|
2859 |
-
|
2860 |
-
var itemWidth = item.size.outerWidth + this.gutter;
|
2861 |
-
// if this element cannot fit in the current row
|
2862 |
-
var containerWidth = this.isotope.size.innerWidth + this.gutter;
|
2863 |
-
if ( this.x !== 0 && itemWidth + this.x > containerWidth ) {
|
2864 |
-
this.x = 0;
|
2865 |
-
this.y = this.maxY;
|
2866 |
-
}
|
2867 |
-
|
2868 |
-
var position = {
|
2869 |
-
x: this.x,
|
2870 |
-
y: this.y
|
2871 |
-
};
|
2872 |
-
|
2873 |
-
this.maxY = Math.max( this.maxY, this.y + item.size.outerHeight );
|
2874 |
-
this.x += itemWidth;
|
2875 |
-
|
2876 |
-
return position;
|
2877 |
-
};
|
2878 |
-
|
2879 |
-
proto._getContainerSize = function() {
|
2880 |
-
return { height: this.maxY };
|
2881 |
-
};
|
2882 |
-
|
2883 |
-
return FitRows;
|
2884 |
-
|
2885 |
-
}));
|
2886 |
-
|
2887 |
-
/**
|
2888 |
-
* vertical layout mode
|
2889 |
-
*/
|
2890 |
-
|
2891 |
-
( function( window, factory ) {
|
2892 |
-
// universal module definition
|
2893 |
-
/* jshint strict: false */ /*globals define, module, require */
|
2894 |
-
if ( typeof define == 'function' && define.amd ) {
|
2895 |
-
// AMD
|
2896 |
-
define( 'isotope-layout/js/layout-modes/vertical',[
|
2897 |
-
'../layout-mode'
|
2898 |
-
],
|
2899 |
-
factory );
|
2900 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
2901 |
-
// CommonJS
|
2902 |
-
module.exports = factory(
|
2903 |
-
require('../layout-mode')
|
2904 |
-
);
|
2905 |
-
} else {
|
2906 |
-
// browser global
|
2907 |
-
factory(
|
2908 |
-
window.Isotope.LayoutMode
|
2909 |
-
);
|
2910 |
-
}
|
2911 |
-
|
2912 |
-
}( window, function factory( LayoutMode ) {
|
2913 |
-
'use strict';
|
2914 |
-
|
2915 |
-
var Vertical = LayoutMode.create( 'vertical', {
|
2916 |
-
horizontalAlignment: 0
|
2917 |
-
});
|
2918 |
-
|
2919 |
-
var proto = Vertical.prototype;
|
2920 |
-
|
2921 |
-
proto._resetLayout = function() {
|
2922 |
-
this.y = 0;
|
2923 |
-
};
|
2924 |
-
|
2925 |
-
proto._getItemLayoutPosition = function( item ) {
|
2926 |
-
item.getSize();
|
2927 |
-
var x = ( this.isotope.size.innerWidth - item.size.outerWidth ) *
|
2928 |
-
this.options.horizontalAlignment;
|
2929 |
-
var y = this.y;
|
2930 |
-
this.y += item.size.outerHeight;
|
2931 |
-
return { x: x, y: y };
|
2932 |
-
};
|
2933 |
-
|
2934 |
-
proto._getContainerSize = function() {
|
2935 |
-
return { height: this.y };
|
2936 |
-
};
|
2937 |
-
|
2938 |
-
return Vertical;
|
2939 |
-
|
2940 |
-
}));
|
2941 |
-
|
2942 |
-
/*!
|
2943 |
-
* Isotope v3.0.6
|
2944 |
-
*
|
2945 |
-
* Licensed GPLv3 for open source use
|
2946 |
-
* or Isotope Commercial License for commercial use
|
2947 |
-
*
|
2948 |
-
* https://isotope.metafizzy.co
|
2949 |
-
* Copyright 2010-2018 Metafizzy
|
2950 |
-
*/
|
2951 |
-
|
2952 |
-
( function( window, factory ) {
|
2953 |
-
// universal module definition
|
2954 |
-
/* jshint strict: false */ /*globals define, module, require */
|
2955 |
-
if ( typeof define == 'function' && define.amd ) {
|
2956 |
-
// AMD
|
2957 |
-
define( [
|
2958 |
-
'outlayer/outlayer',
|
2959 |
-
'get-size/get-size',
|
2960 |
-
'desandro-matches-selector/matches-selector',
|
2961 |
-
'fizzy-ui-utils/utils',
|
2962 |
-
'isotope-layout/js/item',
|
2963 |
-
'isotope-layout/js/layout-mode',
|
2964 |
-
// include default layout modes
|
2965 |
-
'isotope-layout/js/layout-modes/masonry',
|
2966 |
-
'isotope-layout/js/layout-modes/fit-rows',
|
2967 |
-
'isotope-layout/js/layout-modes/vertical'
|
2968 |
-
],
|
2969 |
-
function( Outlayer, getSize, matchesSelector, utils, Item, LayoutMode ) {
|
2970 |
-
return factory( window, Outlayer, getSize, matchesSelector, utils, Item, LayoutMode );
|
2971 |
-
});
|
2972 |
-
} else if ( typeof module == 'object' && module.exports ) {
|
2973 |
-
// CommonJS
|
2974 |
-
module.exports = factory(
|
2975 |
-
window,
|
2976 |
-
require('outlayer'),
|
2977 |
-
require('get-size'),
|
2978 |
-
require('desandro-matches-selector'),
|
2979 |
-
require('fizzy-ui-utils'),
|
2980 |
-
require('isotope-layout/js/item'),
|
2981 |
-
require('isotope-layout/js/layout-mode'),
|
2982 |
-
// include default layout modes
|
2983 |
-
require('isotope-layout/js/layout-modes/masonry'),
|
2984 |
-
require('isotope-layout/js/layout-modes/fit-rows'),
|
2985 |
-
require('isotope-layout/js/layout-modes/vertical')
|
2986 |
-
);
|
2987 |
-
} else {
|
2988 |
-
// browser global
|
2989 |
-
window.Isotope = factory(
|
2990 |
-
window,
|
2991 |
-
window.Outlayer,
|
2992 |
-
window.getSize,
|
2993 |
-
window.matchesSelector,
|
2994 |
-
window.fizzyUIUtils,
|
2995 |
-
window.Isotope.Item,
|
2996 |
-
window.Isotope.LayoutMode
|
2997 |
-
);
|
2998 |
-
}
|
2999 |
-
|
3000 |
-
}( window, function factory( window, Outlayer, getSize, matchesSelector, utils,
|
3001 |
-
Item, LayoutMode ) {
|
3002 |
-
|
3003 |
-
|
3004 |
-
|
3005 |
-
// -------------------------- vars -------------------------- //
|
3006 |
-
|
3007 |
-
var jQuery = window.jQuery;
|
3008 |
-
|
3009 |
-
// -------------------------- helpers -------------------------- //
|
3010 |
-
|
3011 |
-
var trim = String.prototype.trim ?
|
3012 |
-
function( str ) {
|
3013 |
-
return str.trim();
|
3014 |
-
} :
|
3015 |
-
function( str ) {
|
3016 |
-
return str.replace( /^\s+|\s+$/g, '' );
|
3017 |
-
};
|
3018 |
-
|
3019 |
-
// -------------------------- isotopeDefinition -------------------------- //
|
3020 |
-
|
3021 |
-
// create an Outlayer layout class
|
3022 |
-
var Isotope = Outlayer.create( 'isotope', {
|
3023 |
-
layoutMode: 'masonry',
|
3024 |
-
isJQueryFiltering: true,
|
3025 |
-
sortAscending: true
|
3026 |
-
});
|
3027 |
-
|
3028 |
-
Isotope.Item = Item;
|
3029 |
-
Isotope.LayoutMode = LayoutMode;
|
3030 |
-
|
3031 |
-
var proto = Isotope.prototype;
|
3032 |
-
|
3033 |
-
proto._create = function() {
|
3034 |
-
this.itemGUID = 0;
|
3035 |
-
// functions that sort items
|
3036 |
-
this._sorters = {};
|
3037 |
-
this._getSorters();
|
3038 |
-
// call super
|
3039 |
-
Outlayer.prototype._create.call( this );
|
3040 |
-
|
3041 |
-
// create layout modes
|
3042 |
-
this.modes = {};
|
3043 |
-
// start filteredItems with all items
|
3044 |
-
this.filteredItems = this.items;
|
3045 |
-
// keep of track of sortBys
|
3046 |
-
this.sortHistory = [ 'original-order' ];
|
3047 |
-
// create from registered layout modes
|
3048 |
-
for ( var name in LayoutMode.modes ) {
|
3049 |
-
this._initLayoutMode( name );
|
3050 |
-
}
|
3051 |
-
};
|
3052 |
-
|
3053 |
-
proto.reloadItems = function() {
|
3054 |
-
// reset item ID counter
|
3055 |
-
this.itemGUID = 0;
|
3056 |
-
// call super
|
3057 |
-
Outlayer.prototype.reloadItems.call( this );
|
3058 |
-
};
|
3059 |
-
|
3060 |
-
proto._itemize = function() {
|
3061 |
-
var items = Outlayer.prototype._itemize.apply( this, arguments );
|
3062 |
-
// assign ID for original-order
|
3063 |
-
for ( var i=0; i < items.length; i++ ) {
|
3064 |
-
var item = items[i];
|
3065 |
-
item.id = this.itemGUID++;
|
3066 |
-
}
|
3067 |
-
this._updateItemsSortData( items );
|
3068 |
-
return items;
|
3069 |
-
};
|
3070 |
-
|
3071 |
-
|
3072 |
-
// -------------------------- layout -------------------------- //
|
3073 |
-
|
3074 |
-
proto._initLayoutMode = function( name ) {
|
3075 |
-
var Mode = LayoutMode.modes[ name ];
|
3076 |
-
// set mode options
|
3077 |
-
// HACK extend initial options, back-fill in default options
|
3078 |
-
var initialOpts = this.options[ name ] || {};
|
3079 |
-
this.options[ name ] = Mode.options ?
|
3080 |
-
utils.extend( Mode.options, initialOpts ) : initialOpts;
|
3081 |
-
// init layout mode instance
|
3082 |
-
this.modes[ name ] = new Mode( this );
|
3083 |
-
};
|
3084 |
-
|
3085 |
-
|
3086 |
-
proto.layout = function() {
|
3087 |
-
// if first time doing layout, do all magic
|
3088 |
-
if ( !this._isLayoutInited && this._getOption('initLayout') ) {
|
3089 |
-
this.arrange();
|
3090 |
-
return;
|
3091 |
-
}
|
3092 |
-
this._layout();
|
3093 |
-
};
|
3094 |
-
|
3095 |
-
// private method to be used in layout() & magic()
|
3096 |
-
proto._layout = function() {
|
3097 |
-
// don't animate first layout
|
3098 |
-
var isInstant = this._getIsInstant();
|
3099 |
-
// layout flow
|
3100 |
-
this._resetLayout();
|
3101 |
-
this._manageStamps();
|
3102 |
-
this.layoutItems( this.filteredItems, isInstant );
|
3103 |
-
|
3104 |
-
// flag for initalized
|
3105 |
-
this._isLayoutInited = true;
|
3106 |
-
};
|
3107 |
-
|
3108 |
-
// filter + sort + layout
|
3109 |
-
proto.arrange = function( opts ) {
|
3110 |
-
// set any options pass
|
3111 |
-
this.option( opts );
|
3112 |
-
this._getIsInstant();
|
3113 |
-
// filter, sort, and layout
|
3114 |
-
|
3115 |
-
// filter
|
3116 |
-
var filtered = this._filter( this.items );
|
3117 |
-
this.filteredItems = filtered.matches;
|
3118 |
-
|
3119 |
-
this._bindArrangeComplete();
|
3120 |
-
|
3121 |
-
if ( this._isInstant ) {
|
3122 |
-
this._noTransition( this._hideReveal, [ filtered ] );
|
3123 |
-
} else {
|
3124 |
-
this._hideReveal( filtered );
|
3125 |
-
}
|
3126 |
-
|
3127 |
-
this._sort();
|
3128 |
-
this._layout();
|
3129 |
-
};
|
3130 |
-
// alias to _init for main plugin method
|
3131 |
-
proto._init = proto.arrange;
|
3132 |
-
|
3133 |
-
proto._hideReveal = function( filtered ) {
|
3134 |
-
this.reveal( filtered.needReveal );
|
3135 |
-
this.hide( filtered.needHide );
|
3136 |
-
};
|
3137 |
-
|
3138 |
-
// HACK
|
3139 |
-
// Don't animate/transition first layout
|
3140 |
-
// Or don't animate/transition other layouts
|
3141 |
-
proto._getIsInstant = function() {
|
3142 |
-
var isLayoutInstant = this._getOption('layoutInstant');
|
3143 |
-
var isInstant = isLayoutInstant !== undefined ? isLayoutInstant :
|
3144 |
-
!this._isLayoutInited;
|
3145 |
-
this._isInstant = isInstant;
|
3146 |
-
return isInstant;
|
3147 |
-
};
|
3148 |
-
|
3149 |
-
// listen for layoutComplete, hideComplete and revealComplete
|
3150 |
-
// to trigger arrangeComplete
|
3151 |
-
proto._bindArrangeComplete = function() {
|
3152 |
-
// listen for 3 events to trigger arrangeComplete
|
3153 |
-
var isLayoutComplete, isHideComplete, isRevealComplete;
|
3154 |
-
var _this = this;
|
3155 |
-
function arrangeParallelCallback() {
|
3156 |
-
if ( isLayoutComplete && isHideComplete && isRevealComplete ) {
|
3157 |
-
_this.dispatchEvent( 'arrangeComplete', null, [ _this.filteredItems ] );
|
3158 |
-
}
|
3159 |
-
}
|
3160 |
-
this.once( 'layoutComplete', function() {
|
3161 |
-
isLayoutComplete = true;
|
3162 |
-
arrangeParallelCallback();
|
3163 |
-
});
|
3164 |
-
this.once( 'hideComplete', function() {
|
3165 |
-
isHideComplete = true;
|
3166 |
-
arrangeParallelCallback();
|
3167 |
-
});
|
3168 |
-
this.once( 'revealComplete', function() {
|
3169 |
-
isRevealComplete = true;
|
3170 |
-
arrangeParallelCallback();
|
3171 |
-
});
|
3172 |
-
};
|
3173 |
-
|
3174 |
-
// -------------------------- filter -------------------------- //
|
3175 |
-
|
3176 |
-
proto._filter = function( items ) {
|
3177 |
-
var filter = this.options.filter;
|
3178 |
-
filter = filter || '*';
|
3179 |
-
var matches = [];
|
3180 |
-
var hiddenMatched = [];
|
3181 |
-
var visibleUnmatched = [];
|
3182 |
-
|
3183 |
-
var test = this._getFilterTest( filter );
|
3184 |
-
|
3185 |
-
// test each item
|
3186 |
-
for ( var i=0; i < items.length; i++ ) {
|
3187 |
-
var item = items[i];
|
3188 |
-
if ( item.isIgnored ) {
|
3189 |
-
continue;
|
3190 |
-
}
|
3191 |
-
// add item to either matched or unmatched group
|
3192 |
-
var isMatched = test( item );
|
3193 |
-
// item.isFilterMatched = isMatched;
|
3194 |
-
// add to matches if its a match
|
3195 |
-
if ( isMatched ) {
|
3196 |
-
matches.push( item );
|
3197 |
-
}
|
3198 |
-
// add to additional group if item needs to be hidden or revealed
|
3199 |
-
if ( isMatched && item.isHidden ) {
|
3200 |
-
hiddenMatched.push( item );
|
3201 |
-
} else if ( !isMatched && !item.isHidden ) {
|
3202 |
-
visibleUnmatched.push( item );
|
3203 |
-
}
|
3204 |
-
}
|
3205 |
-
|
3206 |
-
// return collections of items to be manipulated
|
3207 |
-
return {
|
3208 |
-
matches: matches,
|
3209 |
-
needReveal: hiddenMatched,
|
3210 |
-
needHide: visibleUnmatched
|
3211 |
-
};
|
3212 |
-
};
|
3213 |
-
|
3214 |
-
// get a jQuery, function, or a matchesSelector test given the filter
|
3215 |
-
proto._getFilterTest = function( filter ) {
|
3216 |
-
if ( jQuery && this.options.isJQueryFiltering ) {
|
3217 |
-
// use jQuery
|
3218 |
-
return function( item ) {
|
3219 |
-
return jQuery( item.element ).is( filter );
|
3220 |
-
};
|
3221 |
-
}
|
3222 |
-
if ( typeof filter == 'function' ) {
|
3223 |
-
// use filter as function
|
3224 |
-
return function( item ) {
|
3225 |
-
return filter( item.element );
|
3226 |
-
};
|
3227 |
-
}
|
3228 |
-
// default, use filter as selector string
|
3229 |
-
return function( item ) {
|
3230 |
-
return matchesSelector( item.element, filter );
|
3231 |
-
};
|
3232 |
-
};
|
3233 |
-
|
3234 |
-
// -------------------------- sorting -------------------------- //
|
3235 |
-
|
3236 |
-
/**
|
3237 |
-
* @params {Array} elems
|
3238 |
-
* @public
|
3239 |
-
*/
|
3240 |
-
proto.updateSortData = function( elems ) {
|
3241 |
-
// get items
|
3242 |
-
var items;
|
3243 |
-
if ( elems ) {
|
3244 |
-
elems = utils.makeArray( elems );
|
3245 |
-
items = this.getItems( elems );
|
3246 |
-
} else {
|
3247 |
-
// update all items if no elems provided
|
3248 |
-
items = this.items;
|
3249 |
-
}
|
3250 |
-
|
3251 |
-
this._getSorters();
|
3252 |
-
this._updateItemsSortData( items );
|
3253 |
-
};
|
3254 |
-
|
3255 |
-
proto._getSorters = function() {
|
3256 |
-
var getSortData = this.options.getSortData;
|
3257 |
-
for ( var key in getSortData ) {
|
3258 |
-
var sorter = getSortData[ key ];
|
3259 |
-
this._sorters[ key ] = mungeSorter( sorter );
|
3260 |
-
}
|
3261 |
-
};
|
3262 |
-
|
3263 |
-
/**
|
3264 |
-
* @params {Array} items - of Isotope.Items
|
3265 |
-
* @private
|
3266 |
-
*/
|
3267 |
-
proto._updateItemsSortData = function( items ) {
|
3268 |
-
// do not update if no items
|
3269 |
-
var len = items && items.length;
|
3270 |
-
|
3271 |
-
for ( var i=0; len && i < len; i++ ) {
|
3272 |
-
var item = items[i];
|
3273 |
-
item.updateSortData();
|
3274 |
-
}
|
3275 |
-
};
|
3276 |
-
|
3277 |
-
// ----- munge sorter ----- //
|
3278 |
-
|
3279 |
-
// encapsulate this, as we just need mungeSorter
|
3280 |
-
// other functions in here are just for munging
|
3281 |
-
var mungeSorter = ( function() {
|
3282 |
-
// add a magic layer to sorters for convienent shorthands
|
3283 |
-
// `.foo-bar` will use the text of .foo-bar querySelector
|
3284 |
-
// `[foo-bar]` will use attribute
|
3285 |
-
// you can also add parser
|
3286 |
-
// `.foo-bar parseInt` will parse that as a number
|
3287 |
-
function mungeSorter( sorter ) {
|
3288 |
-
// if not a string, return function or whatever it is
|
3289 |
-
if ( typeof sorter != 'string' ) {
|
3290 |
-
return sorter;
|
3291 |
-
}
|
3292 |
-
// parse the sorter string
|
3293 |
-
var args = trim( sorter ).split(' ');
|
3294 |
-
var query = args[0];
|
3295 |
-
// check if query looks like [an-attribute]
|
3296 |
-
var attrMatch = query.match( /^\[(.+)\]$/ );
|
3297 |
-
var attr = attrMatch && attrMatch[1];
|
3298 |
-
var getValue = getValueGetter( attr, query );
|
3299 |
-
// use second argument as a parser
|
3300 |
-
var parser = Isotope.sortDataParsers[ args[1] ];
|
3301 |
-
// parse the value, if there was a parser
|
3302 |
-
sorter = parser ? function( elem ) {
|
3303 |
-
return elem && parser( getValue( elem ) );
|
3304 |
-
} :
|
3305 |
-
// otherwise just return value
|
3306 |
-
function( elem ) {
|
3307 |
-
return elem && getValue( elem );
|
3308 |
-
};
|
3309 |
-
|
3310 |
-
return sorter;
|
3311 |
-
}
|
3312 |
-
|
3313 |
-
// get an attribute getter, or get text of the querySelector
|
3314 |
-
function getValueGetter( attr, query ) {
|
3315 |
-
// if query looks like [foo-bar], get attribute
|
3316 |
-
if ( attr ) {
|
3317 |
-
return function getAttribute( elem ) {
|
3318 |
-
return elem.getAttribute( attr );
|
3319 |
-
};
|
3320 |
-
}
|
3321 |
-
|
3322 |
-
// otherwise, assume its a querySelector, and get its text
|
3323 |
-
return function getChildText( elem ) {
|
3324 |
-
var child = elem.querySelector( query );
|
3325 |
-
return child && child.textContent;
|
3326 |
-
};
|
3327 |
-
}
|
3328 |
-
|
3329 |
-
return mungeSorter;
|
3330 |
-
})();
|
3331 |
-
|
3332 |
-
// parsers used in getSortData shortcut strings
|
3333 |
-
Isotope.sortDataParsers = {
|
3334 |
-
'parseInt': function( val ) {
|
3335 |
-
return parseInt( val, 10 );
|
3336 |
-
},
|
3337 |
-
'parseFloat': function( val ) {
|
3338 |
-
return parseFloat( val );
|
3339 |
-
}
|
3340 |
-
};
|
3341 |
-
|
3342 |
-
// ----- sort method ----- //
|
3343 |
-
|
3344 |
-
// sort filteredItem order
|
3345 |
-
proto._sort = function() {
|
3346 |
-
if ( !this.options.sortBy ) {
|
3347 |
-
return;
|
3348 |
-
}
|
3349 |
-
// keep track of sortBy History
|
3350 |
-
var sortBys = utils.makeArray( this.options.sortBy );
|
3351 |
-
if ( !this._getIsSameSortBy( sortBys ) ) {
|
3352 |
-
// concat all sortBy and sortHistory, add to front, oldest goes in last
|
3353 |
-
this.sortHistory = sortBys.concat( this.sortHistory );
|
3354 |
-
}
|
3355 |
-
// sort magic
|
3356 |
-
var itemSorter = getItemSorter( this.sortHistory, this.options.sortAscending );
|
3357 |
-
this.filteredItems.sort( itemSorter );
|
3358 |
-
};
|
3359 |
-
|
3360 |
-
// check if sortBys is same as start of sortHistory
|
3361 |
-
proto._getIsSameSortBy = function( sortBys ) {
|
3362 |
-
for ( var i=0; i < sortBys.length; i++ ) {
|
3363 |
-
if ( sortBys[i] != this.sortHistory[i] ) {
|
3364 |
-
return false;
|
3365 |
-
}
|
3366 |
-
}
|
3367 |
-
return true;
|
3368 |
-
};
|
3369 |
-
|
3370 |
-
// returns a function used for sorting
|
3371 |
-
function getItemSorter( sortBys, sortAsc ) {
|
3372 |
-
return function sorter( itemA, itemB ) {
|
3373 |
-
// cycle through all sortKeys
|
3374 |
-
for ( var i = 0; i < sortBys.length; i++ ) {
|
3375 |
-
var sortBy = sortBys[i];
|
3376 |
-
var a = itemA.sortData[ sortBy ];
|
3377 |
-
var b = itemB.sortData[ sortBy ];
|
3378 |
-
if ( a > b || a < b ) {
|
3379 |
-
// if sortAsc is an object, use the value given the sortBy key
|
3380 |
-
var isAscending = sortAsc[ sortBy ] !== undefined ? sortAsc[ sortBy ] : sortAsc;
|
3381 |
-
var direction = isAscending ? 1 : -1;
|
3382 |
-
return ( a > b ? 1 : -1 ) * direction;
|
3383 |
-
}
|
3384 |
-
}
|
3385 |
-
return 0;
|
3386 |
-
};
|
3387 |
-
}
|
3388 |
-
|
3389 |
-
// -------------------------- methods -------------------------- //
|
3390 |
-
|
3391 |
-
// get layout mode
|
3392 |
-
proto._mode = function() {
|
3393 |
-
var layoutMode = this.options.layoutMode;
|
3394 |
-
var mode = this.modes[ layoutMode ];
|
3395 |
-
if ( !mode ) {
|
3396 |
-
// TODO console.error
|
3397 |
-
throw new Error( 'No layout mode: ' + layoutMode );
|
3398 |
-
}
|
3399 |
-
// HACK sync mode's options
|
3400 |
-
// any options set after init for layout mode need to be synced
|
3401 |
-
mode.options = this.options[ layoutMode ];
|
3402 |
-
return mode;
|
3403 |
-
};
|
3404 |
-
|
3405 |
-
proto._resetLayout = function() {
|
3406 |
-
// trigger original reset layout
|
3407 |
-
Outlayer.prototype._resetLayout.call( this );
|
3408 |
-
this._mode()._resetLayout();
|
3409 |
-
};
|
3410 |
-
|
3411 |
-
proto._getItemLayoutPosition = function( item ) {
|
3412 |
-
return this._mode()._getItemLayoutPosition( item );
|
3413 |
-
};
|
3414 |
-
|
3415 |
-
proto._manageStamp = function( stamp ) {
|
3416 |
-
this._mode()._manageStamp( stamp );
|
3417 |
-
};
|
3418 |
-
|
3419 |
-
proto._getContainerSize = function() {
|
3420 |
-
return this._mode()._getContainerSize();
|
3421 |
-
};
|
3422 |
-
|
3423 |
-
proto.needsResizeLayout = function() {
|
3424 |
-
return this._mode().needsResizeLayout();
|
3425 |
-
};
|
3426 |
-
|
3427 |
-
// -------------------------- adding & removing -------------------------- //
|
3428 |
-
|
3429 |
-
// HEADS UP overwrites default Outlayer appended
|
3430 |
-
proto.appended = function( elems ) {
|
3431 |
-
var items = this.addItems( elems );
|
3432 |
-
if ( !items.length ) {
|
3433 |
-
return;
|
3434 |
-
}
|
3435 |
-
// filter, layout, reveal new items
|
3436 |
-
var filteredItems = this._filterRevealAdded( items );
|
3437 |
-
// add to filteredItems
|
3438 |
-
this.filteredItems = this.filteredItems.concat( filteredItems );
|
3439 |
-
};
|
3440 |
-
|
3441 |
-
// HEADS UP overwrites default Outlayer prepended
|
3442 |
-
proto.prepended = function( elems ) {
|
3443 |
-
var items = this._itemize( elems );
|
3444 |
-
if ( !items.length ) {
|
3445 |
-
return;
|
3446 |
-
}
|
3447 |
-
// start new layout
|
3448 |
-
this._resetLayout();
|
3449 |
-
this._manageStamps();
|
3450 |
-
// filter, layout, reveal new items
|
3451 |
-
var filteredItems = this._filterRevealAdded( items );
|
3452 |
-
// layout previous items
|
3453 |
-
this.layoutItems( this.filteredItems );
|
3454 |
-
// add to items and filteredItems
|
3455 |
-
this.filteredItems = filteredItems.concat( this.filteredItems );
|
3456 |
-
this.items = items.concat( this.items );
|
3457 |
-
};
|
3458 |
-
|
3459 |
-
proto._filterRevealAdded = function( items ) {
|
3460 |
-
var filtered = this._filter( items );
|
3461 |
-
this.hide( filtered.needHide );
|
3462 |
-
// reveal all new items
|
3463 |
-
this.reveal( filtered.matches );
|
3464 |
-
// layout new items, no transition
|
3465 |
-
this.layoutItems( filtered.matches, true );
|
3466 |
-
return filtered.matches;
|
3467 |
-
};
|
3468 |
-
|
3469 |
-
/**
|
3470 |
-
* Filter, sort, and layout newly-appended item elements
|
3471 |
-
* @param {Array or NodeList or Element} elems
|
3472 |
-
*/
|
3473 |
-
proto.insert = function( elems ) {
|
3474 |
-
var items = this.addItems( elems );
|
3475 |
-
if ( !items.length ) {
|
3476 |
-
return;
|
3477 |
-
}
|
3478 |
-
// append item elements
|
3479 |
-
var i, item;
|
3480 |
-
var len = items.length;
|
3481 |
-
for ( i=0; i < len; i++ ) {
|
3482 |
-
item = items[i];
|
3483 |
-
this.element.appendChild( item.element );
|
3484 |
-
}
|
3485 |
-
// filter new stuff
|
3486 |
-
var filteredInsertItems = this._filter( items ).matches;
|
3487 |
-
// set flag
|
3488 |
-
for ( i=0; i < len; i++ ) {
|
3489 |
-
items[i].isLayoutInstant = true;
|
3490 |
-
}
|
3491 |
-
this.arrange();
|
3492 |
-
// reset flag
|
3493 |
-
for ( i=0; i < len; i++ ) {
|
3494 |
-
delete items[i].isLayoutInstant;
|
3495 |
-
}
|
3496 |
-
this.reveal( filteredInsertItems );
|
3497 |
-
};
|
3498 |
-
|
3499 |
-
var _remove = proto.remove;
|
3500 |
-
proto.remove = function( elems ) {
|
3501 |
-
elems = utils.makeArray( elems );
|
3502 |
-
var removeItems = this.getItems( elems );
|
3503 |
-
// do regular thing
|
3504 |
-
_remove.call( this, elems );
|
3505 |
-
// bail if no items to remove
|
3506 |
-
var len = removeItems && removeItems.length;
|
3507 |
-
// remove elems from filteredItems
|
3508 |
-
for ( var i=0; len && i < len; i++ ) {
|
3509 |
-
var item = removeItems[i];
|
3510 |
-
// remove item from collection
|
3511 |
-
utils.removeFrom( this.filteredItems, item );
|
3512 |
-
}
|
3513 |
-
};
|
3514 |
-
|
3515 |
-
proto.shuffle = function() {
|
3516 |
-
// update random sortData
|
3517 |
-
for ( var i=0; i < this.items.length; i++ ) {
|
3518 |
-
var item = this.items[i];
|
3519 |
-
item.sortData.random = Math.random();
|
3520 |
-
}
|
3521 |
-
this.options.sortBy = 'random';
|
3522 |
-
this._sort();
|
3523 |
-
this._layout();
|
3524 |
-
};
|
3525 |
-
|
3526 |
-
/**
|
3527 |
-
* trigger fn without transition
|
3528 |
-
* kind of hacky to have this in the first place
|
3529 |
-
* @param {Function} fn
|
3530 |
-
* @param {Array} args
|
3531 |
-
* @returns ret
|
3532 |
-
* @private
|
3533 |
-
*/
|
3534 |
-
proto._noTransition = function( fn, args ) {
|
3535 |
-
// save transitionDuration before disabling
|
3536 |
-
var transitionDuration = this.options.transitionDuration;
|
3537 |
-
// disable transition
|
3538 |
-
this.options.transitionDuration = 0;
|
3539 |
-
// do it
|
3540 |
-
var returnValue = fn.apply( this, args );
|
3541 |
-
// re-enable transition for reveal
|
3542 |
-
this.options.transitionDuration = transitionDuration;
|
3543 |
-
return returnValue;
|
3544 |
-
};
|
3545 |
-
|
3546 |
-
// ----- helper methods ----- //
|
3547 |
-
|
3548 |
-
/**
|
3549 |
-
* getter method for getting filtered item elements
|
3550 |
-
* @returns {Array} elems - collection of item elements
|
3551 |
-
*/
|
3552 |
-
proto.getFilteredItemElements = function() {
|
3553 |
-
return this.filteredItems.map( function( item ) {
|
3554 |
-
return item.element;
|
3555 |
-
});
|
3556 |
-
};
|
3557 |
-
|
3558 |
-
// ----- ----- //
|
3559 |
-
|
3560 |
-
return Isotope;
|
3561 |
-
|
3562 |
-
}));
|
3563 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assets/vendor/select2/select2.min.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;height:1px !important;margin:-1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
|
1 |
+
.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{background-color:transparent;border:none;font-size:1em}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline;list-style:none;padding:0}.select2-container .select2-selection--multiple .select2-selection__clear{background-color:transparent;border:none;font-size:1em}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;margin-left:5px;padding:0;max-width:100%;resize:none;height:18px;vertical-align:bottom;font-family:sans-serif;overflow:hidden;word-break:keep-all}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option--selectable{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;height:26px;margin-right:20px;padding-right:0px}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;padding-bottom:5px;padding-right:5px;position:relative}.select2-container--default .select2-selection--multiple.select2-selection--clearable{padding-right:25px}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;font-weight:bold;height:20px;margin-right:10px;margin-top:5px;position:absolute;right:0;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:inline-block;margin-left:5px;margin-top:5px;padding:0;padding-left:20px;position:relative;max-width:100%;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom;white-space:nowrap}.select2-container--default .select2-selection--multiple .select2-selection__choice__display{cursor:default;padding-left:2px;padding-right:5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{background-color:transparent;border:none;border-right:1px solid #aaa;border-top-left-radius:4px;border-bottom-left-radius:4px;color:#999;cursor:pointer;font-size:1em;font-weight:bold;padding:0 4px;position:absolute;left:0;top:0}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover,.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus{background-color:#f1f1f1;color:#333;outline:none}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__display{padding-left:5px;padding-right:2px}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{border-left:1px solid #aaa;border-right:none;border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:4px;border-bottom-right-radius:4px}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__clear{float:left;margin-left:10px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--group{padding:0}.select2-container--default .select2-results__option--disabled{color:#999}.select2-container--default .select2-results__option--selected{background-color:#ddd}.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;height:26px;margin-right:20px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0;padding-bottom:5px;padding-right:5px}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;display:inline-block;margin-left:5px;margin-top:5px;padding:0}.select2-container--classic .select2-selection--multiple .select2-selection__choice__display{cursor:default;padding-left:2px;padding-right:5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{background-color:transparent;border:none;border-top-left-radius:4px;border-bottom-left-radius:4px;color:#888;cursor:pointer;font-size:1em;font-weight:bold;padding:0 4px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555;outline:none}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__display{padding-left:5px;padding-right:2px}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{border-top-left-radius:0;border-bottom-left-radius:0;border-top-right-radius:4px;border-bottom-right-radius:4px}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option--group{padding:0}.select2-container--classic .select2-results__option--disabled{color:grey}.select2-container--classic .select2-results__option--highlighted.select2-results__option--selectable{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
|
assets/vendor/select2/select2.min.js
CHANGED
@@ -1,3 +1,2 @@
|
|
1 |
-
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return u.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n=b&&b.split("/"),o=s.map,p=o&&o["*"]||{};if(a&&"."===a.charAt(0))if(b){for(a=a.split("/"),g=a.length-1,s.nodeIdCompat&&w.test(a[g])&&(a[g]=a[g].replace(w,"")),a=n.slice(0,n.length-1).concat(a),k=0;k<a.length;k+=1)if(m=a[k],"."===m)a.splice(k,1),k-=1;else if(".."===m){if(1===k&&(".."===a[2]||".."===a[0]))break;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if((n||p)&&o){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),n)for(l=n.length;l>0;l-=1)if(e=o[n.slice(0,l).join("/")],e&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&p&&p[d]&&(i=p[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=v.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),n.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){q[a]=b}}function j(a){if(e(r,a)){var c=r[a];delete r[a],t[a]=!0,m.apply(b,c)}if(!e(q,a)&&!e(t,a))throw new Error("No "+a);return q[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return function(){return s&&s.config&&s.config[a]||{}}}var m,n,o,p,q={},r={},s={},t={},u=Object.prototype.hasOwnProperty,v=[].slice,w=/\.js$/;o=function(a,b){var c,d=k(a),e=d[0];return a=d[1],e&&(e=f(e,b),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(b)):f(a,b):(a=f(a,b),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},p={require:function(a){return g(a)},exports:function(a){var b=q[a];return"undefined"!=typeof b?b:q[a]={}},module:function(a){return{id:a,uri:"",exports:q[a],config:l(a)}}},m=function(a,c,d,f){var h,k,l,m,n,s,u=[],v=typeof d;if(f=f||a,"undefined"===v||"function"===v){for(c=!c.length&&d.length?["require","exports","module"]:c,n=0;n<c.length;n+=1)if(m=o(c[n],f),k=m.f,"require"===k)u[n]=p.require(a);else if("exports"===k)u[n]=p.exports(a),s=!0;else if("module"===k)h=u[n]=p.module(a);else if(e(q,k)||e(r,k)||e(t,k))u[n]=j(k);else{if(!m.p)throw new Error(a+" missing "+k);m.p.load(m.n,g(f,!0),i(k),{}),u[n]=q[k]}l=d?d.apply(q[a],u):void 0,a&&(h&&h.exports!==b&&h.exports!==q[a]?q[a]=h.exports:l===b&&s||(q[a]=l))}else a&&(q[a]=d)},a=c=n=function(a,c,d,e,f){if("string"==typeof a)return p[a]?p[a](c):j(o(a,c).f);if(!a.splice){if(s=a,s.deps&&n(s.deps,s.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?m(b,a,c,d):setTimeout(function(){m(b,a,c,d)},4),n},n.config=function(a){return n(a)},a._defined=q,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(q,a)||e(r,a)||(r[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){var e=b[d];"function"==typeof e&&"constructor"!==d&&c.push(d)}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){var a=Array.prototype.unshift;return a.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;d>c;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;a>c;c++){var d=Math.floor(36*Math.random());b+=d.toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return e!==f||"hidden"!==f&&"visible"!==f?"scroll"===e||"scroll"===f?!0:d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth:!1},c.escapeMarkup=function(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="tree"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="treeitem" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){var c=b.find(".select2-results");c.append(a)},c.prototype.sort=function(a){var b=this.options.get("sorter");return b(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[aria-selected]"),b=a.filter("[aria-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()}),e=b.$results.find(".select2-results__option[aria-selected]");e.each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("aria-selected","true"):b.attr("aria-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"treeitem","aria-selected":"false"};b.disabled&&(delete d["aria-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["aria-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d.role="group",d["aria-label"]=b.text,delete d["aria-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";a(h);this.template(b,h);for(var i=[],j=0;j<b.children.length;j++){var k=b.children[j],l=this.option(k);i.push(l)}var m=a("<ul></ul>",{"class":"select2-results__options select2-results__options--nested"});m.append(i),g.append(h),g.append(m)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("aria-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):0>h-g&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[aria-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted")}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[aria-selected]",function(b){var c=a(this),e=c.data("data");return"true"===c.attr("aria-selected")?void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{})):void d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[aria-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){var a=this.$results.find(".select2-results__option--highlighted");return a},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[aria-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),2>=c?this.$results.scrollTop(0):(g>this.$results.outerHeight()||0>g)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return a}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" role="combobox" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id+"-container",a.id+"-results");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),d.$selection.focus(),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2"),e=a(".select2.select2-container--open");e.each(function(){var b=a(this);if(this!=d[0]){var c=b.data("element");c.select2("close")}})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){var c=b.find(".selection");c.append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d),this.$selection.attr("aria-labelledby",d),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],c=this.$selection.find(".select2-selection__rendered"),d=this.display(b,c);c.empty().append(d),c.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection"),d=this.options.get("escapeMarkup");return d(c(a,b))},d.prototype.selectionContainer=function(){var b=a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation">×</span></li>');return b},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=this.display(e,f);f.append(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var h=this.$selection.find(".select2-selection__rendered");c.appendMany(h,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(a,b){var c=this.selectionContainer();return c.html(this.display(b)),c.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),c},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id,d=b.length>1;if(d||c)return a.call(this,b);this.clear();var e=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(e)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||(c.which==b.DELETE||c.which==b.BACKSPACE)&&this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">×</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this;a.call(this,b,d),b.on("open",function(){e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.id)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented();var b=a.which;if(b===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}});var f=document.documentMode,g=f&&11>=f;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){return g?void e.$selection.off("input.search input.searchcheck"):void e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(g&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{var b=this.$search.val().length+1;a=.75*b+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){var a={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return a}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d=b.id+"-result-";return d+=a.generateChars(4),d+=null!=c.id?"-"+c.id.toString():"-"+a.generateChars(4)},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){
|
2 |
-
var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple"))return a.selected=!1,c(a.element).is("option")?(a.element.selected=!1,void this.$element.trigger("change")):void this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this,f=this.$element.children();f.each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),void 0!==a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(b=c.data(a[0],"data"),null!=b)return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&null!=this.container&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){var c=this.options.get("matcher");return c(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f)},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0),k=(i.text||"").toUpperCase(),l=(b.term||"").toUpperCase(),m=k===l;if(m||j)return f?!1:(a.data=g,void c(a))}if(f)return!0;var n=e.createTag(b);if(null!=n){var o=e.option(n);o.attr("data-select2-tag",!0),e.addOptions([o]),e.insertTag(g,n)}a.results=g,c(a)}var e=this;return this._removeOldTags(),null==b.term||null!=b.page?void a.call(this,b,c):void a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){var c=(this._lastTag,this.$element.find("option[data-select2-tag]"));c.each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b),d=g.$element.find("option").filter(function(){return a(this).val()===c.id});if(!d.length){var e=g.option(c);e.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([e])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",b.term.length<this.minimumInputLength?void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){return b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength?void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}}):void a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;return d.maximumSelectionLength>0&&f>=d.maximumSelectionLength?void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}}):void a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="search" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" role="textbox" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.val("")}),c.on("focus",function(){c.isOpen()&&e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){var b=e.showSearch(a);b?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){var c=e.$results.offset().top+e.$results.outerHeight(!1),d=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1);c+50>=d&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="treeitem" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id,h=this.$container.parents().filter(b.hasScroll);h.off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return a(c.data.results)<this.minimumResultsForSearch?!1:b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){var b=a.minimum-a.input.length,c="Please enter "+b+" or more characters";return c},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),(null!=l.tokenSeparators||null!=l.tokenizer)&&(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(O){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(P){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var Q=k.loadPath(this.defaults.amdLanguageBase+"en"),R=new k(l.language);R.extend(Q),l.translations=R}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){var h=e.children[g],i=c(d,h);null==i&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var j=b(e.text).toUpperCase(),k=b(d.term).toUpperCase();return j.indexOf(k)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)};var E=new D;return E}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observabl
|
|
|
|