For advance users who want to display recent posts from a specific category, we have this article specially for you. Beginner users will most likely not use this. This tutorial is mostly used in creating magazine style themes.
02 | $catquery = new WP_Query( 'cat=3&posts_per_page=10' ); |
03 | while ( $catquery ->have_posts()) : $catquery ->the_post(); |
06 | <li><h3><a href= "<?php the_permalink() ?>" rel= "bookmark" ><?php the_title(); ?></a></h3> |
08 | <ul><li><?php the_content(); ?></li> |
At the top where it says showpost= change the number to how many posts you want to display, and cat=3 is the id of the category, so change the ID of the category to pick which category will you be displaying.
The news style format where it displays recent news from each category is accomplished using the code above.