PluginProbe
Post Grid Gutenberg Blocks – PostX / 3.1.2
Post Grid Gutenberg Blocks – PostX v3.1.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_2.php

Post_Module_2.php in Post Grid Gutenberg Blocks – PostX 3.1.2, at blocks/Post_Module_2.php

528 lines 33.1 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_2{
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' =>'450', 'unit' =>'px'],
62 'contentTag' => 'div',
63 'openInTab' => false,
64 'notFoundMessage' => 'No Post Found',
65
66 //--------------------------
67 // Heading Setting/Style
68 //--------------------------
69 'headingText' => 'Post Module #2',
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' =>(object)['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 'lgTitleColor' => '#fff',
103 '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'],
104 'titlePadding' => (object)['lg'=>(object)['top'=>5,'bottom'=>5, 'unit'=>'px']],
105 'titleLength' => 0,
106 'titleBackground' => '',
107
108 //--------------------------
109 // Content Setting/Style
110 //--------------------------
111
112 'varticalAlign' => 'middle',
113 'showSeoMeta' => false,
114 'showSmallExcerpt' => false,
115 'showFullExcerpt' => false,
116 'excerptLimit' => 20,
117 'excerptColor' => '#777',
118 'excerptBigColor' => '#fff',
119 'excerptTypo' => (object)['openTypography' => 1,'size' => (object)['lg' =>14, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px'], 'decoration' => 'none','family'=>''],
120 'excerptPadding' => (object)['lg' =>(object)['top' => 5,'bottom' => '', 'unit' =>'px']],
121
122 //--------------------------
123 // Count Style Setting/Style
124 //--------------------------
125 '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'=>'' ],
126 'counterColor' => '#828282',
127 'counterBgColor' => (object)['openColor' => 1,'type' => 'color', 'color' => ''],
128 'counterWidth' => '',
129 'counterHeight' => '',
130 'counterBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
131 'counterRadius' => (object)['lg' =>'', 'unit' =>'px'],
132
133 //--------------------------
134 // Category Setting/Style
135 //--------------------------
136 'maxTaxonomy'=> '30',
137 'taxonomy' => 'category',
138 'showSmallCat' => false,
139 'catStyle' => 'classic',
140 'catPosition' => 'aboveTitle',
141 'customCatColor' => false,
142 'seperatorLink' => admin_url( 'edit-tags.php?taxonomy=category' ),
143 'onlyCatColor' => false,
144 'catLineWidth' => (object)['lg'=>'20'],
145 'catLineSpacing' => (object)['lg'=>'30'],
146 'catLineColor' => '#828282',
147 'catLineHoverColor' => '#037fff',
148 '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'=>'' ],
149 'catColor' => '#037fff',
150 'catBgColor' => (object)['openColor' => 1,'type' => 'color', 'color' => ''],
151 'catBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
152 'catRadius' => (object)['lg' =>'', 'unit' =>'px'],
153 'catHoverColor' => '#828282',
154 'catBgHoverColor' => (object)['openColor' => 1, 'type' => 'color', 'color' => ''],
155 'catHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
156 'catSacing' => (object)['lg' =>(object)['top' => 5,'bottom' => 5,'left' => 0,'right' => 0, 'unit' =>'px']],
157 'catPadding' => (object)['lg' =>(object)['unit' =>'px']],
158
159 //--------------------------
160 // Meta Setting/Style
161 //--------------------------
162 'showSmallMeta' => true,
163 'metaPosition' => 'top',
164 'metaStyle' => 'icon',
165 'authorLink' => true,
166 'metaSeparator' => 'dot',
167 'metaList' => '["metaAuthor","metaDate","metaRead"]',
168 'metaMinText' => 'min read',
169 'metaAuthorPrefix' => 'By',
170 'metaDateFormat' => 'M j, Y',
171 'metaListSmall' => '["metaAuthor","metaDate"]',
172 'metaTypo' => (object)['openTypography' => 1,'size' => (object)['lg' =>12, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px'], 'decoration' => 'none','family'=>''],
173 'metaColor' => '#989898',
174 'LargeMetaColor' => '#fff',
175 'metaHoverColor' => '#000',
176 'metaSpacing' => (object)['lg' =>'10', 'unit' =>'px'],
177 'metaMargin' => (object)['lg' =>(object)['top' => '','bottom' => '0', 'left'=>'','right'=>'', 'unit' =>'px']],
178 'metaPadding' => (object)['lg' =>(object)['top' => '5','bottom' => '5', 'left'=>'','right'=>'', 'unit' =>'px']],
179 'metaBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => '0', 'bottom' => '0', 'left' => '0'],'color' => '#009fd4','type' => 'solid'],
180 'metaBg' => '',
181
182 //--------------------------
183 // Inner Content Setting/Style
184 //--------------------------
185 'contentAlign' => "left",
186 'contentWrapBg' => '',
187 'contentWrapHoverBg' => '',
188 'contentWrapBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
189 'contentWrapHoverBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
190 'contentWrapRadius' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
191 'contentWrapHoverRadius' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
192 'contentWrapShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
193 'contentWrapHoverShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
194 'contentWrapInnerPadding' => (object)['lg' =>(object)['top' => '','bottom' => '', 'left'=>'','right'=>'', 'unit' =>'px']],
195 'contentWrapPadding' => (object)['lg' =>(object)['top' => '','bottom' => '', 'left'=>'','right'=>'', 'unit' =>'px']],
196
197
198 //--------------------------
199 // Image Setting/Style
200 //--------------------------
201 'columnFlip' => false,
202 'imgCrop' => 'full',
203 'imgCropSmall' => (ultimate_post()->get_setting('disable_image_size') == 'yes' ? 'full' : 'ultp_layout_square'),
204 'imgWidth' => (object)['lg' =>'80', 'sm' =>'65', 'xs' =>'', 'ulg' =>'px', 'usm' =>'px'],
205 'imgHeight' => (object)['lg' =>'', 'unit' =>'px'],
206 'imageScale' => 'cover',
207 'imgAnimation' => 'opacity',
208 'imgGrayScale' => (object)['lg' =>'0', 'ulg' =>'%', 'unit' =>'%'],
209 'imgHoverGrayScale' => (object)['lg' =>'0', 'unit' =>'%'],
210 'imgRadius' => (object)['lg' =>'', 'unit' =>'px'],
211 'imgHoverRadius' => (object)['lg' =>'', 'unit' =>'px'],
212 'imgShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
213 'imgHoverShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
214 'imgSpacing' => (object)['lg'=>'20'],
215 'imgOverlay' => false,
216 'imgOverlayType' => 'default',
217 'overlayColor' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#0e1523'],
218 'imgOpacity' => .7,
219 'fallbackEnable' => true,
220 'fallbackImg' => '',
221 'imgSrcset' => false,
222 'imgLazy' => false,
223
224 //--------------------------
225 // Video Setting/Style
226 //--------------------------
227 'vidIconEnable' => true,
228 'popupAutoPlay' => true,
229 'vidIconPosition' => 'center',
230 'popupIconColor' => '#fff',
231 'popupHovColor' => '#d2d2d2',
232 'iconSize' => (object)['lg'=>'40', 'sm'=> '30', 'xs'=> '30', 'unit' => 'px'],
233 // by default should be off
234 'enablePopup' => false,
235 'popupWidth' => (object)['lg'=>'70'],
236 'enablePopupTitle' => true,
237 'popupTitleColor' => '#fff',
238 'closeIconSep' => '#fff',
239 'closeIconColor' => '#fff',
240 'closeHovColor' => '#8f8f8f',
241 'closeSize' => (object)['lg'=>'70', 'unit' => 'px'],
242
243 //--------------------------
244 // Separator
245 //--------------------------
246 'separatorShow' => false,
247 'septColor' => '#e5e5e5',
248 'septStyle' => 'dashed',
249 'septSize' => (object)['lg'=>'1'],
250 'septSpace' => (object)['lg'=>'15'],
251
252 //--------------------------
253 // Read more Setting/Style
254 //--------------------------
255 'showSmallBtn' => false,
256 'readMoreText' => '',
257 'readMoreIcon' => 'rightArrowLg',
258 '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'=>'' ],
259 'readMoreIconSize' => (object)['lg' =>'', 'unit' =>'px'],
260 'readMoreColor' => '#0d1523',
261 'readMoreBgColor' => (object)['openColor' => 0,'type' => 'color', 'color' => ''],
262 'readMoreBorder' => (object)['openBorder'=>0, 'width' => (object)[ 'top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid' ],
263 'readMoreRadius' => (object)['lg' =>'', 'unit' =>'px'],
264 'readMoreHoverColor' => '#0c32d8',
265 'readMoreBgHoverColor' => (object)['openColor' => 0, 'type' => 'color', 'color' => ''],
266 'readMoreHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
267 'readMoreHoverRadius' => (object)['lg' =>'', 'unit' =>'px'],
268 'readMoreSacing' => (object)['lg' =>(object)['top' => 15,'bottom' => '','left' => '','right' => '', 'unit' =>'px']],
269 'readMorePadding' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '','right' => '', 'unit' =>'px']],
270
271 //--------------------------
272 // Filter Setting/Style
273 //--------------------------
274 'filterBelowTitle' => false,
275 'filterAlign' => (object)['lg' =>''],
276 'filterType' => 'category',
277 'filterText' => 'all',
278 'filterValue' => '[]',
279 'fliterTypo' => (object)['openTypography' => 1,'size' => (object)['lg' =>14, 'unit' =>'px'],'height' => (object)['lg' =>22, 'unit' =>'px'], 'decoration' => 'none','family'=>'','weight'=>500],
280 'filterColor' => '#0e1523',
281 'filterHoverColor' => '#828282',
282 'filterBgColor' => '',
283 'filterHoverBgColor' => '',
284 'filterBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
285 'filterHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
286 'filterRadius' => (object)['lg' =>'', 'unit' =>'px'],
287 'fliterSpacing' => (object)['lg' =>(object)['top' => '','bottom' => '', 'right' => '', 'left' => '20', 'unit' =>'px']],
288 'fliterPadding' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
289 'filterDropdownColor' => '#0e1523',
290 'filterDropdownHoverColor' => '#037fff',
291 'filterDropdownBg' => '#fff',
292 'filterDropdownRadius' => (object)['lg'=>'0'],
293 'filterDropdownPadding' => (object)['lg' =>(object)['top' => '15','bottom' => '15','left' => '20','right' => '20', 'unit' =>'px']],
294 'filterMobile' => true,
295 'filterMobileText' => 'More',
296
297 //--------------------------
298 // Pagination Setting/Style
299 //--------------------------
300 'paginationType' => 'navigation',
301 'paginationNav' => 'textArrow',
302 'navPosition' => 'topRight',
303 'pagiAlign' => (object)['lg' =>'left'],
304 'pagiTypo' => (object)['openTypography' => 1,'size' => (object)['lg' =>14, 'unit' =>'px'],'height' => (object)['lg' =>20, 'unit' =>'px'], 'decoration' => 'none','family'=>''],
305 'pagiArrowSize' => (object)['lg'=>'14'],
306 'pagiColor' => '#fff',
307 'pagiBgColor' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#0e1523'],
308 'pagiBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
309 'pagiShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
310 'pagiRadius' => (object)['lg' =>(object)['top' => '2','bottom' => '2','left' => '2','right' => '2', 'unit' =>'px']],
311 'pagiHoverColor' => '#fff',
312 'pagiHoverbg' => (object)['openColor' => 1, 'type' => 'color', 'color' => '#037fff','replace'=>1],
313 'pagiHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
314 'pagiHoverShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
315 'pagiHoverRadius' => (object)['lg' =>(object)['top' => '2','bottom' => '2','left' => '2','right' => '2', 'unit' =>'px']],
316 'pagiPadding' => (object)['lg' =>(object)['top' => '8','bottom' => '8','left' => '14','right' => '14', 'unit' =>'px']],
317 'navMargin' => (object)['lg' =>(object)['top' => '0', 'right' => '0', 'bottom' => '0', 'left' => '0', 'unit' =>'px']],
318
319 //--------------------------
320 // Wrapper Style
321 //--------------------------
322 'loadingColor' => '#000',
323 'wrapBg' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#f5f5f5'],
324 'wrapBorder' => (object)['openBorder'=>0, 'width' =>(object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
325 'wrapShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
326 'wrapRadius' => (object)['lg' =>'', 'unit' =>'px'],
327 'wrapHoverBackground' => (object)['openColor' => 0, 'type' => 'color', 'color' => '#037fff'],
328 'wrapHoverBorder' => (object)['openBorder'=>0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4','type' => 'solid'],
329 'wrapHoverRadius' => (object)['lg' =>'', 'unit' =>'px'],
330 'wrapHoverShadow' => (object)['openShadow' => 0, 'width' => (object)['top' => 1, 'right' => 1, 'bottom' => 1, 'left' => 1],'color' => '#009fd4'],
331 'wrapMargin' => (object)['lg' =>(object)['top' => '','bottom' => '', 'unit' =>'px']],
332 'wrapOuterPadding' => (object)['lg' =>(object)['top' => '','bottom' => '','left' => '', 'right' => '', 'unit' =>'px']],
333 'wrapInnerPadding' => (object)['lg' =>(object)['unit' =>'px']],
334 'advanceId' => '',
335 'advanceZindex' => '',
336 'hideExtraLarge' => false,
337 'hideTablet' => false,
338 'hideMobile' => false,
339 'advanceCss' => '',
340 'currentPostId' => '',
341 );
342 }
343
344 public function register() {
345 register_block_type( 'ultimate-post/post-module-2',
346 array(
347 'editor_script' => 'ultp-blocks-editor-script',
348 'editor_style' => 'ultp-blocks-editor-css',
349 'render_callback' => array($this, 'content')
350 )
351 );
352 }
353
354 public function content($attr, $noAjax) {
355 $attr = wp_parse_args($attr, $this->get_attributes());
356 global $unique_ID;
357
358 if (!$noAjax) {
359 $paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
360 $attr['paged'] = $paged ? $paged : 1;
361 }
362 if($attr['queryUnique'] && isset($attr['savedQueryUnique'])) {
363 $unique_ID = $attr['savedQueryUnique'];
364 }
365
366 $block_name = 'post-module-2';
367 $wraper_before = $wraper_after = $post_loop = '';
368 $attr['queryNumber'] = ultimate_post()->get_post_number(5, $attr['queryNumber'], $attr['queryNumPosts']);
369 $recent_posts = new \WP_Query( ultimate_post()->get_query( $attr ) );
370 $pageNum = ultimate_post()->get_page_number($attr, $recent_posts->found_posts);
371 // Dummy Img Url
372 $dummy_url = ULTP_URL.'assets/img/ultp-fallback-img.png';
373
374 // Loadmore and Unique content
375 if($attr['queryUnique'] && isset($attr['loadMoreQueryUnique']) && $attr['paginationShow'] && ($attr['paginationType'] == 'loadMore')) {
376 $unique_ID = $attr['loadMoreQueryUnique'];
377 $current_unique_posts = $attr['ultp_current_unique_posts'];
378 }
379
380 if ($recent_posts->have_posts()) {
381
382 $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"]:'').'">';
383 $wraper_before .= '<div class="ultp-block-wrapper">';
384
385 // Loading
386 $wraper_before .= ultimate_post()->loading();
387
388 if ($attr['headingShow'] || $attr['filterShow'] || $attr['paginationShow']) {
389 $wraper_before .= '<div class="ultp-heading-filter">';
390 $wraper_before .= '<div class="ultp-heading-filter-in">';
391
392 // Heading
393 include ULTP_PATH.'blocks/template/heading.php';
394
395 if ($attr['filterShow'] || $attr['paginationShow']) {
396 $wraper_before .= '<div class="ultp-filter-navigation">';
397 // Filter
398 if($attr['filterShow'] && $attr['queryType'] != 'posts' && $attr['queryType'] != 'customPosts') {
399 include ULTP_PATH.'blocks/template/filter.php';
400 }
401 // Navigation
402 if ($attr['paginationShow'] && ($attr['paginationType'] == 'navigation') && ($attr['navPosition'] == 'topRight')) {
403 include ULTP_PATH.'blocks/template/navigation-before.php';
404 }
405 $wraper_before .= '</div>';
406 }
407
408 $wraper_before .= '</div>';
409 $wraper_before .= '</div>';
410 }
411
412 $wraper_before .= '<div class="ultp-block-items-wrap ultp-block-post-module2 ultp-block-content-'.$attr['varticalAlign'].' ultp-block-content-'.($attr['columnFlip'] ? 'true' : 'false').' ultp-'.$attr['layout'].'">';
413 $idx = 0; // $idx = $noAjax ? 1 : 0;
414 while ( $recent_posts->have_posts() ): $recent_posts->the_post();
415
416 include ULTP_PATH.'blocks/template/data.php';
417
418 include ULTP_PATH.'blocks/template/category.php';
419
420 if ($attr['queryUnique']) {
421 $unique_ID[$attr['queryUnique']][] = $post_id;
422 $current_unique_posts[] = $post_id;
423 }
424
425 $post_loop .= '<'.$attr['contentTag'].' class="ultp-block-item post-id-'.$post_id.'">';
426
427 $post_loop .= '<div class="ultp-block-content-wrap">';
428 if (($post_thumb_id || $attr['fallbackEnable']) && $attr['showImage'] && ($idx == 0 || ($attr['layout'] == 'layout2') || ($attr['layout'] == 'layout3') || ($attr['layout'] == 'layout5') )) {
429 $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 : '' ).'">';
430 if ($idx == 0) {
431 $post_loop .= '<a href="'.$titlelink.'" '.($attr['openInTab'] ? 'target="_blank"' : '').'>';
432 // Post Image Id
433 $block_img_id = $post_thumb_id ? $post_thumb_id : ($attr['fallbackEnable'] && isset($attr['fallbackImg']['id']) ? $attr['fallbackImg']['id'] : '');
434 // Post Image
435 if($post_thumb_id || ($attr['fallbackEnable'] && $block_img_id)) {
436 $post_loop .= ultimate_post()->get_image($block_img_id, $attr['imgCrop'], '', $title, $attr['imgSrcset'], $attr['imgLazy']);
437 } else {
438 $post_loop .= '<img src="'.$dummy_url.'" alt="dummy-img" />';
439 }
440 $post_loop .= '</a>';
441 } else {
442 if (($attr['layout'] == 'layout2') || ($attr['layout'] === 'layout3') || ($attr['layout'] === 'layout5')) {
443 // Image
444 $post_loop .= '<a href="'.$titlelink.'" '.($attr['openInTab'] ? 'target="_blank"' : '').'>';
445 // Post Image Id
446 $block_img_id = $post_thumb_id ? $post_thumb_id : ($attr['fallbackEnable'] && isset($attr['fallbackImg']['id']) ? $attr['fallbackImg']['id'] : '');
447 // Post Image
448 if($post_thumb_id || ($attr['fallbackEnable'] && $block_img_id)) {
449 $post_loop .= ultimate_post()->get_image($block_img_id, $attr['imgCropSmall'], '', $title, $attr['imgSrcset'], $attr['imgLazy']);
450 } else {
451 $post_loop .= '<img src="'.$dummy_url.'" alt="dummy-img" />';
452 }
453 $post_loop .= '</a>';
454 }
455 if($post_video){
456 $post_loop .= '<div enableAutoPlay="'.$attr['popupAutoPlay'].'" class="ultp-video-icon">'.ultimate_post()->svg_icon('play_line').'</div>';
457 }
458 }
459 if (($attr['catPosition'] != 'aboveTitle') && ($idx == 0 || $attr['showSmallCat']) && $attr['catShow'] ) {
460 $post_loop .= '<div class="ultp-category-img-grid">'.$category.'</div>';
461 }
462 $post_loop .= '</div>';
463 if($post_video && $idx == 0){
464 $post_loop .= '<div enableAutoPlay="'.$attr['popupAutoPlay'].'" class="ultp-video-icon">'.ultimate_post()->svg_icon('play_line').'</div>';
465 }
466 }
467 $post_loop .= '<div class="ultp-block-content">';
468 // Category
469 if (($attr['catPosition'] == 'aboveTitle') && ($idx == 0 || $attr['showSmallCat'] ) && $attr['catShow']) {
470 $post_loop .= $category;
471 }
472 // Title
473 if ($title && $attr['titleShow'] && $attr['titlePosition'] == 1) {
474 include ULTP_PATH.'blocks/template/title.php';
475 }
476 // Meta
477 if ($attr['metaPosition'] =='top' ) {
478 include ULTP_PATH.'blocks/template/meta.php';
479 }
480 // Title
481 if ($title && $attr['titleShow'] && $attr['titlePosition'] == 0) {
482 include ULTP_PATH.'blocks/template/title.php';
483 }
484 // Excerpt
485 if (($idx == 0 || $attr['showSmallExcerpt']) && $attr['excerptShow']) {
486 $post_loop .= '<div class="ultp-block-excerpt">'.ultimate_post()->get_excerpt($post_id, $attr['showSeoMeta'], $attr['showFullExcerpt'], $attr['excerptLimit']).'</div>';
487 }
488
489 // Read More
490 if ($attr['readMore'] && ($idx == 0 || $attr['showSmallBtn'])) {
491 $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>';
492 }
493 // Bottom
494 if ($attr['metaPosition'] =='bottom' ) {
495 include ULTP_PATH.'blocks/template/meta.php';
496 }
497 $post_loop .= '</div>';
498 $post_loop .= '</div>';
499 if($post_video && $attr['enablePopup'] && ($attr['layout'] != 'layout1' && $attr['layout'] != 'layout4' || $idx == 0)) {
500 include ULTP_PATH.'blocks/template/video_popup.php';
501 }
502 $post_loop .= '</'.$attr['contentTag'].'>';
503
504 if ($idx == 0) {
505 $bigloop = $post_loop;
506 $post_loop = '';
507 }
508
509 $idx ++;
510 endwhile;
511 if($attr['queryUnique']) {
512 $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>";
513 }
514 $bigloop = '<div class="ultp-big-post-module2">'.$bigloop.'</div>';
515 $post_loop = $bigloop.'<div class="ultp-small-post-module2">'.$post_loop.'</div>';
516
517 $wraper_after .= '</div>';//ultp-block-items-wrap
518 $wraper_after .= '</div>';
519 $wraper_after .= '</div>';
520
521 wp_reset_query();
522 }else {
523 $wraper_before .= ultimate_post()->get_no_result_found_html( $attr['notFoundMessage'] );
524 }
525
526 return $noAjax ? $post_loop : $wraper_before.$post_loop.$wraper_after;
527 }
528 }