Ready to get started?Download WordPress


[resolved] query posts to display posts from 2 categories (2 posts)

  1. andyhoyland
    Posted 7 years ago #

    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.

  2. andyhoyland
    Posted 7 years ago #

    Sorry - I was being very dim (again) and editing the wrong part of my sidebar.

    Can someone delete this thread for me?!

Topic Closed

This topic has been closed to new replies.

About this Topic