Display posts from selected categories in a page
I have a few categories which i named Media Releases, In The News and Events. I want to display all posts (the post links) from these categories in a page.
Currently this is what i’m doing:
<?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts("showposts=5&paged=$page&cat=14&cat=3&cat=9"); while ( have_posts() ) : the_post(); $loopcounter++; ?>
If you notice, i use
cat=14&cat=3&cat=9to display post links from the 3 categories i mentioned earlier. The numbers are the category numbers.
I thought i have succeed to do it because at the first place, i only post content to the category number 9 (cat=9). Just now i write a content which fall under the cat=14 and cat=3. Unfortunately, the page still showing contents from cat=9 only. I try to change the sequence to
cat=9&cat=3&cat=14and now the page is only showing post under cat=14. So i can say that it only show the last category.
Can anyone help me to display the other 2 categories?
- The topic ‘Display posts from selected categories in a page’ is closed to new replies.