WordPress.org

Support

Support » Themes and Templates » displaying custom thumbnails from most recent posts on a static page

displaying custom thumbnails from most recent posts on a static page

  • 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?

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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?

    Moderator Michael

    @alchymyth

    Forum Moderator

    example:

    <?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.
                  the_post_thumbnail();
                   <?php endwhile; ?>
         <?php endif; wp_reset_postdata(); ?>

    http://codex.wordpress.org/Class_Reference/WP_Query

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘displaying custom thumbnails from most recent posts on a static page’ is closed to new replies.