displaying custom thumbnails from most recent posts on a static page (3 posts)

  1. patrickowtf
    Posted 3 years ago #

    Hello all, i'm in need of some help.

    i have three posts in my database that have a thumbnail attached. i want to grab that thumbnail and display it as a link on the front page of my site. the posts that i want to appear on the front page are all tagged with the category 'front page'.

    so how do i grab the three most recent posts tagged category to display their thumbnail on my front page?

  2. patrickowtf
    Posted 3 years ago #

    At the top of my main page(the page where i'm trying to display the thumbs) I have

    <?php if (have_posts()) : ?>
                   <?php while (have_posts()) : the_post(); ?>
                       Print to test if loop is function.
                   <?php endwhile; ?>
         <?php endif; ?>

    It's only getting information for ONE post, the one i'm currently on... how do I get it for posts that are in my database with a specific tag?

  3. Michael
    Forum Moderator
    Posted 3 years ago #


    <?php $custom = new WP_Query( array( 'posts_per_page' => 3, 'category_name' => 'front-page' ) );
    <?php if ($custom->have_posts()) : ?>
                   <?php while ($custom->have_posts()) : $custom->the_post(); ?>
                       Print to test if loop is function.
                   <?php endwhile; ?>
         <?php endif; wp_reset_postdata(); ?>


Topic Closed

This topic has been closed to new replies.

About this Topic