Support » Fixing WordPress » Showing select category
6 years, 8 months 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.
$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!
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.