| 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 align".$alignclass." ".$attributes['blockHoverEffect']." ".$blockuniqueclass; |
| 144 |
|
| 145 |
if (isset($attributes['className'])) { |
| 146 |
$class .= ' ' . $attributes['className']; |
| 147 |
} |
| 148 |
if($attributes['enableBoxShadow']){ |
| 149 |
$class .= ' bs-has-shadow'; |
| 150 |
} |
| 151 |
$list_layout_class = $attributes['slider']; |
| 152 |
|
| 153 |
|
| 154 |
$hoverNavClass =''; |
| 155 |
if($attributes['enableNavInHover']){ |
| 156 |
$hoverNavClass ='nav-on-hover'; |
| 157 |
} |
| 158 |
|
| 159 |
$animation_class = ''; |
| 160 |
if( $attributes['animation']){ |
| 161 |
$animation_class='blockspare-block-animation'; |
| 162 |
} |
| 163 |
//$list_layout_class = $attributes['design']; |
| 164 |
$listgridClass = 'blockspare-posts-block-is-carousel' . " blockspare-posts-block-carousel-full " . "column-" . $attributes['columns'].' '.$attributes['navigationSize'].' '.$attributes['navigationShape'].' '.$hoverNavClass; |
| 165 |
|
| 166 |
|
| 167 |
/* Layout orientation class */ |
| 168 |
$grid_class = 'blockspare-posts-block-latest-post-carousel-wrap '.' ' . $listgridClass . ' ' . $list_layout_class. ' has-gutter-space-'.$attributes['gutterSpace']." ".$animation_class; |
| 169 |
|
| 170 |
$category_class = 'blockspare-posts-block-post-category'; |
| 171 |
|
| 172 |
if($attributes['categoryLayoutOption'] =='none'){ |
| 173 |
$category_class .= ' has-no-category-style'; |
| 174 |
} |
| 175 |
|
| 176 |
?> |
| 177 |
|
| 178 |
<div class="<?php echo esc_attr($class);?>"> |
| 179 |
<section class="blockspare-posts-block-post-wrap"> |
| 180 |
<div class="<?php echo esc_attr($grid_class);?>" blockspare-animation=<?php echo esc_attr( $attributes['animation'] )?>> |
| 181 |
<div class="latest-post-carousel" data-slick="<?php echo esc_attr($carousel_args_encoded); ?>" |
| 182 |
data-next="<?php echo esc_attr($next);?>" data-prev="<?php echo esc_attr($prevstr);?>"> |
| 183 |
<?php while ($grid_query->have_posts()) { |
| 184 |
$grid_query->the_post(); |
| 185 |
|
| 186 |
/* Setup the post ID */ |
| 187 |
$post_id = get_the_ID(); |
| 188 |
|
| 189 |
/* Setup the featured image ID */ |
| 190 |
$post_thumb_id = get_post_thumbnail_id($post_id); |
| 191 |
|
| 192 |
$has_img_class = ''; |
| 193 |
|
| 194 |
if (!$post_thumb_id) { |
| 195 |
$has_img_class = "post-has-no-image"; |
| 196 |
} |
| 197 |
|
| 198 |
$contentOrderClass =''; |
| 199 |
if($attributes['contentOrder']=='content-order-1'){ |
| 200 |
$contentOrderClass .= 'contentorderone'; |
| 201 |
} |
| 202 |
if( $attributes['contentOrder']=='content-order-2'){ |
| 203 |
$contentOrderClass .= 'contentordertwo'; |
| 204 |
} |
| 205 |
|
| 206 |
|
| 207 |
/* Setup the post classes */ |
| 208 |
$post_classes = 'blockspare-posts-block-post-single blockspare-hover-item '.$contentOrderClass." ".$attributes['contentOrder']; |
| 209 |
|
| 210 |
if($attributes['enableEqualHeight'] == true){ |
| 211 |
$post_classes .=' bs-has-equal-height'; |
| 212 |
} |
| 213 |
|
| 214 |
if($attributes['slider'] == 'blockspare-posts-block-full-layout-6'){ |
| 215 |
$post_classes .=' blockspare-hover-child'; |
| 216 |
} |
| 217 |
|
| 218 |
/* Add sticky class */ |
| 219 |
if (is_sticky($post_id)) { |
| 220 |
$post_classes .= ' sticky'; |
| 221 |
} else { |
| 222 |
$post_classes .= null; |
| 223 |
} |
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
if ($attributes['enableBackgroundColor']) { |
| 228 |
$post_classes .= ' has-background'; |
| 229 |
} |
| 230 |
|
| 231 |
?> |
| 232 |
|
| 233 |
<div id="<?php echo esc_attr($post_id);?>" |
| 234 |
class="<?php echo esc_attr($post_classes).' '.$has_img_class; ?>"> |
| 235 |
<?php |
| 236 |
|
| 237 |
if (!empty($attributes['imageSize'])) { |
| 238 |
$post_thumb_size = $attributes['imageSize']; |
| 239 |
} |
| 240 |
|
| 241 |
?> |
| 242 |
<figure class="blockspare-posts-block-post-img"> |
| 243 |
<a href="<?php echo esc_url(get_permalink($post_id));?>" rel="bookmark" aria-hidden="true" |
| 244 |
tabindex="-1"> |
| 245 |
<?php |
| 246 |
if(has_post_thumbnail($post_id)){ |
| 247 |
echo wp_kses_post(wp_get_attachment_image($post_thumb_id,$post_thumb_size)); |
| 248 |
}else{ ?> |
| 249 |
<div class="bs-no-thumbnail-img"> </div> |
| 250 |
<?php } ?> |
| 251 |
</a> |
| 252 |
<?php |
| 253 |
if ($attributes['displayPostCategory'] ) { ?> |
| 254 |
<div class="<?php echo esc_attr($category_class);?>"> |
| 255 |
<?php |
| 256 |
if($attributes['postType']=='post'){ |
| 257 |
$categories_list = get_the_category_list(' ', '', $post_id); |
| 258 |
if ( $categories_list ) { |
| 259 |
/* translators: 1: list of categories. */ |
| 260 |
printf( esc_html__( '%1$s', 'blockspare' ), $categories_list ); // WPCS: XSS OK. |
| 261 |
} |
| 262 |
} |
| 263 |
if($attributes['postType']!='post'){ |
| 264 |
$terms = get_the_terms($post_id , $attributes['taxType'] ); |
| 265 |
if($terms){ |
| 266 |
foreach($terms as $trem){ ?> |
| 267 |
<a herf= ><?php echo $trem->name; ?></a> |
| 268 |
<?php } |
| 269 |
} |
| 270 |
} ?> |
| 271 |
</div> |
| 272 |
|
| 273 |
<?php } ?> |
| 274 |
</figure> |
| 275 |
|
| 276 |
<div |
| 277 |
class="blockspare-posts-block-post-content hover-child <?php echo esc_attr($attributes['contentOrder']); ?> <?php echo esc_attr($attributes['titleOnHover'])?>"> |
| 278 |
<div class="blockspare-posts-block-bg-overlay"></div> |
| 279 |
<header class="blockspare-posts-block-post-grid-header"> |
| 280 |
<?php |
| 281 |
if ($attributes['displayPostCategory']) { ?> |
| 282 |
<div class="<?php echo esc_attr($category_class);?>"> |
| 283 |
<?php |
| 284 |
if($attributes['postType']=='post'){ |
| 285 |
$categories_list = get_the_category_list(' ', '', $post_id); |
| 286 |
if ( $categories_list ) { |
| 287 |
/* translators: 1: list of categories. */ |
| 288 |
printf( esc_html__( '%1$s', 'blockspare' ), $categories_list ); // WPCS: XSS OK. |
| 289 |
} |
| 290 |
} |
| 291 |
if($attributes['postType']!='post'){ |
| 292 |
$terms = get_the_terms($post_id , $attributes['taxType'] ); |
| 293 |
if($terms){ |
| 294 |
foreach($terms as $trem){ ?> |
| 295 |
<a herf= ><?php echo $trem->name; ?></a> |
| 296 |
<?php } |
| 297 |
} |
| 298 |
} ?> |
| 299 |
</div> |
| 300 |
<?php } |
| 301 |
$title = get_the_title($post_id); |
| 302 |
if (!$title) { |
| 303 |
$title = __('Untitled', 'blockspare'); |
| 304 |
} ?> |
| 305 |
<h4 class="blockspare-posts-block-post-grid-title"> |
| 306 |
<a href="<?php echo esc_url(get_permalink($post_id)); ?>" |
| 307 |
class="blockspare-posts-block-title-link" rel="bookmark"> |
| 308 |
<span><?php echo esc_html($title); ?></span></a> |
| 309 |
</h4> |
| 310 |
|
| 311 |
<?php |
| 312 |
if(isset($attributes['postType']) && (isset($attributes['displayPostAuthor']) || isset($attributes['displayPostDate']))) { ?> |
| 313 |
<div class="blockspare-posts-block-post-grid-byline"> |
| 314 |
<?php |
| 315 |
if (isset($attributes['displayPostAuthor']) && $attributes['displayPostAuthor']) { ?> |
| 316 |
<div class="blockspare-posts-block-post-grid-author"> |
| 317 |
<a class="blockspare-posts-block-text-link" |
| 318 |
href="<?php echo esc_url(get_author_posts_url(get_the_author_meta('ID')));?>" |
| 319 |
itemprop="url" rel="author"> |
| 320 |
<span itemprop="name"><i class="<?php echo esc_attr($attributes['authorIcon']);?>"></i><?php echo esc_html(get_the_author_meta('display_name', get_the_author_meta('ID')));?></span> |
| 321 |
</a> |
| 322 |
</div> |
| 323 |
<?php } |
| 324 |
|
| 325 |
if(isset($attributes['displayPostDate']) && $attributes['displayPostDate']) { ?> |
| 326 |
<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> |
| 327 |
<?php } |
| 328 |
if($attributes['enableComment']){ ?> |
| 329 |
<span class="comment_count"><i class='<?php echo esc_attr($attributes['commentIcon']);?>'></i><?php echo esc_html(get_comments_number($post_id)); ?></span> |
| 330 |
<?php } ?> |
| 331 |
</div> |
| 332 |
|
| 333 |
<?php } ?> |
| 334 |
|
| 335 |
</header> |
| 336 |
|
| 337 |
<?php |
| 338 |
/* Get the excerpt */ |
| 339 |
|
| 340 |
$excerpt = get_post_field( |
| 341 |
'post_excerpt', |
| 342 |
$post_id, |
| 343 |
'display' |
| 344 |
); |
| 345 |
|
| 346 |
if ( empty( $excerpt ) ) { |
| 347 |
$excerpt = preg_replace( |
| 348 |
array( |
| 349 |
'/\<figcaption>.*\<\/figcaption>/', |
| 350 |
'/\[caption.*\[\/caption\]/', |
| 351 |
), |
| 352 |
'', |
| 353 |
get_the_content() |
| 354 |
); |
| 355 |
} |
| 356 |
|
| 357 |
// Trim the excerpt if necessary. |
| 358 |
if ( isset( $attributes['excerptLength'] ) ) { |
| 359 |
$excerpt = wp_trim_words( |
| 360 |
$excerpt, |
| 361 |
$attributes['excerptLength'] |
| 362 |
); |
| 363 |
} |
| 364 |
|
| 365 |
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- This is a WP core filter. |
| 366 |
$excerpt = apply_filters( 'the_excerpt', $excerpt ); |
| 367 |
if ($attributes['displayPostExcerpt'] && $excerpt != null) { ?> |
| 368 |
<div class="blockspare-posts-block-post-grid-excerpt"> |
| 369 |
<?php if (isset($attributes['displayPostExcerpt']) && $attributes['displayPostExcerpt']) { ?> |
| 370 |
<div class="blockspare-posts-block-post-grid-excerpt-content"><?php echo wp_kses_post($excerpt); ?> |
| 371 |
</div> |
| 372 |
<?php } ?> |
| 373 |
|
| 374 |
|
| 375 |
<?php |
| 376 |
|
| 377 |
if (isset($attributes['displayPostLink']) && $attributes['displayPostLink']) { ?> |
| 378 |
<p> |
| 379 |
<a class="blockspare-posts-block-post-grid-more-link blockspare-posts-block-text-link" |
| 380 |
href="<?php echo esc_url(get_permalink($post_id)); ?>" rel="bookmark"> |
| 381 |
<span><?php echo esc_html($attributes['readMoreText']); ?></span></a> |
| 382 |
</p> |
| 383 |
|
| 384 |
<?php } ?> |
| 385 |
</div> |
| 386 |
<?php } ?> |
| 387 |
</div> |
| 388 |
|
| 389 |
</div> |
| 390 |
<?php } ?> |
| 391 |
</div> |
| 392 |
</div> |
| 393 |
</section> |
| 394 |
</div> |
| 395 |
<?php wp_reset_postdata(); |
| 396 |
$data_content = latest_posts_style_control_slider($blockuniqueclass ,$attributes); |
| 397 |
$data_content .= ob_get_clean(); |
| 398 |
return $data_content; |
| 399 |
} |
| 400 |
} |
| 401 |
} |
| 402 |
|
| 403 |
/** |
| 404 |
* Registers the post grid block on server |
| 405 |
*/ |
| 406 |
if(!function_exists('blockspare_slider_register_block_core_latest_posts_list')){ |
| 407 |
function blockspare_slider_register_block_core_latest_posts_list() |
| 408 |
{ |
| 409 |
|
| 410 |
if (!function_exists('register_block_type')) { |
| 411 |
return; |
| 412 |
} |
| 413 |
|
| 414 |
|
| 415 |
ob_start(); |
| 416 |
include BLOCKSPARE_PLUGIN_DIR . 'inc/latest-post-block/posts-slider/block.json'; |
| 417 |
|
| 418 |
$metadata = json_decode(ob_get_clean(), true); |
| 419 |
|
| 420 |
/* Block attributes */ |
| 421 |
register_block_type( |
| 422 |
'blockspare/blockspare-posts-block-slider', |
| 423 |
array( |
| 424 |
'attributes' =>$metadata['attributes'], |
| 425 |
'render_callback' => 'blockspare_slider_render_block_core_latest_posts_list', |
| 426 |
) |
| 427 |
); |
| 428 |
} |
| 429 |
|
| 430 |
add_action('init', 'blockspare_slider_register_block_core_latest_posts_list'); |
| 431 |
} |
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
if(!function_exists('latest_posts_style_control_slider')){ |
| 436 |
function latest_posts_style_control_slider($blockuniqueclass ,$attributes) |
| 437 |
{ |
| 438 |
|
| 439 |
|
| 440 |
$block_content = ''; |
| 441 |
$block_content .= '<style type="text/css">'; |
| 442 |
|
| 443 |
//Navigation |
| 444 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-is-carousel span:before, .blockspare-posts-block-latest-post-carousel-wrap ul li button{ |
| 445 |
color:' . $attributes['navigationColor'] . '; |
| 446 |
}'; |
| 447 |
|
| 448 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-is-carousel .slick-slider .slick-dots > li button{ |
| 449 |
background-color:'. $attributes['navigationColor']. ' |
| 450 |
}'; |
| 451 |
|
| 452 |
if($attributes['navigationShape'] == 'lpc-navigation-1' || $attributes['navigationShape'] == 'lpc-navigation-2'){ |
| 453 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-is-carousel .slick-slider .slick-arrow:after{ |
| 454 |
background-color:'. $attributes['navigationShapeColor']. ' |
| 455 |
}'; |
| 456 |
}elseif($attributes['navigationShape'] == 'lpc-navigation-3' || $attributes['navigationShape'] == 'lpc-navigation-4'){ |
| 457 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-is-carousel .slick-slider .slick-arrow{ |
| 458 |
border-color:'. $attributes['navigationShapeColor']. ' |
| 459 |
}'; |
| 460 |
}else{ |
| 461 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-is-carousel .slick-slider .slick-arrow{ |
| 462 |
border-color:transparent ; |
| 463 |
background-color:transparent |
| 464 |
}'; |
| 465 |
|
| 466 |
} |
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-wrap{ |
| 473 |
margin-top:' . $attributes['marginTop'] . 'px; |
| 474 |
margin-bottom:' . $attributes['marginBottom'] . 'px; |
| 475 |
margin-left:' . $attributes['marginLeft'] . 'px; |
| 476 |
margin-right:' . $attributes['marginRight'] . 'px; |
| 477 |
}'; |
| 478 |
|
| 479 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ |
| 480 |
padding-top:' . $attributes['contentPaddingTop'] . 'px; |
| 481 |
padding-right:' . $attributes['contentPaddingRight'] . 'px; |
| 482 |
padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; |
| 483 |
padding-left:' . $attributes['contentPaddingLeft'] . 'px; |
| 484 |
}'; |
| 485 |
|
| 486 |
|
| 487 |
if($attributes['slider']=='blockspare-posts-block-full-layout-5'){ |
| 488 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single > .blockspare-posts-block-post-grid-excerpt{ |
| 489 |
padding-top:' . $attributes['contentPaddingTop'] . 'px; |
| 490 |
padding-right:' . $attributes['contentPaddingRight'] . 'px; |
| 491 |
padding-bottom:' . $attributes['contentPaddingBottom'] . 'px; |
| 492 |
padding-left:' . $attributes['contentPaddingLeft'] . 'px; |
| 493 |
}'; |
| 494 |
} |
| 495 |
|
| 496 |
if($attributes['slider']=='blockspare-posts-block-full-layout-4'){ |
| 497 |
//Title Hover |
| 498 |
|
| 499 |
if($attributes['titleOnHover']=='lpc-title-hover') { |
| 500 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-title-link:hover span{ |
| 501 |
color: ' . $attributes['tileTitleOnHoverColor'] . '; |
| 502 |
|
| 503 |
}'; |
| 504 |
} |
| 505 |
|
| 506 |
if($attributes['titleOnHover']=='lpc-title-border') { |
| 507 |
$block_content .= ' .' . $blockuniqueclass . ' .lpc-title-border .blockspare-posts-block-post-grid-title .blockspare-posts-block-title-link span:hover{ |
| 508 |
box-shadow: inset 0 -2px 0 0 ' . $attributes['tileTitleOnHoverColor'] . '; |
| 509 |
|
| 510 |
}'; |
| 511 |
} |
| 512 |
|
| 513 |
if ($attributes['categoryLayoutOption'] == 'solid') { |
| 514 |
|
| 515 |
|
| 516 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 517 |
color:' . $attributes['tileCategoryTextColor'] . "!important" . '; |
| 518 |
background-color:' . $attributes['tileCategoryBackgroundColor'] . "!important" . '; |
| 519 |
border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; |
| 520 |
}'; |
| 521 |
|
| 522 |
} else if ($attributes['categoryLayoutOption'] == 'border') { |
| 523 |
|
| 524 |
|
| 525 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 526 |
color:' . $attributes['tileCategoryTextColor'] . "!important" . '; |
| 527 |
background-color:' . "transparent" . '; |
| 528 |
border:' . "1px solid" . $attributes['tileCategoryBorderColor'] . '; |
| 529 |
border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; |
| 530 |
border-width:' . $attributes['categoryBorderWidth'] . "px" . '; |
| 531 |
}'; |
| 532 |
|
| 533 |
} else { |
| 534 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 535 |
color:' . $attributes['tileCategoryTextColor'] . "!important" . '; |
| 536 |
}'; |
| 537 |
} |
| 538 |
} else { |
| 539 |
//Title Hover |
| 540 |
|
| 541 |
if($attributes['titleOnHover']=='lpc-title-hover') { |
| 542 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-title-link:hover span{ |
| 543 |
color: ' . $attributes['titleOnHoverColor'] . '; |
| 544 |
|
| 545 |
}'; |
| 546 |
} |
| 547 |
|
| 548 |
if($attributes['titleOnHover']=='lpc-title-border') { |
| 549 |
$block_content .= ' .' . $blockuniqueclass . ' .lpc-title-border .blockspare-posts-block-post-grid-title .blockspare-posts-block-title-link span:hover{ |
| 550 |
box-shadow: inset 0 -2px 0 0 ' . $attributes['titleOnHoverColor'] . '; |
| 551 |
|
| 552 |
}'; |
| 553 |
} |
| 554 |
|
| 555 |
if ($attributes['categoryLayoutOption'] == 'solid') { |
| 556 |
|
| 557 |
|
| 558 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 559 |
color:' . $attributes['categoryTextColor'] . "!important" . '; |
| 560 |
background-color:' . $attributes['categoryBackgroundColor'] . "!important" . '; |
| 561 |
border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; |
| 562 |
}'; |
| 563 |
|
| 564 |
} else if ($attributes['categoryLayoutOption'] == 'border') { |
| 565 |
|
| 566 |
|
| 567 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 568 |
color:' . $attributes['categoryTextColor'] . "!important" . '; |
| 569 |
background-color:' . "transparent" . '; |
| 570 |
border:' . "1px solid" . $attributes['categoryBorderColor'] . '; |
| 571 |
border-radius:' . $attributes['categoryBorderRadius'] . "px" . '; |
| 572 |
border-width:' . $attributes['categoryBorderWidth'] . "px" . '; |
| 573 |
}'; |
| 574 |
|
| 575 |
} else { |
| 576 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category a{ |
| 577 |
color:' . $attributes['categoryTextColor'] . "!important" . '; |
| 578 |
}'; |
| 579 |
} |
| 580 |
} |
| 581 |
|
| 582 |
|
| 583 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-category{ |
| 584 |
margin-top:' . $attributes['categoryMarginTop'] . 'px' . '; |
| 585 |
margin-bottom:' . $attributes['categoryMarginBottom'] . 'px' . '; |
| 586 |
margin-left:' . $attributes['categoryMarginLeft'] . 'px' . '; |
| 587 |
margin-right:' . $attributes['categoryMarginRight'] . 'px' . '; |
| 588 |
}'; |
| 589 |
|
| 590 |
|
| 591 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-byline{ |
| 592 |
|
| 593 |
margin-top:' . $attributes['metaMarginTop'] . 'px' . '; |
| 594 |
margin-bottom:' . $attributes['metaMarginBottom'] . 'px' . '; |
| 595 |
margin-left:' . $attributes['metaMarginLeft'] . 'px' . '; |
| 596 |
margin-right:' . $attributes['metaMarginRight'] . 'px' . '; |
| 597 |
}'; |
| 598 |
|
| 599 |
|
| 600 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link{ |
| 601 |
margin-top:' . $attributes['moreLinkMarginTop'] . 'px' . '; |
| 602 |
margin-bottom:' . $attributes['moreLinkMarginBottom'] . 'px' . '; |
| 603 |
margin-left:' . $attributes['moreLinkMarginLeft'] . 'px' . '; |
| 604 |
margin-right:' . $attributes['moreLinkMarginRight'] . 'px' . '; |
| 605 |
}'; |
| 606 |
|
| 607 |
|
| 608 |
if($attributes['slider']==='blockspare-posts-block-full-layout-6' ) { |
| 609 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single .blockspare-posts-block-post-content{ |
| 610 |
background-color:' . $attributes['backGroundColor'] . '; |
| 611 |
|
| 612 |
}'; |
| 613 |
|
| 614 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 615 |
color: ' . $attributes['postTitleColor'] . '; |
| 616 |
|
| 617 |
}'; |
| 618 |
|
| 619 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ |
| 620 |
color:' . $attributes['linkColor'] . '; |
| 621 |
}'; |
| 622 |
|
| 623 |
|
| 624 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ |
| 625 |
color:' . $attributes['linkColor'] . '; |
| 626 |
}'; |
| 627 |
|
| 628 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ |
| 629 |
color:' . $attributes['generalColor'] . '; |
| 630 |
}'; |
| 631 |
|
| 632 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content, '.' .' . $blockuniqueclass . ' .comment_count{ |
| 633 |
color:' . $attributes['generalColor'] . '; |
| 634 |
|
| 635 |
}'; |
| 636 |
}else if($attributes['slider']==='blockspare-posts-block-full-layout-4'){ |
| 637 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 638 |
color: ' . $attributes['fullPostTitleColor'] . '; |
| 639 |
|
| 640 |
}'; |
| 641 |
|
| 642 |
|
| 643 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ |
| 644 |
color:' . $attributes['fullPostLinkColor'] . '; |
| 645 |
}'; |
| 646 |
|
| 647 |
|
| 648 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ |
| 649 |
color:' . $attributes['fullPostLinkColor'] . '; |
| 650 |
}'; |
| 651 |
|
| 652 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ |
| 653 |
color:' . $attributes['fullPostGeneralColor'] . '; |
| 654 |
}'; |
| 655 |
|
| 656 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content, '.' .' . $blockuniqueclass . ' .comment_count{ |
| 657 |
color:' . $attributes['fullPostGeneralColor'] . '; |
| 658 |
|
| 659 |
}'; |
| 660 |
|
| 661 |
}else{ |
| 662 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ |
| 663 |
background-color:' . $attributes['backGroundColor'] . '; |
| 664 |
|
| 665 |
}'; |
| 666 |
|
| 667 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 668 |
color: ' . $attributes['postTitleColor'] . '; |
| 669 |
|
| 670 |
}'; |
| 671 |
|
| 672 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-author a span{ |
| 673 |
color:' . $attributes['linkColor'] . '; |
| 674 |
}'; |
| 675 |
|
| 676 |
|
| 677 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-more-link span{ |
| 678 |
color:' . $attributes['linkColor'] . '; |
| 679 |
}'; |
| 680 |
|
| 681 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-date{ |
| 682 |
color:' . $attributes['generalColor'] . '; |
| 683 |
}'; |
| 684 |
|
| 685 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content, '.' .' . $blockuniqueclass . ' .comment_count{ |
| 686 |
color:' . $attributes['generalColor'] . '; |
| 687 |
|
| 688 |
}'; |
| 689 |
} |
| 690 |
|
| 691 |
|
| 692 |
|
| 693 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title{ |
| 694 |
margin-top:' . $attributes['titleMarginTop'] . 'px' . '; |
| 695 |
margin-bottom:' . $attributes['titleMarginBottom'] . 'px' . '; |
| 696 |
margin-left:' . $attributes['titleMarginLeft'] . 'px' . '; |
| 697 |
margin-right:' . $attributes['titleMarginRight'] . 'px' . '; |
| 698 |
}'; |
| 699 |
|
| 700 |
|
| 701 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-excerpt-content{ |
| 702 |
margin-top:' . $attributes['exceprtMarginTop'] . 'px' . '; |
| 703 |
margin-bottom:' . $attributes['exceprtMarginBottom'] . 'px' . '; |
| 704 |
margin-left:' . $attributes['exceprtMarginLeft'] . 'px' . '; |
| 705 |
margin-right:' . $attributes['exceprtMarginRight'] . 'px' . '; |
| 706 |
}'; |
| 707 |
|
| 708 |
|
| 709 |
if($attributes['slider']!='blockspare-posts-block-full-layout-6') { |
| 710 |
if ($attributes['enableBoxShadow']) { |
| 711 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ |
| 712 |
box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; |
| 713 |
border-radius:' . $attributes['borderRadius'] . 'px' . '; |
| 714 |
}'; |
| 715 |
} |
| 716 |
|
| 717 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-single{ |
| 718 |
border-radius:' . $attributes['borderRadius'] . 'px' . '; |
| 719 |
}'; |
| 720 |
|
| 721 |
}else{ |
| 722 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content{ |
| 723 |
box-shadow: ' . $attributes['xOffset'] . 'px ' . $attributes['yOffset'] . 'px ' . $attributes['blur'] . 'px ' . $attributes['spread'] . 'px ' . $attributes['shadowColor'] . '; |
| 724 |
border-radius:' . $attributes['borderRadius'] . 'px' . '; |
| 725 |
}'; |
| 726 |
} |
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
//Font Settings |
| 733 |
|
| 734 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 735 |
|
| 736 |
font-size: ' . $attributes['postTitleFontSize'] . $attributes['titleFontSizeType'] . '; |
| 737 |
'.bscheckFontfamily($attributes['titleFontFamily']).'; |
| 738 |
'.bscheckFontfamilyWeight($attributes['titleFontWeight']).'; |
| 739 |
line-height: ' . $attributes['lineHeight'] . '; |
| 740 |
}'; |
| 741 |
|
| 742 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ |
| 743 |
font-size:' . $attributes['descriptionFontSize'] . $attributes['descriptionFontSizeType'] . '; |
| 744 |
'.bscheckFontfamily($attributes['descriptionFontFamily']).'; |
| 745 |
'.bscheckFontfamilyWeight($attributes['descriptionFontWeight']).'; |
| 746 |
|
| 747 |
}'; |
| 748 |
|
| 749 |
$block_content .= '@media (max-width: 1025px) { '; |
| 750 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 751 |
font-size: ' . $attributes['titleFontSizeTablet'] . $attributes['titleFontSizeType'] . '; |
| 752 |
}'; |
| 753 |
$block_content .= ' .' . $blockuniqueclass .' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ |
| 754 |
font-size:' . $attributes['descriptionFontSizeTablet'].$attributes['descriptionFontSizeType'].' |
| 755 |
}'; |
| 756 |
$block_content .= '}'; |
| 757 |
|
| 758 |
|
| 759 |
$block_content .= '@media (max-width: 767px) { '; |
| 760 |
$block_content .= ' .' . $blockuniqueclass . ' .blockspare-posts-block-post-grid-title a span{ |
| 761 |
font-size: ' . $attributes['titleFontSizeMobile'] . $attributes['titleFontSizeType'] . '; |
| 762 |
}'; |
| 763 |
$block_content .= ' .' . $blockuniqueclass .' .blockspare-posts-block-post-content .blockspare-posts-block-post-grid-excerpt .blockspare-posts-block-post-grid-excerpt-content{ |
| 764 |
font-size:' . $attributes['descriptionFontSizeMobile'].$attributes['descriptionFontSizeType'].' |
| 765 |
}'; |
| 766 |
$block_content .= '}'; |
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
$block_content .= '</style>'; |
| 771 |
return $block_content; |
| 772 |
} |
| 773 |
} |
| 774 |
|
| 775 |
|