PluginProbe
Post Grid Gutenberg Blocks – PostX / 3.0.0
Post Grid Gutenberg Blocks – PostX v3.0.0
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.0.0, at blocks/Post_Module_2.php

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