File: /var/www/html/dooblo.cccinfotech.com/wp-content/themes/dooblo/single-category-post.php
<?php
global $post;
get_header();
$category = get_queried_object();
$categoryname = $category->name;
$grid_style = get_field("grid_layout",3249);
$gridstylecol = explode('-',preg_replace('/\s+/', '-', $grid_style));
switch($gridstylecol[0]){
case "2":
$gridstylecolclass = "col-".$gridstylecol[0].'-'.$gridstylecol[1];
$width = "47%";
break;
case "3":
$gridstylecolclass = "col-".$gridstylecol[0].'-'.$gridstylecol[1];
$width = "30%";
break;
case "4":
$gridstylecolclass = "col-".$gridstylecol[0].'-'.$gridstylecol[1];
$width = "22%";
break;
default:
$gridstylecolclass = "col-".$gridstylecol[0].'-'.$gridstylecol[1];
$width = "47%";
}
?>
<style>
article.entry.has-media.<?=$gridstylecolclass?> {
width: <?=$width?>;
}
.blog-feed__back--wrap {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
padding-top: 20px;
}
.blog-feed__back:hover {
text-decoration: underline;
color: rgba(33,36,87,0.8);
}
.blog-feed__back--wrap span, .blog-feed__back--wrap a {
padding: 20px 0 0;
font-size: 16px;
line-height: 15px;
color: rgba(33,36,87,0.8);
font-weight: 300;
}
.blog-feed__back--wrap span:first-of-type {
margin: 0 6px;
}
.post-main.blog-new-main .main-container .elementor-posts-container {
padding-top: 20px;
}
</style>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<div class="post-main blog-new-main">
<section class="section-banner" style="background-image: url( http://dooblo.cccinfotech.com/wp-content/uploads/2021/04/live-webinar-bg.jpg);">
<div class="blog-page-title">
<h1 class="elementor-heading-title elementor-size-default"><?=$categoryname?></h1>
</div>
</section>
<div class="main-container">
<div class="blog-feed__back--wrap">
<a href="/new-blog" class="blog-feed__back">Back to Blog</a>
<span>></span>
<span><?=$categoryname?></span>
</div>
<div class="elementor-posts-container elementor-posts elementor-posts--skin-cards elementor-grid elementor-has-item-ratio" bis_skin_checked="1">
<?php
$paged = ($_REQUEST['page']?$_REQUEST['page'] : 1);
$args = array(
'post_type'=> 'post',
'post_status' => 'publish',
'paged' => $paged,
'category_name' => $categoryname,
'posts_per_page' => 4
);
$result = new WP_Query( $args );
if ( $result-> have_posts() ) :
while ( $result->have_posts() ) : $result->the_post();
$postid = get_the_id();
$post_categories = wp_get_post_categories( get_the_id() );
$cats = array();
foreach($post_categories as $c){
$cat = get_category( $c );
if($cat->name != "Uncategorized"):
$cats[] = array( 'id' => $cat->term_id, 'name' => $cat->name, 'slug' => $cat->slug );
endif;
}
?>
<article class="elementor-post elementor-grid-item post-<?=get_the_ID()?> post type-post status-publish format-standard has-post-thumbnail hentry category-general entry has-media <?=$gridstylecolclass?>">
<div class="elementor-post__card" bis_skin_checked="1">
<a class="elementor-post__thumbnail__link" href="<?=get_the_permalink()?>">
<div class="elementor-post__thumbnail" bis_skin_checked="1"><picture class="attachment-full size-full">
<source type="image/webp" srcset="<?=get_the_post_thumbnail_url( get_the_ID(),'full')?>" sizes="(max-width: 744px) 100vw, 744px">
<img src="<?=get_the_post_thumbnail_url( get_the_ID(),'full')?>" alt="" sizes="(max-width: 744px) 100vw, 744px" class="lazyloaded" data-ll-status="loaded" width="744" height="421">
</picture>
</div>
</a>
<div class="elementor-post__text cst-blog-title" bis_skin_checked="1">
<h3 class="elementor-post__title">
<a href="<?=get_the_permalink()?>">
<?=get_the_title()?> </a>
</h3>
<div class="elementor-post__excerpt" bis_skin_checked="1">
<p><?=get_the_excerpt()?></p>
</div>
<a class="elementor-post__read-more" href="<?=get_the_permalink()?>">
Read More ยป </a>
</div>
<div class="elementor-post__meta-data" bis_skin_checked="1">
<?php if(!empty($cats)): foreach($cats as $key => $val):
$postcathtml[$postid][]='<a href="'.get_category_link($val['id']).'">'.$val['name'].'</a>'; endforeach;
?>
<div class="elementor-post__cat" bis_skin_checked="1">
<?php echo implode(' , ',$postcathtml[$postid]); ?>
</div>
<?php
endif; ?>
<?php
$date_enable = get_field('date_enable',$postid);
?>
<?=((!empty($date_enable[0]) && strtolower($date_enable[0]) == "yes") ?'<span class="elementor-post-date">'.date('F d,Y',strtotime(get_the_date( 'd.m.Y' ))).'</span>':'')?>
</div>
</div>
</article>
<?php endwhile;
?>
</div>
<div class="custompagination"> <?php
pagination_blog( $paged, $result->max_num_pages); echo " <label class='mx-num'> of ".$result->max_num_pages .'</label>';
?> </div><?php
endif;
wp_reset_postdata();
?>
</div>
</div>
</div>
</main>
</div>
<script>
(function($){
$('.custompagination a.page-numbers').each(function(){
let link = $(this).attr('href');
let page = link.split('page');
console.log(page[1]);
$(this).attr('href',page[0]+'?page='+page[1].replace(/[^0-9]/g,''));
});
})(jQuery);
jQuery(".view-btn").click(function(){
jQuery(".releasenote").toggle();
});
</script>
<?php
get_footer();