<?php
/**
 * Template part for displaying posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
 *
 * @package prime-home-renovation
 */

?>
<div class="maincontent">
    <div class="post-item">
        <?php 				
            // Wrap the thumbnail in an anchor tag linking to the post
            echo '<a href="' . esc_url(get_permalink()) . '">';
        ?>
        <!-- <div class="featured-image">
            
        </div> -->
        <div class="image-container">
            <!-- Featured Image -->
            <!-- </?php 
           if (has_post_thumbnail()) {
            the_post_thumbnail('full'); 
        } else {
            // Fallback image or background color
            echo '<img src="' . get_template_directory_uri() . '/assets/images/no-images.jpg" alt="No Image">';
        }
        ?> -->

            <!-- Text Overlaid on the Image -->
            <!-- <div class="overlay-text">
                
            </div> -->
            <div>
                    <h4 class="post-date">
                        <a href="<?php the_permalink();?>"><?php echo esc_html(get_the_date('F j, Y')); ?></a>
                    </h4>
                </div>
                <div class="meta-para mt-4">

                    <div class="entry-container">
                        <header>
                            <div class="entry-meta d-flex">
                            </div><!-- .entry-meta -->
                            <h2 class="page-title mb-3">
                                <?php
                                $prime_home_renovation_content_limit = 2; 
                                    // Wrap the post title in an anchor tag linking to the post
                                    echo '<a href="' . esc_url(get_permalink()) . '">' . esc_html(wp_trim_words(get_the_title(), $prime_home_renovation_content_limit, '')) . '</a>';
                                ?>
                            </h2>

                        </header>
                        <!-- </?php the_content(); ?> -->
                        <p><?php
                        // Set a word limit, e.g., 40 words
                        $prime_home_renovation_content_limit = 18; 

                        // Get the content and trim it
                        echo wp_kses_post(wp_trim_words(get_the_content(), $prime_home_renovation_content_limit, ''));
            
                         ?></p>

                    </div>
                </div>
        </div>
        <?php
        echo '</a>';
    ?>









    </div>

</div>