| 1 |
<?php |
| 2 |
|
| 3 |
if(!function_exists('blockspare_slider_render_block_core_latest_posts_list')){ |
| 4 |
function blockspare_slider_render_block_core_latest_posts_list($attributes) |
| 5 |
{ |
| 6 |
|
| 7 |
ob_start(); |
| 8 |
$unq_class = mt_rand(100000,999999); |
| 9 |
$blockuniqueclass = ''; |
| 10 |
|
| 11 |
if(!empty($attributes['uniqueClass'])){ |
| 12 |
$blockuniqueclass = $attributes['uniqueClass']; |
| 13 |
}else{ |
| 14 |
$blockuniqueclass = 'blockspare-posts-block-list-'.$unq_class; |
| 15 |
} |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
if ( isset( $attributes['categories'] ) && ! empty( $attributes['categories'] ) && is_array( $attributes['categories'] ) ) { |
| 20 |
$categories = array(); |
| 21 |
$i = 1; |
| 22 |
foreach ( $attributes['categories'] as $key => $value ) { |
| 23 |
$categories[] = $value['value']; |
| 24 |
} |
| 25 |
} else { |
| 26 |
$categories = array(); |
| 27 |
} |
| 28 |
|
| 29 |
if ( isset( $attributes['tags'] ) && ! empty( $attributes['tags'] ) && is_array( $attributes['tags'] ) ) { |
| 30 |
$tags = array(); |
| 31 |
$i = 1; |
| 32 |
foreach ( $attributes['tags'] as $key => $value ) { |
| 33 |
$tags[] = $value['value']; |
| 34 |
} |
| 35 |
} else { |
| 36 |
$tags = array(); |
| 37 |
} |
| 38 |
|
| 39 |
/* Setup the query */ |
| 40 |
|
| 41 |
$query_args = array( |
| 42 |
'posts_per_page' => $attributes['postsToShow'], |
| 43 |
'post_status' => 'publish', |
| 44 |
'order' => $attributes['order'], |
| 45 |
'orderby' => $attributes['orderBy'], |
| 46 |
'offset' => $attributes['offset'], |
| 47 |
'post_type' => $attributes['postType'], |
| 48 |
'ignore_sticky_posts' => 1, |
| 49 |
); |
| 50 |
|
| 51 |
if($attributes['taxType'] =='category'){ |
| 52 |
$query_args['category__in'] =$categories; |
| 53 |
|
| 54 |
} |
| 55 |
if($attributes['taxType'] =='post_tag'){ |
| 56 |
$query_args['tag__in'] =$tags; |
| 57 |
|
| 58 |
} |
| 59 |
|
| 60 |
|
| 61 |
if($attributes['taxType'] !='category' && $attributes['taxType'] != 'post_tag'){ |
| 62 |
|
| 63 |
$tax_type = $attributes['taxType']; |
| 64 |
if ( $tax_type ) { |
| 65 |
$query_args['tax_query'][] = array( |
| 66 |
'taxonomy' => ( isset( $tax_type ) ) ? $tax_type : 'category', |
| 67 |
'field' => 'id', |
| 68 |
'terms' => $categories, |
| 69 |
'operator' => 'IN' , |
| 70 |
); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
$grid_query = new WP_Query($query_args); |
| 75 |
|
| 76 |
$next = $attributes['carouselNextIcon']; |
| 77 |
$prevstr = str_replace("-right", "-left",$attributes['carouselNextIcon']); |
| 78 |
|
| 79 |
$centermode = false; |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
$responsivelayoutTab = 1; |
| 85 |
$responsivelayoutMobile = 1; |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
if($attributes['numberofSlide']>3){ |
| 90 |
$responsivelayoutTab = 2; |
| 91 |
$responsivelayoutMobile =1; |
| 92 |
}else{ |
| 93 |
$responsivelayoutTab = $attributes['numberofSlide']; |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
$carousel_args = array( |
| 98 |
|
| 99 |
'dots'=>$attributes['showDots'], |
| 100 |
'loop'=>true, |
| 101 |
'autoplay'=> $attributes['enableAutoPlay'], |
| 102 |
'speed'=>$attributes['carouselSpeed'], |
| 103 |
'arrows'=>$attributes['showsliderNextPrev'], |
| 104 |
'slidesToShow'=> 1, |
| 105 |
'centerMode'=>$centermode, |
| 106 |
'responsive' => array( |
| 107 |
array( |
| 108 |
'breakpoint' => 900, |
| 109 |
'settings' => array( |
| 110 |
'slidesToShow' => $responsivelayoutTab, |
| 111 |
'slidesToScroll' => 1, |
| 112 |
'infinite' => true, |
| 113 |
'centerMode'=>false, |
| 114 |
), |
| 115 |
), |
| 116 |
array( |
| 117 |
'breakpoint' => 600, |
| 118 |
'settings' => array( |
| 119 |
'slidesToShow' => $responsivelayoutTab, |
| 120 |
'slidesToScroll' => 1, |
| 121 |
'centerMode'=>false, |
| 122 |
), |
| 123 |
), |
| 124 |
array( |
| 125 |
'breakpoint' => 480, |
| 126 |
'settings' => array( |
| 127 |
'slidesToShow' => $responsivelayoutMobile, |
| 128 |
'slidesToScroll' => 1, |
| 129 |
'centerMode'=>false, |
| 130 |
), |
| 131 |
), |
| 132 |
), |
| 133 |
); |
| 134 |
$carousel_args_encoded = wp_json_encode($carousel_args); |
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
/* Start the loop */ |
| 139 |
if ($grid_query->have_posts()) { |
| 140 |
$alignclass = blockspare_checkalignment($attributes['align']); |
| 141 |
|
| 142 |
/* Build the block classes */ |
| 143 |
$class = "wp-block-blockspare-posts-block-blockspare-posts-block-latest-posts blockspare-posts-block-post-wrap align".$alignclass; |
| 144 |
|
| 145 |
if (isset($attributes['className'])) { |
| 146 |
$class .= ' ' . $attributes['className']; |
| 147 |
} |
| 148 |
$list_layout_class = $attributes['slider']; |
| 149 |
|
| 150 |
|
| 151 |
$hoverNavClass =''; |
| 152 |
if($attributes['enableNavInHover']){ |
| 153 |
$hoverNavClass ='nav-on-hover'; |
| 154 |
} |
| 155 |
//$list_layout_class = $attributes['design']; |
| 156 |
$listgridClass = 'blockspare-posts-block-is-carousel' . " blockspare-posts-block-carousel-full " . "column-" . $attributes['columns'].' '.$attributes['navigationSize'].' '.$attributes['navigationShape'].' '.$hoverNavClass; |
| 157 |
|
| 158 |
|
| 159 |
/* Layout orientation class */ |
| 160 |
$grid_class = $blockuniqueclass . ' blockspare-posts-block-latest-post-carousel-wrap '.' ' . $listgridClass . ' ' . $list_layout_class. ' has-gutter-space-'.$attributes['gutterSpace']; |
| 161 |
|
| 162 |
$category_class = 'blockspare-posts-block-post-category'; |
| 163 |
|
| 164 |
if($attributes['categoryLayoutOption'] =='none'){ |
| 165 |
$category_class .= ' has-no-category-style'; |
| 166 |
} |
| 167 |
|
| 168 |
?> |
| 169 |
|
| 170 |
<section class="<?php echo esc_attr($class);?>"> |
| 171 |
<div class="<?php echo esc_attr($grid_class);?>"> |
| 172 |
<div class="latest-post-carousel" data-slick="<?php echo esc_attr($carousel_args_encoded); ?>" |
| 173 |
data-next="<?php echo esc_attr($next);?>" data-prev="<?php echo esc_attr($prevstr);?>"> |
| 174 |
<?php while ($grid_query->have_posts()) { |
| 175 |
$grid_query->the_post(); |
| 176 |
|
| 177 |
/* Setup the post ID */ |
| 178 |
$post_id = get_the_ID(); |
| 179 |
|
| 180 |
/* Setup the featured image ID */ |
| 181 |
$post_thumb_id = get_post_thumbnail_id($post_id); |
| 182 |
|
| 183 |
$has_img_class = ''; |
| 184 |
|
| 185 |
if (!$post_thumb_id) { |
| 186 |
$has_img_class = "post-has-no-image"; |
| 187 |
} |
| 188 |
|
| 189 |
$contentOrderClass =''; |
| 190 |
if($attributes['contentOrder']=='content-order-1'){ |
| 191 |
$contentOrderClass .= 'contentorderone'; |
| 192 |
} |
| 193 |
if( $attributes['contentOrder']=='content-order-2'){ |
| 194 |
$contentOrderClass .= 'contentordertwo'; |
| 195 |
} |
| 196 |
|
| 197 |
|
| 198 |
/* Setup the post classes */ |
| 199 |
$post_classes = 'blockspare-posts-block-post-single '.$contentOrderClass." ".$attributes['contentOrder']; |
| 200 |
|
| 201 |
if($attributes['enableEqualHeight']){ |
| 202 |
$post_classes .=' bs-has-equal-height'; |
| 203 |
} |
| 204 |
|
| 205 |
/* Add sticky class */ |
| 206 |
if (is_sticky($post_id)) { |
| 207 |
$post_classes .= ' sticky'; |
| 208 |
} else { |
| 209 |
$post_classes .= null; |
| 210 |
} |
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
if ($attributes['enableBackgroundColor']) { |
| 215 |
$post_classes .= ' has-background'; |
| 216 |
} |
| 217 |
|
| 218 |
?> |
| 219 |
|
| 220 |
<div id="<?php echo esc_attr($post_id);?>" |
| 221 |
class="<?php echo esc_attr($post_classes).' '.$has_img_class; ?>"> |
| 222 |
<?php |
| 223 |
|
| 224 |
if (!empty($attributes['imageSize'])) { |
| 225 |
$post_thumb_size = $attributes['imageSize']; |
| 226 |
} |
| 227 |
|
| 228 |
?> |
| 229 |
<figure class="blockspare-posts-block-post-img"> |
| 230 |
<a href="<?php echo esc_url(get_permalink($post_id));?>" rel="bookmark" aria-hidden="true" |
| 231 |
tabindex="-1"> |
| 232 |
<?php |
| 233 |
if(has_post_thumbnail($post_id)){ |
| 234 |
echo wp_kses_post(wp_get_attachment_image($post_thumb_id,$post_thumb_size)); |
| 235 |
}else{?> |
| 236 |
<div class="bs-no-thumbnail-img"> </div> |
| 237 |
<?php } ?> |
| 238 |
</a> |
| 239 |
<?php |
| 240 |
if ($attributes['displayPostCategory'] ) {?> |
| 241 |
<div class="<?php echo esc_attr($category_class);?>"> |
| 242 |
<?php |
| 243 |
if($attributes['postType']=='post'){ |
| 244 |
$categories_list = get_the_category_list(' ', '', $post_id); |
| 245 |
if ( $categories_list ) { |
| 246 |
/* translators: 1: list of categories. */ |
| 247 |
printf( esc_html__( '%1$s', 'blockspare' ), $categories_list ); // WPCS: XSS OK. |
| 248 |
} |
| 249 |
} |
| 250 |
if($attributes['postType']!='post'){ |
| 251 |
$terms = get_the_terms($post_id , $attributes['taxType'] ); |
| 252 |
if($terms){ |
| 253 |
foreach($terms as $trem){?> |
| 254 |
<a herf= ><?php echo $trem->name; ?></a> |
| 255 |
<?php } |
| 256 |
} |
| 257 |
}?> |
| 258 |
</div> |
| 259 |
|
| 260 |
<?php }?> |
| 261 |
</figure> |
| 262 |
|
| 263 |
<div |
| 264 |
class="blockspare-posts-block-post-content <?php echo esc_attr($attributes['contentOrder']); ?> <?php echo esc_attr($attributes['titleOnHover'])?>"> |
| 265 |
<div class="blockspare-posts-block-bg-overlay"></div> |
| 266 |
<header class="blockspare-posts-block-post-grid-header"> |
| 267 |
<?php |
| 268 |
if ($attributes['displayPostCategory']) { ?> |
| 269 |
<div class="<?php echo esc_attr($category_class);?>"> |
| 270 |
<?php |
| 271 |
if($attributes['postType']=='post'){ |
| 272 |
$categories_list = get_the_category_list(' ', '', $post_id); |
| 273 |
if ( $categories_list ) { |
| 274 |
/* translators: 1: list of categories. */ |
| 275 |
printf( esc_html__( '%1$s', 'blockspare' ), $categories_list ); // WPCS: XSS OK. |
| 276 |
} |
| 277 |
} |
| 278 |
if($attributes['postType']!='post'){ |
| 279 |
$terms = get_the_terms($post_id , $attributes['taxType'] ); |
| 280 |
if($terms){ |
| 281 |
foreach($terms as $trem){?> |
| 282 |
<a herf= ><?php echo $trem->name; ?></a> |
| 283 |
<?php } |
| 284 |
} |
| 285 |
}?> |
| 286 |
</div> |
| 287 |
<?php } |
| 288 |
$title = get_the_title($post_id); |
| 289 |
if (!$title) { |
| 290 |
$title = __('Untitled', 'blockspare'); |
| 291 |
}?> |
| 292 |
<h4 class="blockspare-posts-block-post-grid-title"> |
| 293 |
<a href="<?php echo esc_url(get_permalink($post_id)); ?>" |
| 294 |
class="blockspare-posts-block-title-link" rel="bookmark"> |
| 295 |
<span><?php echo esc_html($title); ?></span></a> |
| 296 |
</h4> |
| 297 |
|
| 298 |
<?php |
| 299 |
if(isset($attributes['postType']) && ($attributes['postType'] === 'post') && (isset($attributes['displayPostAuthor']) || isset($attributes['displayPostDate']))) {?> |
| 300 |
<div class="blockspare-posts-block-post-grid-byline"> |
| 301 |
<?php |
| 302 |
if (isset($attributes['displayPostAuthor']) && $attributes['displayPostAuthor']) {?> |
| 303 |
<div class="blockspare-posts-block-post-grid-author"> |
| 304 |
<a class="blockspare-posts-block-text-link" |
| 305 |
href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID')));?>" |
| 306 |
itemprop="url" rel="author"> |
| 307 |
<span itemprop="name"><i |
| 308 |
class="<?php echo esc_attr($attributes['authorIcon']);?>"></i><?php echo esc_html(get_the_author_meta('display_name', get_the_author_meta('ID')));?></span> |
| 309 |
</a> |
| 310 |
</div> |
| 311 |
<?php } |
| 312 |
|
| 313 |
if(isset($attributes['displayPostDate']) && $attributes['displayPostDate']) {?> |
| 314 |
<time datetime="<?php echo esc_attr(get_the_date('c', $post_id));?>" |
| 315 |
class="blockspare-posts-block-post-grid-date" itemprop="datePublished"><i |
| 316 |
class="<?php echo esc_attr($attributes['dateIcon']);?>"></i><?php echo esc_html(get_the_date('', $post_id));?></time> |
| 317 |
<?php |
| 318 |
} |
| 319 |
if($attributes['enableComment']){?> |
| 320 |
|
| 321 |
<span class="comment_count"><i |
| 322 |
class='<?php echo esc_attr($attributes['commentIcon']);?>'></i> |
| 323 |
<?php echo esc_html(get_comments_number($post_id)); ?> |
| 324 |
</span> |
| 325 |
<?php }?> |
| 326 |
</div> |
| 327 |
|
| 328 |
<?php }?> |
| 329 |
|
| 330 |
</header> |
| 331 |
|
| 332 |
<?php |
| 333 |
/* Get the excerpt */ |
| 334 |
|
| 335 |
$excerpt = get_post_field( |
| 336 |
'post_excerpt', |
| 337 |
$post_id, |
| 338 |
'display' |
| 339 |
); |
| 340 |
|
| 341 |
if ( empty( $excerpt ) ) { |
| 342 |
$excerpt = preg_replace( |
| 343 |
array( |
| 344 |
'/\<figcaption>.*\<\/figcaption>/', |
| 345 |
'/\[caption.*\[\/caption\]/', |
| 346 |
), |
| 347 |
'', |
| 348 |
get_the_content() |
| 349 |
); |
| 350 |
} |
| 351 |
|
| 352 |
// Trim the excerpt if necessary. |
| 353 |
if ( isset( $attributes['excerptLength'] ) ) { |
| 354 |
$excerpt = wp_trim_words( |
| 355 |
$excerpt, |
| 356 |
$attributes['excerptLength'] |
| 357 |
); |
| 358 |
} |
| 359 |
|
| 360 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- This is a WP core filter. |
| 361 |
$excerpt = apply_filters( 'the_excerpt', $excerpt ); |
| 362 |
if ($attributes['displayPostExcerpt'] && $excerpt != null || isset($attributes['displayPostLink'])) { ?> |
| 363 |
<div class="blockspare-posts-block-post-grid-excerpt"> |
| 364 |
<?php if (isset($attributes['displayPostExcerpt']) && $attributes['displayPostExcerpt']) { ?> |
| 365 |
<div class="blockspare-posts-block-post-grid-excerpt-content"><?php echo wp_kses_post($excerpt); ?> |
| 366 |
</div> |
| 367 |
<?php } ?> |
| 368 |
|
| 369 |
|
| 370 |
<?php } |
| 371 |
|
| 372 |
if (isset($attributes['displayPostLink']) && $attributes['displayPostLink']) { ?> |
| 373 |
<p> |
| 374 |
<a class="blockspare-posts-block-post-grid-more-link blockspare-posts-block-text-link" |
| 375 |
href="<?php echo esc_url(get_permalink($post_id)); ?>" rel="bookmark"> |
| 376 |
<span><?php echo esc_html($attributes['readMoreText']); ?></span></a> |
| 377 |
</p> |
| 378 |
|
| 379 |
<?php } ?> |
| 380 |
</div> |
| 381 |
|
| 382 |
</div> |
| 383 |
|
| 384 |
</div> |
| 385 |
<?php }?> |
| 386 |
</div> |
| 387 |
</div> |
| 388 |
</section> |
| 389 |
<?php wp_reset_postdata(); |
| 390 |
$data_content = latest_posts_style_control_slider($blockuniqueclass ,$attributes); |
| 391 |
$data_content .= ob_get_clean(); |
| 392 |
return $data_content; |
| 393 |
} |
| 394 |
} |
| 395 |
} |
| 396 |
|
| 397 |
/** |
| 398 |
* Registers the post grid block on server |
| 399 |
*/ |
| 400 |
if(!function_exists('blockspare_slider_register_block_core_latest_posts_list')){ |
| 401 |
function blockspare_slider_register_block_core_latest_posts_list() |
| 402 |
{ |
| 403 |
|
| 404 |
if (!function_exists('register_block_type')) { |
| 405 |
return; |
| 406 |
} |
| 407 |
|
| 408 |
|
| 409 |
ob_start(); |
| 410 |
include BLOCKSPARE_PLUGIN_DIR . 'src/blocks/latest-posts-slider/block.json'; |
| 411 |
|
| 412 |
$metadata = json_decode(ob_get_clean(), true); |
| 413 |
|
| 414 |
/* Block attributes */ |
| 415 |
register_block_type( |
| 416 |
'blockspare/blockspare-posts-block-slider', |
| 417 |
array( |
| 418 |
'attributes' =>$metadata['attributes'], |
| 419 |
'render_callback' => 'blockspare_slider_render_block_core_latest_posts_list', |
| 420 |
) |
| 421 |
); |
| 422 |
} |
| 423 |
|
| 424 |
add_action('init', 'blockspare_slider_register_block_core_latest_posts_list'); |
| 425 |
} |
| 426 |
|
| 427 |
|
| 428 |
|
| 429 |
if(!function_exists('latest_posts_style_control_slider')){ |
| 430 |
function latest_posts_style_control_slider($blockuniqueclass ,$attributes) |
| 431 |
{ |
| 432 |
|
| 433 |
|
| 434 |
$block_content = ''; |
| 435 |
$block_content .= '<style type="text/css">'; |
| 436 |
|
| 437 |
//Navigation |
| 438 |
$block_content .= ' .' . $blockuniqueclass . '.blockspare-posts-block-is-carousel span:before, .blockspare-posts-block-latest-post-carousel-wrap ul li button{ |
| 439 |
color:' . $attributes['navigationColor'] . '; |
| 440 |
}'; |
| 441 |
|
| 442 |
$block_content .= ' .' . $blockuniqueclass . '.blockspare-posts-block-is-carousel .slick-slider .slick-dots > li button{ |
| 443 |
background-color:'. $attributes['navigationColor']. ' |
| 444 |
}'; |
| 445 |
|
| 446 |
if($attributes['navigationShape'] == 'lpc-navigation-1' || $attributes['navigationShape'] == 'lpc-navigation-2'){ |
| 447 |
$block_content .= ' .' . $blockuniqueclass . '.blockspare-posts-block-is-carousel .slick-slider .slick-arrow:after{ |
| 448 |
background-color:'. $attributes['navigationShapeColor']. ' |
| 449 |
}'; |
| 450 |
}elseif($attributes['navigationShape'] == 'lpc-navigation-3' || $attributes['navigationShape'] == 'lpc-navigation-4'){ |
| 451 |
$block_content .= ' .' . $blockuniqueclass . '.blockspare-posts-block-is-carousel .slick-slider .slick-arrow{ |
| 452 |
border-color:'. $attributes['navigationShapeColor']. ' |
| 453 |
}'; |
| 454 |
}else{ |
| 455 |
$block_content .= ' .' . $blockuniqueclass . '.blockspare-posts-block-is-carousel .slick-slider .slick-arrow{ |
| 456 |
border-color:transparent ; |
| 457 |
background-color:transparent |
| 458 |
}'; |
| 459 |
|
| 460 |
} |
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
$block_content .= ' .' . $blockuniqueclass . '.blockspare-posts-block-latest-post-carousel-wrap{ |
| 467 |
margin-top:' . $attributes['marginTop'] . 'px; |
| 468 |
margin-bottom:' . $attributes['marginBottom'] . 'px; |
| 469 |
}'; |
| 470 |
|
| 471 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ |
| 472 |
padding-top:' . $attributes['contentPaddingTop'] . 'px; |
| 473 |
padding-right:' . $attributes['contentPaddingRight'] . 'px; |
| 474 |
padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; |
| 475 |
padding-left:' . $attributes['contentPaddingLeft'] . 'px; |
| 476 |
}'; |
| 477 |
|
| 478 |
|
| 479 |
if($attributes['slider']=='blockspare-posts-block-full-layout-5'){ |
| 480 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single > .blockspare-posts-block-post-grid-excerpt{ |
| 481 |
padding-top:' . $attributes['contentPaddingTop'] . 'px; |
| 482 |
padding-right:' . $attributes['contentPaddingRight'] . 'px; |
| 483 |
padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; |
| 484 |
padding-left:' . $attributes['contentPaddingLeft'] . 'px; |
| 485 |
}'; |
| 486 |
} |
| 487 |
|
| 488 |
if ($attributes['categoryLayoutOption'] == 'solid') { |
| 489 |
|
| 490 |
|
| 491 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 492 |
color:' . $attributes['categoryTextColor'] . "!important" . '; |
| 493 |
background-color:' . $attributes['categoryBackgroundColor'] . "!important" . '; |
| 494 |
border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; |
| 495 |
}'; |
| 496 |
|
| 497 |
} else if ($attributes['categoryLayoutOption'] == 'border') { |
| 498 |
|
| 499 |
|
| 500 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 501 |
color:' . $attributes['categoryTextColor'] . "!important" . '; |
| 502 |
background-color:' . "transparent" . '; |
| 503 |
border:' . "1px solid" . $attributes['categoryBorderColor'] . '; |
| 504 |
border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; |
| 505 |
border-width:' . $attributes['categoryBorderWidth'] . "px" . '; |
| 506 |
}'; |
| 507 |
|
| 508 |
} else { |
| 509 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 510 |
color:' . $attributes['categoryTextColor'] . "!important" . '; |
| 511 |
}'; |
| 512 |
} |
| 513 |
|
| 514 |
|
| 515 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category{ |
| 516 |
margin-top:' . $attributes['categoryMarginTop'] . 'px' . '; |
| 517 |
margin-bottom:' . $attributes['categoryMarginBottom'] . 'px' . '; |
| 518 |
}'; |
| 519 |
|
| 520 |
|
| 521 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-byline{ |
| 522 |
|
| 523 |
margin-top:' . $attributes['metaMarginTop'] . 'px' . '; |
| 524 |
margin-bottom:' . $attributes['metaMarginBottom'] . 'px' . '; |
| 525 |
}'; |
| 526 |
|
| 527 |
|
| 528 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link{ |
| 529 |
margin-top:' . $attributes['moreLinkMarginTop'] . 'px' . '; |
| 530 |
margin-bottom:' . $attributes['moreLinkMarginBottom'] . 'px' . '; |
| 531 |
}'; |
| 532 |
|
| 533 |
|
| 534 |
if($attributes['slider']==='blockspare-posts-block-full-layout-6' ) { |
| 535 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-content{ |
| 536 |
background-color:' . $attributes['backGroundColor'] . '; |
| 537 |
|
| 538 |
}'; |
| 539 |
|
| 540 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 541 |
color: ' . $attributes['postTitleColor'] . '; |
| 542 |
|
| 543 |
}'; |
| 544 |
|
| 545 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ |
| 546 |
color:' . $attributes['linkColor'] . '; |
| 547 |
}'; |
| 548 |
|
| 549 |
|
| 550 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ |
| 551 |
color:' . $attributes['linkColor'] . '; |
| 552 |
}'; |
| 553 |
|
| 554 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ |
| 555 |
color:' . $attributes['generalColor'] . '; |
| 556 |
}'; |
| 557 |
|
| 558 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content, '.' .' . $blockuniqueclass . ' .comment_count{ |
| 559 |
color:' . $attributes['generalColor'] . '; |
| 560 |
|
| 561 |
}'; |
| 562 |
}else if($attributes['slider']==='blockspare-posts-block-full-layout-4'){ |
| 563 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 564 |
color: ' . $attributes['fullPostTitleColor'] . '; |
| 565 |
|
| 566 |
}'; |
| 567 |
|
| 568 |
|
| 569 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ |
| 570 |
color:' . $attributes['fullPostLinkColor'] . '; |
| 571 |
}'; |
| 572 |
|
| 573 |
|
| 574 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ |
| 575 |
color:' . $attributes['fullPostLinkColor'] . '; |
| 576 |
}'; |
| 577 |
|
| 578 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ |
| 579 |
color:' . $attributes['fullPostGeneralColor'] . '; |
| 580 |
}'; |
| 581 |
|
| 582 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content, '.' .' . $blockuniqueclass . ' .comment_count{ |
| 583 |
color:' . $attributes['fullPostGeneralColor'] . '; |
| 584 |
|
| 585 |
}'; |
| 586 |
|
| 587 |
}else{ |
| 588 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ |
| 589 |
background-color:' . $attributes['backGroundColor'] . '; |
| 590 |
|
| 591 |
}'; |
| 592 |
|
| 593 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 594 |
color: ' . $attributes['postTitleColor'] . '; |
| 595 |
|
| 596 |
}'; |
| 597 |
|
| 598 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ |
| 599 |
color:' . $attributes['linkColor'] . '; |
| 600 |
}'; |
| 601 |
|
| 602 |
|
| 603 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ |
| 604 |
color:' . $attributes['linkColor'] . '; |
| 605 |
}'; |
| 606 |
|
| 607 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ |
| 608 |
color:' . $attributes['generalColor'] . '; |
| 609 |
}'; |
| 610 |
|
| 611 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content, '.' .' . $blockuniqueclass . ' .comment_count{ |
| 612 |
color:' . $attributes['generalColor'] . '; |
| 613 |
|
| 614 |
}'; |
| 615 |
} |
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title{ |
| 620 |
margin-top:' . $attributes['titleMarginTop'] . 'px' . '; |
| 621 |
margin-bottom:' . $attributes['titleMarginBottom'] . 'px' . '; |
| 622 |
}'; |
| 623 |
|
| 624 |
|
| 625 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content{ |
| 626 |
margin-top:' . $attributes['exceprtMarginTop'] . 'px' . '; |
| 627 |
margin-bottom:' . $attributes['exceprtMarginBottom'] . 'px' . '; |
| 628 |
}'; |
| 629 |
|
| 630 |
|
| 631 |
if($attributes['slider']!='blockspare-posts-block-full-layout-6') { |
| 632 |
if ($attributes['enableBoxShadow']) { |
| 633 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ |
| 634 |
box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; |
| 635 |
border-radius:' . $attributes['borderRadius'] . 'px' . '; |
| 636 |
}'; |
| 637 |
} |
| 638 |
|
| 639 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ |
| 640 |
border-radius:' . $attributes['borderRadius'] . 'px' . '; |
| 641 |
}'; |
| 642 |
|
| 643 |
}else{ |
| 644 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ |
| 645 |
box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; |
| 646 |
border-radius:' . $attributes['borderRadius'] . 'px' . '; |
| 647 |
}'; |
| 648 |
} |
| 649 |
|
| 650 |
|
| 651 |
//Title Hover |
| 652 |
|
| 653 |
if($attributes['titleOnHover']=='lpc-title-hover') { |
| 654 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-title-link:hover span{ |
| 655 |
color: ' . $attributes['titleOnHoverColor'] . '; |
| 656 |
|
| 657 |
}'; |
| 658 |
} |
| 659 |
|
| 660 |
if($attributes['titleOnHover']=='lpc-title-border') { |
| 661 |
$block_content .= ' .' . $blockuniqueclass . ' .lpc-title-border .blockspare-posts-block-post-grid-title .blockspare-posts-block-title-link span:hover{ |
| 662 |
box-shadow: inset 0 -2px 0 0 ' . $attributes['titleOnHoverColor'] . '; |
| 663 |
|
| 664 |
}'; |
| 665 |
} |
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
//Font Settings |
| 671 |
|
| 672 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 673 |
|
| 674 |
font-size: ' . $attributes['postTitleFontSize'] . $attributes['titleFontSizeType'] . '; |
| 675 |
'.bscheckFontfamily($attributes['titleFontFamily']).'; |
| 676 |
font-weight: ' . $attributes['titleFontWeight'] . '; |
| 677 |
}'; |
| 678 |
|
| 679 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ |
| 680 |
font-size:' . $attributes['descriptionFontSize'] . $attributes['descriptionFontSizeType'] . '; |
| 681 |
'.bscheckFontfamily($attributes['descriptionFontFamily']).'; |
| 682 |
font-weight: ' . $attributes['descriptionFontWeight'] . '; |
| 683 |
}'; |
| 684 |
|
| 685 |
$block_content .= '@media (max-width: 1025px) { '; |
| 686 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 687 |
font-size: ' . $attributes['titleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; |
| 688 |
}'; |
| 689 |
$block_content .= ' .' . $blockuniqueclass .' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt{ |
| 690 |
font-size:' . $attributes['descriptionFontSizeTablet'].$attributes['descriptionFontSizeType'].' |
| 691 |
}'; |
| 692 |
$block_content .= '}'; |
| 693 |
|
| 694 |
|
| 695 |
$block_content .= '@media (max-width: 768px) { '; |
| 696 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 697 |
font-size: ' . $attributes['titleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; |
| 698 |
}'; |
| 699 |
$block_content .= ' .' . $blockuniqueclass .' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt{ |
| 700 |
font-size:' . $attributes['descriptionFontSizeMobile'].$attributes['descriptionFontSizeType'].' |
| 701 |
}'; |
| 702 |
$block_content .= '}'; |
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
$block_content .= '</style>'; |
| 707 |
return $block_content; |
| 708 |
} |
| 709 |
} |
| 710 |
|
| 711 |
|