PluginProbe
Post Grid Gutenberg Blocks – PostX / 3.2.2
Post Grid Gutenberg Blocks – PostX v3.2.2
5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 2.1.2 All 237 releases
ultimate-post / blocks / Post_Module_1.php

Post_Module_1.php in Post Grid Gutenberg Blocks – PostX 3.2.2, at blocks/Post_Module_1.php

534 lines 34.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ULTP\blocks;
3
4 defined('ABSPATH') || exit;
5
6 class Post_Module_1{
7
8 public function __construct() {
9 add_action('init', array($this, 'register'));
10 }
11
12 public function get_attributes() {
13
14 return array(
15 'blockId' => '',
16 'previewImg' => '',
17 //--------------------------
18 // Layout
19 //--------------------------
20 'layout' => 'layout1',
21
22 //--------------------------
23 // Query Setting
24 //--------------------------
25 'queryQuick' => '',
26 'queryNumPosts' => (object)['lg'=>5],
27 'queryNumber' => 5,
28 'queryType' => 'post',
29 'queryTax' => 'category',
30 'queryTaxValue' => '[]',
31 'queryRelation' => 'OR',
32 'queryOrderBy' => 'date',
33 'metaKey' => 'custom_meta_key',
34 'queryOrder' => 'desc',
35 // Include Remove from Version 2.5.4
36 'queryInclude' => '',
37 'queryExclude' => '[]',
38 'queryAuthor' => '[]',
39 'queryOffset' => '0',
40 'queryExcludeTerm' => '[]',
41 'queryExcludeAuthor' => '[]',
42 'querySticky' => true,
43 'queryUnique' => '',
44 'queryPosts' => '[]',
45 'queryCustomPosts' => '[]',
46 //--------------------------
47 // General Setting
48 //--------------------------
49 'titleShow' => true,
50 'titleStyle' => 'none',
51 'titleAnimColor' => 'black',
52 'headingShow' => true,
53 'excerptShow' => true,
54 'catShow' => true,
55 'metaShow' => true,
56 'showImage' => true,
57 'filterShow' => false,
58 'paginationShow' => false,
59 'readMore' => false,
60 'columnGridGap' => (object)['lg' =>'15', 'unit' =>'px'],
61 'largeHeight' => (object)['lg' =>'245', 'unit' =>'px'],
62 'contentTag' => 'div',
63 'openInTab' => false,
64 'notFoundMessage' => 'No Post Found',
65
66 //--------------------------
67 // Heading Setting/Style
68 //--------------------------
69 'headingText' => 'Post Module #1',
70 'headingURL' => '',
71 'headingBtnText' => 'View More',
72 'headingStyle' => 'style9',
73 'headingTag' => 'h2',
74 'headingAlign' => 'left',
75 'headingTypo' => (object)['openTypography' => 1,'size' => (object)['lg' => '20', 'unit' => 'px'], 'height' => (object)['lg' => '', 'unit' => 'px'],'decoration' => 'none', 'transform' => '', 'family'=>'','weight'=>'700'],
76 'headingColor' => '#0e1523',
77 'headingBorderBottomColor' => '#0e1523',
78 'headingBorderBottomColor2' => '#e5e5e5',
79 'headingBg' => '#037fff',
80 'headingBg2' => '#e5e5e5',
81 'headingBtnTypo' => (object)['openTypography' => 1,'size' => (object)['lg' => '14', 'unit' => 'px'], 'height' => (object)['lg' => '', 'unit' => 'px'],'decoration' => 'none','family'=>''],
82 'headingBtnColor' => '#037fff',
83 'headingBtnHoverColor' => '#0a31da',
84 'headingBorder' => '3',
85 'headingSpacing' => (object)['lg'=>20, 'unit'=>'px'],
86 'headingRadius' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']],
87 'headingPadding' => (object)['lg'=>'', 'unit'=>'px'],
88 'subHeadingShow' => false,
89 'subHeadingText' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer ut sem augue. Sed at felis ut enim dignissim sodales.',
90 'subHeadingTypo' => (object)['openTypography'=>1,'size'=>(object)['lg'=>'16', 'unit'=>'px'], 'spacing'=>(object)[ 'lg'=>'0', 'unit'=>'px'], 'height'=>(object)[ 'lg'=>'27', 'unit'=>'px'],'decoration'=>'none','transform' => '','family'=>'','weight'=>'500'],
91 'subHeadingColor' => '#989898',
92 'subHeadingSpacing' => (object)['lg' =>(object)['top' => '8', 'unit' =>'px']],
93
94 //--------------------------
95 // Title Setting/Style
96 //--------------------------
97 'titleTag' => 'h3',
98 'titlePosition' => true,
99 'titleColor' => '#0e1523',
100 'titleHoverColor' => '#828282',
101 'titleLgTypo' => (object)['openTypography'=>1,'size'=>(object)['lg'=>'24', 'unit'=>'px'], 'spacing'=>(object)[ 'lg'=>'0', 'unit'=>'px'], 'height'=>(object)[ 'lg'=>'32', 'unit'=>'px'],'decoration'=>'none','transform' => '','family'=>'','weight'=>'500'],
102 'titleTypo' => (object)['openTypography'=>1,'size'=>(object)['lg'=>'14', 'unit'=>'px'], 'spacing'=>(object)[ 'lg'=>'0', 'unit'=>'px'], 'height'=>(object)['lg'=>'22', 'unit'=>'px'],'transform' => '', 'decoration'=>'none','family'=>'','weight'=>'500'],
103 'titlePadding' => (object)['lg'=>(object)['top'=>0,'bottom'=>5, 'unit'=>'px']],
104 'titleLgPadding' => (object)['lg'=>(object)['top'=>10,'bottom'=>8, 'unit'=>'px']],
105 'titleLength' => 0,
106
107 //--------------------------
108 // Content Setting/Style
109 //--------------------------
110
111 'varticalAlign' => 'middle',
112 'showSeoMeta' => false,
113 'showSmallExcerpt' => false,
114 'showFullExcerpt' => false,
115 'excerptLimit' => 20,
116 'excerptColor' => '#777',
117 'excerptTypo' => (object)['openTypography' => 1,'size' => (object)['lg' =>14, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px'], 'decoration' => 'none','family'=>''],
118 'excerptPadding' => (object)['lg' =>(object)['top' => 5,'bottom' => '', 'unit' =>'px']],
119
120 //--------------------------
121 // Count Style Setting/Style
122 //--------------------------
123 'counterTypo' => (object)['openTypography' => 1, 'size' => (object)['lg' =>14, 'unit' =>'px'], 'height' => (object)['lg' =>'', 'unit' =>'px'], 'spacing' => (object)['lg' =>0, 'unit' =>'px'], 'transform' => '', 'weight' => '400', 'decoration' => 'none','family'=>'' ],
124 'counterColor' => '#828282',
125 'counterBgColor' => (object)['openColor' => 1,'type' => 'color', 'color' => ''],
126 'counterWidth' => '',
127 'counterHeight' => '',
128 'counterBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
129 'counterRadius' => (object)['lg' =>'', 'unit' =>'px'],
130
131 //--------------------------
132 // Category Setting/Style
133 //--------------------------
134 'maxTaxonomy'=> '30',
135 'taxonomy' => 'category',
136 'showSmallCat' => false,
137 'catStyle' => 'classic',
138 'catPosition' => 'aboveTitle',
139 'customCatColor' => false,
140 'seperatorLink' => admin_url( 'edit-tags.php?taxonomy=category' ),
141 'onlyCatColor' => false,
142 'catLineWidth' => (object)['lg'=>'20'],
143 'catLineSpacing' => (object)['lg'=>'30'],
144 'catLineColor' => '#828282',
145 'catLineHoverColor' => '#037fff',
146 'catTypo' => (object)['openTypography' => 1, 'size' => (object)['lg' =>14, 'unit' =>'px'], 'height' => (object)['lg' =>20, 'unit' =>'px'], 'spacing' => (object)['lg' =>0, 'unit' =>'px'], 'transform' => '', 'weight' => '400', 'decoration' => 'none','family'=>'' ],
147 'catColor' => '#037fff',
148 'catBgColor' => (object)['openColor' => 1,'type' => 'color', 'color' => ''],
149 'catBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
150 'catRadius' => (object)['lg' =>'', 'unit' =>'px'],
151 'catHoverColor' => '#828282',
152 'catBgHoverColor' => (object)['openColor' => 1, 'type' => 'color', 'color' => ''],
153 'catHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
154 'catSacing' => (object)['lg' =>(object)['top' => 5,'bottom' => 5,'left' => 0,'right' => 0, 'unit' =>'px']],
155 'catPadding' => (object)['lg' =>(object)['unit' =>'px']],
156
157 //--------------------------
158 // Meta Setting/Style
159 //--------------------------
160 'showSmallMeta' => true,
161 'metaPosition' => 'top',
162 'metaStyle' => 'icon',
163 'authorLink' => true,
164 'metaSeparator' => 'dot',
165 'metaList' => '["metaAuthor","metaDate","metaRead"]',
166 'metaMinText' => 'min read',
167 'metaAuthorPrefix' => 'By',
168 'metaDateFormat' => 'M j, Y',
169 'metaListSmall' => '["metaAuthor","metaDate"]',
170 'metaTypo' => (object)['openTypography' => 1,'size' => (object)['lg' =>12, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px'], 'decoration' => 'none','family'=>''],
171 'metaColor' => '#989898',
172 'metaHoverColor' => '#000',
173 'metaSpacing' => (object)['lg' =>'10', 'unit' =>'px'],
174 'metaMargin' => (object)['lg' =>(object)['top' => '','bottom' => '0', 'left'=>'','right'=>'', 'unit' =>'px']],
175 'metaPadding' => (object)['lg' =>(object)['top' => '5','bottom' => '5', 'left'=>'','right'=>'', 'unit' =>'px']],
176 'metaBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => '0', 'bottom' => '0', 'left' => '0'],'color' => '#009fd4','type' => 'solid'],
177 'metaBg' => '',
178
179
180 //--------------------------
181 // Inner Content Setting/Style
182 //--------------------------
183 'contentAlign' => "left",
184 'contentWrapBg' => '',
185 'contentWrapHoverBg' => '',
186 'contentWrapBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
187 'contentWrapHoverBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
188 'contentWrapRadius' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
189 'contentWrapHoverRadius' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
190 'contentWrapShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
191 'contentWrapHoverShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
192 'contentWrapInnerPadding' => (object)['lg' =>(object)['top' => '','bottom' => '', 'left'=>'','right'=>'', 'unit' =>'px']],
193 'contentWrapPadding' => (object)['lg' =>(object)['top' => '','bottom' => '', 'left'=>'','right'=>'', 'unit' =>'px']],
194
195 //--------------------------
196 // Image Setting/Style
197 //--------------------------
198 'columnFlip' => false,
199 'imgCrop' => 'full',
200 'imgCropSmall' => (ultimate_post()->get_setting('disable_image_size') == 'yes' ? 'full' : 'ultp_layout_square'),
201 'imgWidth' => (object)['lg' =>'80', 'sm' =>'65', 'xs' =>'', 'ulg' =>'px', 'usm' =>'px'],
202 'imgHeight' => (object)['lg' =>'', 'unit' =>'px'],
203 'imageScale' => 'cover',
204 'imgAnimation' => 'opacity',
205 'imgGrayScale' => (object)['lg' =>'0', 'ulg' =>'%', 'unit' =>'%'],
206 'imgHoverGrayScale' => (object)['lg' =>'0', 'unit' =>'%'],
207 'imgRadius' => (object)['lg' =>'', 'unit' =>'px'],
208 'imgHoverRadius' => (object)['lg' =>'', 'unit' =>'px'],
209 'imgShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
210 'imgHoverShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
211 'imgSpacing' => (object)['lg'=>'20'],
212 'imgOverlay' => false,
213 'imgOverlayType' => 'default',
214 'overlayColor' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#0e1523'],
215 'imgOpacity' => .7,
216 'fallbackEnable' => true,
217 'fallbackImg' => '',
218 'imgSrcset' => false,
219 'imgLazy' => false,
220
221 //--------------------------
222 // Video Setting/Style
223 //--------------------------
224 'vidIconEnable' => true,
225 'popupAutoPlay' => true,
226 'vidIconPosition' => 'center',
227 'popupIconColor' => '#fff',
228 'popupHovColor' => '#d2d2d2',
229 'iconSize' => (object)['lg'=>'40', 'sm'=> '30', 'xs'=> '30', 'unit' => 'px'],
230 // by default should be off
231 'enablePopup' => false,
232 'popupWidth' => (object)['lg'=>'70'],
233 'enablePopupTitle' => true,
234 'popupTitleColor' => '#fff',
235 'closeIconSep' => '#fff',
236 'closeIconColor' => '#fff',
237 'closeHovColor' => '#8f8f8f',
238 'closeSize' => (object)['lg'=>'70', 'unit' => 'px'],
239
240 //--------------------------
241 // Separator
242 //--------------------------
243 'separatorShow' => false,
244 'septColor' => '#e5e5e5',
245 'septStyle' => 'dashed',
246 'septSize' => (object)['lg'=>'1'],
247 'septSpace' => (object)['lg'=>'15'],
248
249 //--------------------------
250 // Read more Setting/Style
251 //--------------------------
252 'showSmallBtn' => false,
253 'readMoreText' => '',
254 'readMoreIcon' => 'rightArrowLg',
255 'readMoreTypo' => (object)['openTypography' => 1, 'size' => (object)['lg' =>12, 'unit' =>'px'], 'height' => (object)['lg' =>'', 'unit' =>'px'], 'spacing' => (object)['lg' =>1, 'unit' =>'px'], 'transform' => '', 'weight' => '400', 'decoration' => 'none','family'=>'' ],
256 'readMoreIconSize' => (object)['lg' =>'', 'unit' =>'px'],
257 'readMoreColor' => '#0d1523',
258 'readMoreBgColor' => (object)['openColor' => 0,'type' => 'color', 'color' => ''],
259 'readMoreBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
260 'readMoreRadius' => (object)['lg' =>'', 'unit' =>'px'],
261 'readMoreHoverColor' => '#0c32d8',
262 'readMoreBgHoverColor' => (object)['openColor' => 0, 'type' => 'color', 'color' => ''],
263 'readMoreHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
264 'readMoreHoverRadius' => (object)['lg' =>'', 'unit' =>'px'],
265 'readMoreSacing' => (object)['lg' =>(object)['top' => 15,'bottom' => '','left' => '','right' => '', 'unit' =>'px']],
266 'readMorePadding' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '','right' => '', 'unit' =>'px']],
267
268 //--------------------------
269 // Filter Setting/Style
270 //--------------------------
271 'filterBelowTitle' => false,
272 'filterAlign' => (object)['lg' =>''],
273 'filterType' => 'category',
274 'filterText' => 'all',
275 'filterValue' => '[]',
276 'fliterTypo' => (object)['openTypography' => 1,'size' => (object)['lg' =>14, 'unit' =>'px'],'height' => (object)['lg' =>22, 'unit' =>'px'], 'decoration' => 'none','family'=>'','weight'=>500],
277 'filterColor' => '#0e1523',
278 'filterHoverColor' => '#828282',
279 'filterBgColor' => '',
280 'filterHoverBgColor' => '',
281 'filterBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
282 'filterHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
283 'filterRadius' => (object)['lg' =>'', 'unit' =>'px'],
284 'fliterSpacing' => (object)['lg' =>(object)['top' => '','bottom' => '', 'right' => '', 'left' => '20', 'unit' =>'px']],
285 'fliterPadding' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
286 'filterDropdownColor' => '#0e1523',
287 'filterDropdownHoverColor' => '#037fff',
288 'filterDropdownBg' => '#fff',
289 'filterDropdownRadius' => (object)['lg'=>'0'],
290 'filterDropdownPadding' => (object)['lg' =>(object)['top' => '15','bottom' => '15','left' => '20','right' => '20', 'unit' =>'px']],
291 'filterMobile' => true,
292 'filterMobileText' => 'More',
293
294 //--------------------------
295 // Pagination Setting/Style
296 //--------------------------
297 'paginationType' => 'navigation',
298 'paginationNav' => 'textArrow',
299 'navPosition' => 'topRight',
300 'pagiAlign' => (object)['lg' =>'left'],
301 'pagiTypo' => (object)['openTypography' => 1,'size' => (object)['lg' =>14, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px'], 'decoration' => 'none','family'=>''],
302 'pagiArrowSize' => (object)['lg'=>'14'],
303 'pagiColor' => '#fff',
304 'pagiBgColor' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#0e1523'],
305 'pagiBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
306 'pagiShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
307 'pagiRadius' => (object)['lg' =>(object)['top' => '2','bottom' => '2','left' => '2','right' => '2', 'unit' =>'px']],
308 'pagiHoverColor' => '#fff',
309 'pagiHoverbg' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#037fff','replace'=>1],
310 'pagiHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
311 'pagiHoverShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
312 'pagiHoverRadius' => (object)['lg' =>(object)['top' => '2','bottom' => '2','left' => '2','right' => '2', 'unit' =>'px']],
313 'pagiPadding' => (object)['lg' =>(object)['top' => '8','bottom' => '8','left' => '14','right' => '14', 'unit' =>'px']],
314 'navMargin' => (object)['lg' =>(object)['top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'unit' =>'px']],
315
316 //--------------------------
317 // Wrapper Style
318 //--------------------------
319 'loadingColor' => '#000',
320 'wrapBg' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#f5f5f5'],
321 'wrapBorder' => (object)['openBorder'=>0, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
322 'wrapShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
323 'wrapRadius' => (object)['lg' =>'', 'unit' =>'px'],
324 'wrapHoverBackground' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#037fff'],
325 'wrapHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
326 'wrapHoverRadius' => (object)['lg' =>'', 'unit' =>'px'],
327 'wrapHoverShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
328 'wrapMargin' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
329 'wrapOuterPadding' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']],
330 'wrapInnerPadding' => (object)['lg' =>(object)['unit' =>'px']],
331 'advanceId' => '',
332 'advanceZindex' => '',
333 'hideExtraLarge' => false,
334 'hideTablet' => false,
335 'hideMobile' => false,
336 'advanceCss' => '',
337 'currentPostId' => '',
338 );
339 }
340
341 public function register() {
342 register_block_type( 'ultimate-post/post-module-1',
343 array(
344 'editor_script' => 'ultp-blocks-editor-script',
345 'editor_style' => 'ultp-blocks-editor-css',
346 'render_callback' => array($this, 'content')
347 )
348 );
349 }
350
351 public function content($attr, $noAjax) {
352 $attr = wp_parse_args($attr, $this->get_attributes());
353 global $unique_ID;
354
355 if (!$noAjax) {
356 $paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
357 $attr['paged'] = $paged ? $paged : 1;
358 }
359 if($attr['queryUnique'] && isset($attr['savedQueryUnique'])) {
360 $unique_ID = $attr['savedQueryUnique'];
361 }
362
363 $bigloop = '';
364 $block_name = 'post-module-1';
365 $wraper_before = $wraper_after = $post_loop = '';
366 $attr['queryNumber'] = ultimate_post()->get_post_number(5, $attr['queryNumber'], $attr['queryNumPosts']);
367 $recent_posts = new \WP_Query( ultimate_post()->get_query( $attr ) );
368 $pageNum = ultimate_post()->get_page_number($attr, $recent_posts->found_posts);
369 // Dummy Img Url
370 $dummy_url = ULTP_URL.'assets/img/ultp-fallback-img.png';
371
372 // Loadmore and Unique content
373 if($attr['queryUnique'] && isset($attr['loadMoreQueryUnique']) && $attr['paginationShow'] && ($attr['paginationType'] == 'loadMore')) {
374 $unique_ID = $attr['loadMoreQueryUnique'];
375 $current_unique_posts = $attr['ultp_current_unique_posts'];
376 }
377
378 if ($recent_posts->have_posts()) {
379
380 $wraper_before .= '<div '.($attr['advanceId']?'id="'.$attr['advanceId'].'" ':'').' class="wp-block-ultimate-post-'.$block_name.' ultp-block-'.$attr["blockId"].''.(isset($attr["align"])? ' align' .$attr["align"]:'').''.(isset($attr["className"])?' '.$attr["className"]:'').'">';
381 $wraper_before .= '<div class="ultp-block-wrapper">';
382
383 // Loading
384 $wraper_before .= ultimate_post()->loading();
385
386 if ($attr['headingShow'] || $attr['filterShow'] || $attr['paginationShow']) {
387 $wraper_before .= '<div class="ultp-heading-filter">';
388 $wraper_before .= '<div class="ultp-heading-filter-in">';
389
390 // Heading
391 include ULTP_PATH.'blocks/template/heading.php';
392
393 if ($attr['filterShow'] || $attr['paginationShow']) {
394 $wraper_before .= '<div class="ultp-filter-navigation">';
395 // Filter
396 if($attr['filterShow'] && $attr['queryType'] != 'posts' && $attr['queryType'] != 'customPosts') {
397 include ULTP_PATH.'blocks/template/filter.php';
398 }
399 // Navigation
400 if ($attr['paginationShow'] && ($attr['paginationType'] == 'navigation') && ($attr['navPosition'] == 'topRight')) {
401 include ULTP_PATH.'blocks/template/navigation-before.php';
402 }
403 $wraper_before .= '</div>';
404 }
405
406 $wraper_before .= '</div>';
407 $wraper_before .= '</div>';
408 }
409
410 $wraper_before .= '<div class="ultp-block-items-wrap ultp-block-post-module1 ultp-block-content-'.$attr['varticalAlign'].' ultp-block-content-'.($attr['columnFlip'] ? 'true' : 'false').' ultp-'.$attr['layout'].'">';
411 $idx = 0; // $idx = $noAjax ? 1 : 0;
412 while ( $recent_posts->have_posts() ): $recent_posts->the_post();
413
414 include ULTP_PATH.'blocks/template/data.php';
415
416 include ULTP_PATH.'blocks/template/category.php';
417
418 if ($attr['queryUnique']) {
419 $unique_ID[$attr['queryUnique']][] = $post_id;
420 $current_unique_posts[] = $post_id;
421 }
422
423 $post_loop .= '<'.$attr['contentTag'].' class="ultp-block-item post-id-'.$post_id.'">';
424
425 $post_loop .= '<div class="ultp-block-content-wrap">';
426 if(($post_thumb_id || $attr['fallbackEnable']) && $attr['showImage'] && ($idx == 0 || $attr['layout'] == 'layout2' || $attr['layout'] == 'layout3' || $attr['layout'] == 'layout5')) {
427 $post_loop .= '<div class="ultp-block-image ultp-block-image-'.$attr['imgAnimation'].($attr["imgOverlay"] ? ' ultp-block-image-overlay ultp-block-image-'.$attr["imgOverlayType"].' ultp-block-image-'.$attr["imgOverlayType"].$idx : '' ).'">';
428 if ($idx == 0) {
429 $post_loop .= '<a href="'.$titlelink.'" '.($attr['openInTab'] ? 'target="_blank"' : '').'>';
430 // Post Image Id
431 $block_img_id = $post_thumb_id ? $post_thumb_id : ($attr['fallbackEnable'] && isset($attr['fallbackImg']['id']) ? $attr['fallbackImg']['id'] : '');
432 // Post Image
433 if($post_thumb_id || ($attr['fallbackEnable'] && $block_img_id)) {
434 $post_loop .= ultimate_post()->get_image($block_img_id, $attr['imgCrop'], '', $title, $attr['imgSrcset'], $attr['imgLazy']);
435 } else {
436 $video = ultimate_post()->get_youtube_id($post_video);
437 $post_loop .= '<img src="'.($video ? 'https://img.youtube.com/vi/'.$video.'/0.jpg' : $dummy_url).'" alt="dummy-img" />';
438 }
439 $post_loop .= '</a>';
440 if($post_video){
441 $post_loop .= '<div enableAutoPlay="'.$attr['popupAutoPlay'].'" class="ultp-video-icon">'.ultimate_post()->svg_icon('play_line').'</div>';
442 }
443 } else {
444 if ($attr['layout'] == 'layout2' || $attr['layout'] == 'layout3' || $attr['layout'] == 'layout5') {
445 $post_loop .= '<a href="'.$titlelink.'" '.($attr['openInTab'] ? 'target="_blank"' : '').'>';
446 // Post Image Id
447 $block_img_id = $post_thumb_id ? $post_thumb_id : ($attr['fallbackEnable'] && isset($attr['fallbackImg']['id']) ? $attr['fallbackImg']['id'] : '');
448 // Post Image
449 if($post_thumb_id || ($attr['fallbackEnable'] && $block_img_id)) {
450 $post_loop .= ultimate_post()->get_image($block_img_id, $attr['imgCropSmall'], '', $title, $attr['imgSrcset'], $attr['imgLazy']);
451 } else {
452 $video = ultimate_post()->get_youtube_id($post_video);
453 $post_loop .= '<img src="'.($video ? 'https://img.youtube.com/vi/'.$video.'/0.jpg' : $dummy_url).'" alt="dummy-img" />';
454 }
455 $post_loop .= '</a>';
456 if($post_video){
457 $post_loop .= '<div enableAutoPlay="'.$attr['popupAutoPlay'].'" class="ultp-video-icon">'.ultimate_post()->svg_icon('play_line').'</div>';
458 }
459 }
460 }
461 if (($attr['catPosition'] != 'aboveTitle') && ($idx == 0 || $attr['showSmallCat']) && $attr['catShow'] ) {
462 $post_loop .= '<div class="ultp-category-img-grid">'.$category.'</div>';
463 }
464 $post_loop .= '</div>';
465 }
466 $post_loop .= '<div class="ultp-block-content">';
467 // Category
468 if (($attr['catPosition'] == 'aboveTitle') && ($idx == 0 || $attr['showSmallCat'] ) && $attr['catShow']) {
469 $post_loop .= $category;
470 }
471 // Title
472 if ($title && $attr['titleShow'] && $attr['titlePosition'] == 1) {
473 include ULTP_PATH.'blocks/template/title.php';
474 }
475 // Meta
476 if ($attr['metaPosition'] =='top' ) {
477 include ULTP_PATH.'blocks/template/meta.php';
478 }
479 // Title
480 if ($title && $attr['titleShow'] && $attr['titlePosition'] == 0) {
481 include ULTP_PATH.'blocks/template/title.php';
482 }
483 // Excerpt
484 if (($idx == 0 || $attr['showSmallExcerpt']) && $attr['excerptShow']) {
485 $post_loop .= '<div class="ultp-block-excerpt">'.ultimate_post()->get_excerpt($post_id, $attr['showSeoMeta'], $attr['showFullExcerpt'], $attr['excerptLimit']).'</div>';
486 }
487
488 // Read More
489 if ($attr['readMore'] && ($idx == 0 || $attr['showSmallBtn'])) {
490 $post_loop .= '<div class="ultp-block-readmore"><a aria-label="'.$title.'" href="'.$titlelink.'" '.($attr['openInTab'] ? 'target="_blank"' : '').'>'.($attr['readMoreText'] ? $attr['readMoreText'] : esc_html__( "Read More", "ultimate-post" )).ultimate_post()->svg_icon($attr['readMoreIcon']).'</a></div>';
491 }
492 // Bottom
493 if ($attr['metaPosition'] =='bottom' ) {
494 include ULTP_PATH.'blocks/template/meta.php';
495 }
496 $post_loop .= '</div>';
497 $post_loop .= '</div>';
498 if($post_video && $attr['enablePopup'] && ($attr['layout'] != 'layout1' && $attr['layout'] != 'layout4' || $idx == 0)) {
499 include ULTP_PATH.'blocks/template/video_popup.php';
500 }
501 $post_loop .= '</'.$attr['contentTag'].'>';
502
503 if ($idx == 0) {
504 $bigloop = $post_loop;
505 $post_loop = '';
506 }
507
508 $idx ++;
509 endwhile;
510 if($attr['queryUnique']) {
511 $post_loop .= "<span style='display: none;' class='ultp-current-unique-posts' data-ultp-unique-ids= ".json_encode($unique_ID)." data-current-unique-posts= ".json_encode($current_unique_posts)."> </span>";
512 }
513 $bigloop = '<div class="ultp-big-post-module1">'.$bigloop.'</div>';
514 $post_loop = $bigloop.'<div class="ultp-small-post-module1">'.$post_loop.'</div>';
515
516 $wraper_after .= '</div>';//ultp-block-items-wrap
517
518 // Navigation
519 if ($attr['paginationShow'] && ($attr['paginationType'] == 'navigation') && ($attr['navPosition'] != 'topRight')) {
520 include ULTP_PATH.'blocks/template/navigation-after.php';
521 }
522
523 $wraper_after .= '</div>';
524 $wraper_after .= '</div>';
525
526 wp_reset_query();
527 }else {
528 $wraper_before .= ultimate_post()->get_no_result_found_html( $attr['notFoundMessage'] );
529 }
530
531 return $noAjax ? $post_loop : $wraper_before.$post_loop.$wraper_after;
532 }
533
534 }