PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 2.7.3
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v2.7.3
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
← All changes | inc/block-posts-config/class-bs-post.php +90 -49 2.5.3 → 2.7.3 View file →
@@ -69,9 +69,9 @@
69 69 $grid_query = new WP_Query($query_args);
70 70 return $grid_query;
71 71 }
72 72
73 -function blockspare_query_loop_and_wrapper($attributes,$blockclass ='',$design='',$blockName=''){
73 +function blockspare_query_loop_and_wrapper($attributes,$blockclass ='',$design='',$blockName='', $layoutClass=false){
74 74 $unq_class = mt_rand(100000,999999);
75 75 $blockuniqueclass = '';
76 76
77 77 if(!empty($attributes['uniqueClass'])){
@@ -91,11 +91,10 @@
91 91 if (isset($attributes['className'])) {
92 92 $class .= ' ' . $attributes['className'];
93 93 }
94 94
95 - $animation_class = '';
96 95 if( $attributes['animation']){
97 - $animation_class='blockspare-block-animation';
96 + $class .=' blockspare-block-animation';
98 97 }
99 98
100 99
101 100
@@ -101,24 +100,24 @@
101 100
102 101 $list_layout_class = $design;
103 102 $listgridClass = $blockclass . " " ;
104 103
105 - if($blockName=='' ){
106 - $listgridClass .= "column-" . $attributes['columns'];
107 - }
104 + // if($blockName=='' ){
105 + // $listgridClass .= "column-" . $attributes['columns'];
106 + // }
108 107
109 108
110 109 /* Layout orientation class */
111 - $grid_class = $blockuniqueclass . ' blockspare-posts-block-latest-post-wrap ' . $listgridClass . ' ' . $list_layout_class.' '.$animation_class ;
112 -
110 + $grid_class = 'blockspare-posts-block-latest-post-wrap ' . $listgridClass . ' ' . $list_layout_class ;
111 + $class .= ' ' . $blockuniqueclass;
113 112 $category_class = 'blockspare-posts-block-post-category';
114 113
115 114 if($attributes['categoryLayoutOption'] =='none'){
116 115 $category_class .= ' has-no-category-style';
117 - }?>
118 - <div class="<?php echo esc_attr($class);?>">
116 + } ?>
117 + <!-- <div class="<?php echo esc_attr($class);?>" blockspare-animation=<?php echo esc_attr( $attributes['animation'] )?>> -->
119 118 <section class="blockspare-posts-block-post-wrap">
120 - <div class="<?php echo esc_attr($grid_class);?>" blockspare-animation=<?php echo esc_attr( $attributes['animation'] )?>>
119 + <div class="<?php echo esc_attr($grid_class);?>" >
121 120 <?php while ($grid_query->have_posts()) {
122 121 $grid_query->the_post();
123 122
124 123 /* Setup the post ID */
@@ -155,10 +154,27 @@
155 154 $contentOrderClass .= 'contentordertwo';
156 155 }
157 156
158 157 /* Setup the post classes */
159 - $post_classes = 'blockspare-posts-block-post-single '. $contentOrderClass;
158 + $post_classes = 'blockspare-posts-block-post-single blockspare-hover-item '. $contentOrderClass;
159 +
160 + if($layoutClass) {
161 + $post_classes .= ' has-background';
162 + } else {
163 + $post_classes .= ' blockspare-hover-child';
164 + }
160 165
166 + $className='';
167 +
168 + if(isset($attributes['full'])){
169 + if($attributes['full']== 'blockspare-posts-block-full-layout-6' ){
170 + $post_classes .= ' blockspare-hover-child';
171 + $className .= 'hover-child';
172 + }
173 +
174 + }
175 +
176 +
161 177 /* Add sticky class */
162 178 if (is_sticky($post_id)) {
163 179 $post_classes .= ' sticky';
164 180 } else {
@@ -166,27 +182,34 @@
166 182 }
167 183 $post_classes .= ' has-background';
168 184 ?>
169 185 <div id="<?php echo esc_attr($post_id);?>" class="<?php echo esc_attr($post_classes).' '.$has_img_class; ?>">
170 - <?php blockspare_post_image($attributes,$post_id,$category_class,$blockName);?>
171 - <?php blockspare_post_content($attributes,$post_id,$category_class,$blockName);?>
186 + <?php blockspare_post_image($attributes,$post_id,$category_class,$blockName, $className);?>
187 + <?php blockspare_post_content($attributes,$post_id,$category_class,$blockName, $className);?>
172 188 </div>
173 189
174 - <?php }?>
190 + <?php } ?>
175 191
176 192 </div>
177 193 <?php
178 - if($attributes['enablePagination']=='true' && $grid_query->max_num_pages >1){ ?>
179 - <div class="bs_blockspare_loadmore blockspare-readmore-wrapper" block-name="tile" data-page='2' blockspare-att=<?php echo "'" . wp_kses_post(wp_json_encode($attributes))."'";?> max-paged="<?php echo $grid_query->max_num_pages;?>">
194 + if($attributes['enablePagination']=='true' && $grid_query->max_num_pages >1){
195 + $loadmore_class = '';
196 + if($attributes['loadMoreStyle']){
197 + $loadmore_class = $attributes['loadMoreStyle'];
198 + }
199 + if($attributes['loadMoreAlignment']){
200 + $loadmore_class .= ' bs_blockspare_loadmore_' . $attributes['loadMoreAlignment'];
201 + }
202 + ?>
203 + <div class="bs_blockspare_loadmore blockspare-readmore-wrapper <?php echo esc_attr($loadmore_class);?>" data-layout="<?php echo $layoutClass; ?>" block-name="<?php echo esc_attr($blockName)?>" data-page='2' blockspare-att=<?php echo "'" . wp_kses_post(wp_json_encode($attributes))."'";?> max-paged="<?php echo $grid_query->max_num_pages;?>">
180 204 <a href="#" class="blockspare-readmore">
181 - <div class="ajax-loader"></div>
182 - <span class="load-btn"><?php echo($attributes['loadMoreText']); ?></span>
205 + <div class="load-btn "><?php echo($attributes['loadMoreText']); ?><span class="ajax-loader"></span></div>
183 206 </a>
184 207 </div><?php
185 208 }
186 209 ?>
187 210 </section>
188 - </div>
211 + <!-- </div> -->
189 212 <?php }
190 213
191 214 wp_reset_postdata();
192 215
@@ -218,9 +241,10 @@
218 241 }
219 242
220 243
221 244
222 - if(isset($attributes['enableFeatureImage']) && $attributes['enableFeatureImage'] == true){
245 +
246 + if(isset($attributes['enableFeatureImage']) && $attributes['enableFeatureImage'] == 'true'){
223 247 ?>
224 248 <figure class="blockspare-posts-block-post-img">
225 249 <a href="<?php echo esc_url(get_permalink($post_id));?>" rel="bookmark" aria-hidden="true"
226 250 tabindex="-1">
@@ -226,20 +250,20 @@
226 250 tabindex="-1">
227 251 <?php
228 252 if(has_post_thumbnail($post_id)){
229 253
230 - echo wp_kses_post(wp_get_attachment_image($post_thumb_id, $post_thumb_size));
231 - }else{?>
254 + echo wp_kses_post(wp_get_attachment_image($post_thumb_id, $post_thumb_size, '', ["class" => 'hover-child']));
255 + }else{ ?>
232 256 <div class="bs-no-thumbnail-img"> </div>
233 257 <?php } ?>
234 258 </a>
235 - <?php if ($attributes['displayPostCategory'] && $content_order==true){?>
259 + <?php if ($attributes['displayPostCategory'] =='true'&& $content_order==true){ ?>
236 260 <!-- Category -->
237 261 <div class="<?php echo esc_attr($cat_class);?>">
238 262 <?php blockspare_get_cat_tax_tags($attributes['taxType'],$post_id);?>
239 263 </div>
240 264 <!-- Category -->
241 - <?php }?>
265 + <?php } ?>
242 266 </figure>
243 267 <?php
244 268 }
245 269
@@ -247,9 +271,9 @@
247 271
248 272
249 273 }
250 274
251 -function blockspare_post_content($attributes,$post_id,$cat_class,$blockName=''){
275 +function blockspare_post_content($attributes,$post_id,$cat_class,$blockName='', $className=''){
252 276 $content_order = false;
253 277 if($attributes['contentOrder']=='content-order-1' || $attributes['contentOrder']=='content-order-2'){
254 278 $content_order =true;
255 279 }
@@ -256,19 +280,28 @@
256 280 if($blockName =='full'){
257 281 $content_order =false;
258 282 }
259 283 ?>
260 - <div class="blockspare-posts-block-post-content <?php echo esc_attr($attributes['contentOrder']); ?> <?php echo esc_attr($attributes['titleOnHover'])?>">
284 + <div class="blockspare-posts-block-post-content <?php echo esc_attr($className); ?> <?php echo esc_attr($attributes['contentOrder']); ?> <?php echo esc_attr($attributes['titleOnHover'])?>">
261 285 <div class="blockspare-posts-block-bg-overlay"></div>
262 286 <!-- blockspare-posts-block-post-grid-header -->
263 287 <header class="blockspare-posts-block-post-grid-header">
264 - <?php if ($attributes['displayPostCategory'] && $content_order ==false) {?>
288 + <!--display category when feature image is disable -->
289 + <?php if ($attributes['displayPostCategory']=='true' && $attributes['enableFeatureImage']!='true') {?>
265 290 <!-- Category -->
266 291 <div class="<?php echo esc_attr($cat_class);?>">
267 - <?php blockspare_get_cat_tax_tags($attributes['taxType'],$post_id);?>
292 + <?php blockspare_get_cat_tax_tags($attributes['taxType'],$post_id,$attributes['postType']);?>
268 293 </div>
269 294 <!-- Category -->
270 - <?php }?>
295 + <?php }?>
296 + <!--display category when feature image is enable-->
297 + <?php if ($attributes['displayPostCategory']=='true' && $attributes['enableFeatureImage']=='true' && $content_order ==false) {?>
298 + <!-- Category -->
299 + <div class="<?php echo esc_attr($cat_class);?>">
300 + <?php blockspare_get_cat_tax_tags($attributes['taxType'],$post_id,$attributes['postType']);?>
301 + </div>
302 + <!-- Category -->
303 + <?php }?>
271 304 <!-- blockspare-posts-block-post-grid-title -->
272 305
273 306 <h4 class="blockspare-posts-block-post-grid-title">
274 307 <a href="<?php echo esc_url(get_permalink($post_id)); ?>" class="blockspare-posts-block-title-link"
@@ -281,9 +314,9 @@
281 314
282 315 <!-- blockspare-posts-block-post-grid-byline -->
283 316 <div class="blockspare-posts-block-post-grid-byline">
284 317 <!-- blockspare-posts-block-post-grid-author -->
285 - <?php if (isset($attributes['displayPostAuthor']) && $attributes['displayPostAuthor'] =='true') {?>
318 + <?php if (isset($attributes['displayPostAuthor']) && $attributes['displayPostAuthor'] =='true') { ?>
286 319 <div class="blockspare-posts-block-post-grid-author">
287 320 <!-- <a class="blockspare-posts-block-text-link" href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID')));?>"
288 321 itemprop="url" rel="author">
289 322 <span itemprop="name">
@@ -296,28 +329,21 @@
296 329 $blockspare_get_multiauthor= new BlocksapreMultiAuthorForFrontend();
297 330 $blockspare_get_multiauthor->blockspare_front_by_author($post_id,$attributes['authorIcon'],$author_id);
298 331 ?>
299 332 </div>
300 - <?php }?>
333 + <?php } ?>
301 334 <!-- blockspare-posts-block-post-grid-author -->
302 335
303 336 <!-- blockspare-posts-block-post-grid-date -->
304 - <?php if(isset($attributes['displayPostDate']) && $attributes['displayPostDate'] =='true') {?>
305 - <time datetime="<?php echo esc_attr(get_the_date('c', $post_id));?>"
306 - class="blockspare-posts-block-post-grid-date" itemprop="datePublished">
307 - <i class="<?php echo esc_attr($attributes['dateIcon']);?>"></i>
308 - <?php echo esc_html(get_the_date('', $post_id));?>
309 - </time>
310 - <?php }?>
337 + <?php if(isset($attributes['displayPostDate']) && $attributes['displayPostDate'] =='true') { ?>
338 + <time datetime="<?php echo esc_attr(get_the_date('c', $post_id));?>" class="blockspare-posts-block-post-grid-date" itemprop="datePublished"><i class="<?php echo esc_attr($attributes['dateIcon']);?>"></i><?php echo esc_html(get_the_date('', $post_id));?></time>
339 + <?php } ?>
311 340 <!-- blockspare-posts-block-post-grid-date -->
312 341
313 342 <!-- comment_count -->
314 - <?php if($attributes['enableComment'] =='true'){?>
315 - <span class="comment_count">
316 - <i class='<?php echo esc_attr($attributes['commentIcon']);?>'></i>
317 - <?php echo esc_html(get_comments_number($post_id)); ?>
318 - </span>
319 - <?php }?>
343 + <?php if($attributes['enableComment'] =='true'){ ?>
344 + <span class="comment_count"><i class='<?php echo esc_attr($attributes['commentIcon']);?>'></i><?php echo esc_html(get_comments_number($post_id)); ?></span>
345 + <?php } ?>
320 346 <!-- comment_count -->
321 347 </div>
322 348 <!-- blockspare-posts-block-post-grid-byline -->
323 349 </header>
@@ -326,9 +352,9 @@
326 352 <?php
327 353 $excerpt = blockspare_excerpt ($post_id,$attributes['excerptLength']);
328 354 $new_excerpt = apply_filters( 'the_excerpt', $excerpt );?>
329 355 <!-- blockspare-posts-block-post-grid-excerpt -->
330 - <?php if ($attributes['displayPostExcerpt'] && $new_excerpt != null || isset($attributes['displayPostLink'])) { ?>
356 + <?php if ($attributes['displayPostExcerpt']=='true' && $new_excerpt != null) { ?>
331 357 <div class="blockspare-posts-block-post-grid-excerpt">
332 358 <!-- blockspare-posts-block-post-grid-excerpt-content -->
333 359 <?php if (isset($attributes['displayPostExcerpt']) && $attributes['displayPostExcerpt'] =='true') { ?>
334 360 <div class="blockspare-posts-block-post-grid-excerpt-content">
@@ -333,9 +359,9 @@
333 359 <?php if (isset($attributes['displayPostExcerpt']) && $attributes['displayPostExcerpt'] =='true') { ?>
334 360 <div class="blockspare-posts-block-post-grid-excerpt-content">
335 361 <?php echo wp_kses_post($excerpt); ?>
336 362 </div>
337 - <?php }?>
363 + <?php } ?>
338 364 <!-- blockspare-posts-block-post-grid-excerpt-content -->
339 365 <!-- blockspare-posts-block-post-grid-more-link -->
340 366 <?php if (isset($attributes['displayPostLink']) && $attributes['displayPostLink'] =='true') { ?>
341 367 <p>
@@ -343,12 +369,12 @@
343 369 href="<?php echo esc_url(get_permalink($post_id)); ?>" rel="bookmark">
344 370 <span><?php echo esc_html($attributes['readMoreText']); ?></span>
345 371 </a>
346 372 </p>
347 - <?php }?>
373 + <?php } ?>
348 374 <!-- blockspare-posts-block-post-grid-more-link -->
349 375 </div>
350 - <?php }?>
376 + <?php } ?>
351 377 <!-- blockspare-posts-block-post-grid-excerpt -->
352 378
353 379 </div>
354 380 <?php }
@@ -363,9 +389,21 @@
363 389 return $fonts;
364 390
365 391 }
366 392
393 + function bscheckFontfamilyWeight($fontFamilyWeight){
367 394
395 +
396 +
397 + $fontsweight = '';
398 + if($fontFamilyWeight!='' && $fontFamilyWeight !="undefined"){
399 + $fontsweight = 'font-weight:'.$fontFamilyWeight;
400 + }
401 + return $fontsweight;
402 +
403 + }
404 +
405 +
368 406 function blockspare_excerpt($post_id,$length=''){
369 407 $excerpt = get_post_field(
370 408 'post_excerpt',
371 409 $post_id,
@@ -371,13 +409,16 @@
371 409 $post_id,
372 410 'display'
373 411 );
374 412
413 + $excerpt =preg_replace( '~^(\s*(?:&nbsp;)?)*~i', '', $excerpt );
414 +
375 415 if ( empty( $excerpt ) ) {
376 416 $excerpt = preg_replace(
377 417 array(
378 418 '/\<figcaption>.*\<\/figcaption>/',
379 419 '/\[caption.*\[\/caption\]/',
420 + '`[[^]]*]`'
380 421 ),
381 422 '',
382 423 get_the_content()
383 424 );