File: /mnt/data/dreamsrent-wp-demo/wp-content/themes/dreamsrent/templates/blog/blog-detail.php
<?php if( is_active_sidebar( 'blog-sidebar' )) {
$blog_type ="col-lg-8";
} else {
$blog_type ="col-lg-12";
}
?>
<?php
if (have_posts())
{
while ( have_posts() )
{
the_post();
$post_id = get_the_ID();
?>
<div class="blog-section blog_details <?php if (get_the_tags()) { ?> <?php } else { ?> not_tags <?php } ?>">
<div class="container">
<div class="row">
<div class="<?php echo esc_attr($blog_type); ?>">
<div class="blogbanner" >
<div class="blogbanner-content">
<?php
$categories_blog = get_the_terms( $post->ID, 'category' );
if (is_array($categories_blog) || is_object($categories_blog))
{
foreach( $categories_blog as $category_blog )
{ ?>
<a href="<?php echo get_term_link($category_blog->slug, 'category'); ?>"><span class="blog-hint"><?php echo esc_html($category_blog->name); ?></span></a>
<?php } } ?>
<h1><?php the_title(); ?></h1>
<ul class="entry-meta meta-item ">
<li>
<div class="post-author">
<div class="post-author-img">
<?php echo (get_avatar( get_the_author_meta('ID'), 32)); ?>
</div>
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>"><span> <?php the_author(); ?> </span></a>
</div>
</li>
<li class="date-icon"><i class="fa-solid fa-calendar-days"></i> <?php echo get_the_date('', $post_id ); ?></li>
<?php
$comments = get_comments_number();
$comment_text ='';
if($comments >1)
{
$comment_count = esc_html(get_comments_number());
$comment_text = esc_html__(' Comments','dreamsrent' );
}
else if ($comments == 0)
{
$comment_count = '';
$comment_text = esc_html__('No Comments','dreamsrent' );
}
else
{
$comment_count = esc_html(get_comments_number());
$comment_text = esc_html__(' Comment' ,'dreamsrent');
}
?>
<li class="date-icon"><i class="fa-solid fa-comments"></i><?php echo esc_html($comment_text);?></li>
</ul>
</div>
</div>
<?php if(has_post_thumbnail()){ ?>
<div class="blog-image">
<a href="<?php the_permalink(); ?>">
<?php
dreamsrent_content_thumbnail('full'); ?>
</a>
</div>
<?php } ?>
<div class="blog-description entry-content">
<?php the_content(); ?>
</div>
<div class="fr-latest-container col-lg-12">
<?php
wp_link_pages( array(
'before' => '<div class="page_with_pagination"><div class="page-links">','after' => '</div></div>','next_or_number' => 'number','link_before' => '<span class="no">','link_after' => '</span>') );
?>
<div class="clearfix"></div>
</div>
<?php if (get_the_tags($post->ID)) { ?>
<div class="share-postsection">
<div class="row">
<div class="col-lg-4">
<div class="sharelink d-flex align-items-center">
<h4 ><?php echo esc_html__('Tags','dreamsrent'); ?></h4>
</div>
</div>
<div class="col-lg-8">
<div class="tag-list">
<ul class="tags">
<?php
foreach(get_the_tags($post->ID) as $tag) {
?>
<li> <a href="<?php echo esc_url(get_term_link($tag->slug, 'post_tag')) ?>" class="tag-cloud-link"><?php echo esc_html($tag->name); ?></a></li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
<?php } ?>
<div class="blogdetails-pagination">
<ul>
<?php $previous = get_previous_post();
$next_post = get_next_post(); ?>
<li>
<?php if($previous!='') { ?>
<a href="<?php echo esc_url(get_the_permalink($previous)) ?>" class="prev-link"><i class="fas fa-regular fa-arrow-left"></i><?php echo esc_html__('Previous Post','dreamsrent'); ?></a>
<a href="<?php echo esc_url(get_the_permalink($previous)) ?>"><h3><?php print_r($previous->post_title); ?></h3> </a>
<?php } ?>
</li>
<li>
<?php if($next_post!='') { ?>
<a href="<?php echo esc_url(get_the_permalink($next_post)) ?>" class="next-link"><?php echo esc_html__('Next Post','dreamsrent'); ?><i class="fas fa-regular fa-arrow-right"></i> </a>
<a href="<?php echo esc_url(get_the_permalink($next_post)) ?>"><h3><?php print_r($next_post->post_title); ?></h3> </a>
<?php } ?>
</li>
</ul>
</div>
<?php comments_template('', true); ?>
</div>
<?php if( is_active_sidebar( 'blog-sidebar' )) { ?>
<div class="col-lg-4 theiaStickySidebar">
<div class="rightsidebar">
<?php get_sidebar();?>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
<?php
}
}
else
{
get_template_part( 'template-parts/blog/content', 'none' );
}