Support » Themes and Templates » query posts to display posts from 2 categories

  • Resolved andyhoyland

    (@andyhoyland)


    Morning all.

    I am trying to get all the posts from 2 categories to display in a sidebar. I’ve got it working fine for 1 category but I wanted to use 2!

    <?php query_posts('cat=22,23&showposts=20'); ?><ul>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    Is this how I should do it? If I take out the 23 (in bold) then the loop works fine but if I leave it in I just get category 22. No category 23.

    Thanks for any pointers.
    Andy.

Viewing 1 replies (of 1 total)
  • Sorry – I was being very dim (again) and editing the wrong part of my sidebar.

    Can someone delete this thread for me?!

Viewing 1 replies (of 1 total)
  • The topic ‘query posts to display posts from 2 categories’ is closed to new replies.