| Server IP : 3.111.61.48 / Your IP : 216.73.216.67 Web Server : Apache System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.2.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /var/www/vhost/cosmicindrani.com/wp-content/themes/indrani/ |
Upload File : |
<?php
/**
* The template for displaying all single posts
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since Twenty Nineteen 1.0
*/
get_header();
?>
<section class="blogsDetailSec maxwidth1150 mypy100">
<div class="container">
<div class="row">
<div class="col-md-10 m-auto rightSec">
<div class="card">
<div class="imgBox">
<?php twentynineteen_post_thumbnail(); ?>
</div>
<div class="blgInfo">
<a>
<img src="<?php echo esc_url(get_template_directory_uri() . '/images/man.svg'); ?>" alt="author">
<span>By - <?php
if (have_posts()) :
while (have_posts()) : the_post();
echo esc_html(get_the_author());
endwhile;
endif;
?>
</span>
</a>
<a>
<img src="<?php echo esc_url(get_template_directory_uri() . '/images/calendar.png'); ?>" alt="calendar">
<span><?php echo get_the_date('F j, Y'); ?></span>
</a>
</div>
<div class="card-body">
<h1><?php echo the_title(); ?></h1>
<?php echo the_content(); ?>
</div>
</div>
</div>
</div>
</div>
</section>
<section class="blogsSec mypy100">
<div class="maxwidth1150">
<div class="container">
<div class="commonTitle">
<h2>Recent Blogs</h2>
</div>
<?php
if (is_single()) {
// Exclude the current post from the recent blogs
$current_post_id = get_the_ID(); // Get the current post ID
// Fetch blog posts excluding the current one
$blogs = get_posts(array(
'post_type' => 'blog',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC', // Showing the latest posts first
'posts_per_page' => 6,
'post__not_in' => array($current_post_id), // Exclude the current post
));
if (!empty($blogs)) : // Display blogs only if there are posts
?>
<div class="row">
<?php
foreach ($blogs as $blogsListVal) {
$featuredImage = get_the_post_thumbnail_url($blogsListVal->ID, 'full');
$postDate = get_the_date('F j, Y', $blogsListVal->ID); // Fetching post date
$authorName = get_the_author_meta('display_name', $blogsListVal->post_author); // Fetching author name
$postLink = get_permalink($blogsListVal->ID); // Fetching the post permalink
?>
<div class="col-lg-4 col-md-6">
<div class="card">
<div class="imgBox">
<a href="<?php echo esc_url($postLink); ?>">
<img src="<?php echo esc_url($featuredImage); ?>" class="card-img-top" alt="<?php echo esc_attr(get_the_title($blogsListVal->ID)); ?>">
</a>
<div class="blgDate">
<span><?php echo $postDate; ?></span>
</div>
</div>
<div class="blgInfo">
<a>
<img src="<?php echo esc_url(get_template_directory_uri() . '/images/man.svg'); ?>" alt="author">
<span>By - <?php echo $authorName; ?></span>
</a>
</div>
<div class="card-body">
<h5 class="card-title">
<a href="<?php echo esc_url($postLink); ?>"><?php echo get_the_title($blogsListVal->ID); ?></a>
</h5>
<p class="card-text">
<?php
$content = get_the_excerpt($blogsListVal->ID);
$word_limit = 12;
$trimmed_content = wp_trim_words($content, $word_limit, '...');
echo esc_html($trimmed_content);
?>
</p>
</div>
</div>
</div>
<?php } ?>
</div>
<?php
endif;
}
?>
</div>
</div>
</section>
<?php
get_footer();