Forums
Home / Fixing WordPress / Showing select category
(@dbisbing)
13 years, 9 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.
‘<?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!
(@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.
Wonderful,Thanks!