| 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
/*
Template Name: Blog Page Template
*/
get_header();
?>
<?php
while ( have_posts() ) :
the_post();
?>
<?php require_once('template-parts/common-hero-section.php')?>
<section class="blogsSec mypy100">
<div class="maxwidth1150">
<div class="container">
<?php if (is_front_page()) : ?>
<div class="commonTitle">
<h2><?php echo esc_html(get_field('latest_blogs_title', $post_id)); ?></h2>
<img src="<?php echo esc_url(get_field('latest_blog_title_divider', $post_id)); ?>" alt="divider" class="divider">
<p><?php echo esc_html(get_field('latest_blogs_sub_title', $post_id)); ?></p>
</div>
<?php endif; ?>
<?php
// Fetch blog posts
$blogs = get_posts(array(
'post_type' => 'blog',
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC', // Showing the latest posts first
'posts_per_page' => 300
));
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 endwhile; ?>
<?php get_footer(); ?>