WordPress.org

Support

Support » Plugins and Hacks » Hacks » Featured Image in The Loop (help a newb!)

Featured Image in The Loop (help a newb!)

  • Hey, I think this is a fairly easy thing to put together, but I’m still learning the ins and outs of coding in WordPress and trying to get my head wrapped around the loop.

    What I’m trying to do is, on my index page, have the loop display a 4×4 grid consisting of SOLELY the last 16 post’s featured image with the post title below it. Eventually, I want to adapt this code to be on pages for each post category.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Without seeing the exact code of your index file, you could modify the loop to only show the featured image and Title.
    Basic example:

    <div class="box">
            <?php the_post_thumbnail(); ?>
            <a href="<?php the_permalink(); ?><?php the_title(); ?></a>
       </div>

    You can then either set under Settings-Reading->Blogs pages show at most 16 posts, or modify the query for just that template to pull 16 posts.

    You can then just CSS to position your boxes to float and grid.

    More about Post Thumbnail Images

    You forgot a quotation.

    If you want the thumbnail to display and have that same thumbnail linked to the post, use this:

    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Featured Image in The Loop (help a newb!)’ is closed to new replies.
Skip to toolbar