Support » Fixing WordPress » Showing select category

  • Resolved dbisbing

    (@dbisbing)


    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • wprelief

    (@wprelief)

    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.

    dbisbing

    (@dbisbing)

    Wonderful,Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Showing select category’ is closed to new replies.