Show thumbnails w/links to posts in a specific category (5 posts)

  1. slammedgraphics
    Posted 5 years ago #

    Hi. I need some help on a subject I've been researching for quite a while today and I haven't quite found the help I need for this specific attribute.

    Here's what I'm trying to do:

    I have a section at the top of the page where I'd like to display four thumbnails that link to posts in a specific category, like a featured categories section but without a jquery sliding function, just four thumbnail images that will link to their respective posts that are from a category that will be called featured.

    How can I accomplish this? I've tried several methods rather unsuccessfully. Any help would be greatly appreciated. :)

    Thank you.

  2. Michael
    Part-Time Forum Moderator
    Posted 5 years ago #

    check these functions in the codex:





    i could also help if you can describe the unsuccessful attempts

  3. slammedgraphics
    Posted 5 years ago #

    I tried something similar to what is described here.


    Obviously for my application it would not be going in the footer. It will be inside a divider labeled featuredarea

    It seemed like I was on the right track but now I"m just lost. I'll check out the above links. If you have any input/ideas feel free to let me know. Thanks so much.

  4. Michael
    Part-Time Forum Moderator
    Posted 5 years ago #

    the other thread had a few typos (my mistake)- this should work:

    $header_thumbs = get_posts('category_name=Featured&posts_per_page=4');
    if( $header_thumbs ) :
      foreach( $header_thumbs as $header_thumb ) {
      echo '<a href="' . get_permalink($header_thumb->ID) . '">' . get_the_post_thumbnail($header_thumb->ID) . '</a>';

    make sure the spelling (capital letters and so) of your category name (instead of Featured) is right.

  5. allthewhile
    Posted 5 years ago #


    Thanks for your support on this issue.

    I'm trying to do almost exactly what slammed is doing. When I insert your code into my theme it returns full sized images and not thumbnails. Any help with this would be appreciated.


Topic Closed

This topic has been closed to new replies.

About this Topic