WordPress.org

Ready to get started?Download WordPress

Forums

Featured Image in The Loop (help a newb!) (3 posts)

  1. amphibious
    Member
    Posted 2 years ago #

    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 4x4 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

  2. Michael Bishop

    Posted 2 years ago #

    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

  3. hockeyhero4
    Member
    Posted 1 year ago #

    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>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.