iPascalCase
11/4/2017 - 10:23 AM

display wordpress recent post

place the below code in any page that you wanna show the recent (latest) posts

<ul>
    // Define our WP Query Parameters
    <?php $the_query = new WP_Query( 'posts_per_page=3' ); ?>

    // Start our WP Query
    <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

        // Display the Post Title with Hyperlink
        <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>

        // Display the Post Excerpt
        <li><?php the_excerpt(); ?></li>

        // Repeat the process and reset once it hits the limit
        <?php
    endwhile;
    wp_reset_postdata();
    ?>
</ul>