PluginProbe ʕ •ᴥ•ʔ
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid / 7.0.2
The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid v7.0.2
7.9.3 7.9.2 trunk 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.2.0 4.2.1 4.2.2 4.2.3 5.0.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 6.0.0 7.0.0 7.0.1 7.0.2 7.1.0 7.2.0 7.2.1 7.2.10 7.2.11 7.2.2 7.2.3 7.2.4 7.2.5 7.2.6 7.2.7 7.2.8 7.2.9 7.3.0 7.3.1 7.4.0 7.4.1 7.4.2 7.4.3 7.5.0 7.6.0 7.6.1 7.7.0 7.7.1 7.7.10 7.7.11 7.7.12 7.7.13 7.7.14 7.7.15 7.7.16 7.7.17 7.7.18 7.7.19 7.7.2 7.7.20 7.7.21 7.7.22 7.7.3 7.7.4 7.7.5 7.7.6 7.7.7 7.7.8 7.7.9 7.8.0 7.8.1 7.8.2 7.8.3 7.8.4 7.8.5 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1
the-post-grid / app / Widgets / elementor / widgets / grid-hover-layout.php
the-post-grid / app / Widgets / elementor / widgets Last commit date
grid-hover-layout-archive.php 3 years ago grid-hover-layout.php 3 years ago grid-layout-archive.php 3 years ago grid-layout.php 3 years ago list-layout-archive.php 3 years ago list-layout.php 3 years ago related-post.php 3 years ago slider-layout-archive.php 3 years ago slider-layout.php 3 years ago
grid-hover-layout.php
298 lines
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 */
28
29 public function __construct( $data = [], $args = null ) {
30 parent::__construct( $data, $args );
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() {
38 $scripts = [];
39 array_push( $scripts, 'imagesloaded' );
40 array_push( $scripts, 'rt-tpg' );
41 array_push( $scripts, 'rttpg-block-pro' );
42
43 return $scripts;
44 }
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' );
52 array_push( $style, 'rt-flaticon' );
53 array_push( $style, 'rt-tpg-block' );
54 }
55
56 return $style;
57 }
58
59 protected function register_controls() {
60 /**
61 * Content Tab
62 * ===========
63 */
64
65 // Layout.
66 rtTPGElementorHelper::grid_layouts( $this );
67
68 // Query.
69 rtTPGElementorHelper::query( $this );
70
71 // Filter Settings.
72 rtTPGElementorHelper::filter_settings( $this );
73
74 // Pagination Settings.
75 rtTPGElementorHelper::pagination_settings( $this );
76
77 // Links.
78 rtTPGElementorHelper::links( $this );
79
80 /**
81 * Settings Tab
82 * =============
83 */
84
85 // Field Selection.
86 rtTPGElementorHelper::field_selection( $this );
87
88 // Section Title Settings.
89 rtTPGElementorHelper::section_title_settings( $this );
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 Tab
111 * ==========
112 */
113
114 // Section Title Style.
115 rtTPGElementorHelper::sectionTitle( $this );
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 // Box Style.
142 rtTPGElementorHelper::frontEndFilter( $this );
143
144 // Pagination - Loadmore Style.
145 rtTPGElementorHelper::paginationStyle( $this );
146
147 // Box Style.
148 rtTPGElementorHelper::articlBoxSettings( $this );
149
150 // Promotions Style.
151 rtTPGElementorHelper::promotions( $this );
152 }
153
154 protected function render() {
155 $data = $this->get_settings();
156 $_prefix = $this->prefix;
157
158 if ( ! rtTPG()->hasPro() && ! in_array(
159 $data[ $_prefix . '_layout' ],
160 [
161 'grid_hover-layout1',
162 'grid_hover-layout2',
163 'grid_hover-layout3',
164 ]
165 ) ) {
166 $data[ $_prefix . '_layout' ] = 'grid_hover-layout1';
167 }
168
169 if ( rtTPG()->hasPro() && ( 'popup' == $data['post_link_type'] || 'multi_popup' == $data['post_link_type'] ) ) {
170 wp_enqueue_style( 'rt-magnific-popup' );
171 wp_enqueue_script( 'rt-scrollbar' );
172 wp_enqueue_script( 'rt-magnific-popup' );
173 add_action( 'wp_footer', [ Fns::class, 'get_modal_markup' ] );
174 }
175
176 if ( rtTPG()->hasPro() && 'button' == $data['filter_type'] && 'carousel' == $data['filter_btn_style'] ) {
177 wp_enqueue_script( 'swiper' );
178 }
179
180 if ( 'show' == $data['show_pagination'] && 'pagination_ajax' == $data['pagination_type'] ) {
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 //TODO: Get Post Data for render post
192 $post_data = Fns::get_render_data_set( $data, $query->max_num_pages, $posts_per_page, $_prefix );
193
194 // Post type render.
195 $post_types = Fns::get_post_types();
196 foreach ( $post_types as $post_type => $label ) {
197 $_taxonomies = get_object_taxonomies( $post_type, 'object' );
198
199 if ( empty( $_taxonomies ) ) {
200 continue;
201 }
202
203 $post_data[ $data['post_type'] . '_taxonomy' ] = isset( $data[ $data['post_type'] . '_taxonomy' ] ) ? $data[ $data['post_type'] . '_taxonomy' ] : '';
204 $post_data[ $data['post_type'] . '_tags' ] = isset( $data[ $data['post_type'] . '_tags' ] ) ? $data[ $data['post_type'] . '_tags' ] : '';
205 }
206 $template_path = Fns::tpg_template_path( $post_data );
207 $_layout = $data[ $_prefix . '_layout' ];
208 ?>
209
210 <div class="rt-container-fluid rt-tpg-container tpg-el-main-wrapper <?php echo esc_attr( $_layout . '-main' ); ?>"
211 id="<?php echo esc_attr( $layoutID ); ?>"
212 data-layout="<?php echo esc_attr( $data[ $_prefix . '_layout' ] ); ?>"
213 data-sc-id="elementor"
214 data-el-settings='<?php Fns::is_filter_enable( $data ) ? Fns::print_html( htmlspecialchars( wp_json_encode( $post_data, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES ) ), true ) : ''; ?>'
215 data-el-query='<?php Fns::is_filter_enable( $data ) ? Fns::print_html( htmlspecialchars( wp_json_encode( $query_args ) ), true ) : ''; ?>'
216 data-el-path='<?php echo Fns::is_filter_enable( $data ) ? esc_attr( $template_path ) : ''; ?>'
217 >
218 <?php
219 $settings = get_option( rtTPG()->options['settings'] );
220 if ( isset( $settings['tpg_load_script'] ) && isset( $settings['tpg_enable_preloader'] ) ) {
221 ?>
222 <div id="bottom-script-loader" class="bottom-script-loader">
223 <div class="rt-ball-clip-rotate">
224 <div></div>
225 </div>
226 </div>
227 <?php
228 }
229
230 $wrapper_class = [];
231 if ( in_array(
232 $_layout,
233 [
234 'grid_hover-layout6',
235 'grid_hover-layout7',
236 'grid_hover-layout8',
237 'grid_hover-layout9',
238 'grid_hover-layout10',
239 'grid_hover-layout11',
240 'grid_hover-layout5-2',
241 'grid_hover-layout6-2',
242 'grid_hover-layout7-2',
243 'grid_hover-layout9-2',
244 ]
245 ) ) {
246 $wrapper_class[] = 'grid_hover-layout5';
247 }
248 $wrapper_class[] = str_replace( '-2', '', $_layout );
249 $wrapper_class[] = 'tpg-even grid-behaviour';
250 $wrapper_class[] = $_prefix . '_layout_wrapper';
251
252 // section title settings.
253 $is_carousel = '';
254
255 if ( rtTPG()->hasPro() && 'carousel' == $data['filter_btn_style'] && 'button' == $data['filter_type'] ) {
256 $is_carousel = 'carousel';
257 }
258
259 echo "<div class='tpg-header-wrapper {$is_carousel}'>";
260
261 Fns::get_section_title( $data );
262 Fns::print_html( Fns::get_frontend_filter_markup( $data ) );
263 echo '</div>';
264
265 ?>
266
267 <div data-title="Loading ..."
268 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 Fns::tpg_template( $post_data );
278 $pCount ++;
279 }
280 } else {
281 if ( $data['no_posts_found_text'] ) {
282 printf( "<div class='no_posts_found_text'>%s</div>", esc_html( $data['no_posts_found_text'] ) );
283 } else {
284 printf( "<div class='no_posts_found_text'>%s</div>", esc_html__( 'No post found', 'the-post-grid' ) );
285 }
286 }
287 wp_reset_postdata();
288 ?>
289 </div>
290
291 <?php Fns::print_html( Fns::get_pagination_markup( $query, $data ) ); ?>
292 </div>
293 <?php
294 do_action( 'tpg_elementor_script' );
295 }
296
297 }
298