WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Showing select category (3 posts)

  1. dbisbing
    Member
    Posted 4 years ago #

    I have a sidebar that I am calling a particular category into and only the most recent 3 posts. Not sure how to modify the code I am working with.

    '<?php
    $recent = new WP_Query();
    $recent -> query('showposts=3');
    while($recent -> have_posts()) : $recent -> the_post();
    ?>'

    I'm am pretty new to this all so any help would be wonderful!

  2. wprelief
    Member
    Posted 4 years ago #

    The code above will only pull the 3 most recent articles. If you want the three most recent from a category, add &cat=x where x is the ID number for the category you want to pull articles from.

  3. dbisbing
    Member
    Posted 4 years ago #

    Wonderful,Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic