Friday, 11 November 2016

Display posts from a category

How to display posts from a category

If you want to display posts from a single category in your WordPress theme, you should add the following line below the Loop:
<?php query_posts( 'cat=33' ); ?>
Replace 33 with your category ID. This will filter the Look showing only posts from the category you have selected.
If you want to show more than one category, you can add the IDs separated with comas:
<?php query_posts( 'cat=33,44,55,66' ); ?>

No comments :
Write comments