Support » Fixing WordPress » query posts multiple queries

  • Resolved Mark Steggles


    How do I modify this line to also exclude a category?

    <?php query_posts($query_string.’&orderby=title&order=ASC’); while (have_posts()) : the_post(); ?>

Viewing 8 replies - 1 through 8 (of 8 total)

    to exclude a category you write cat=-3 notice the ‘-‘ before the category ID.

    Im having trouble working that into the same line:

    query_posts($query_string.’&orderby=title&order=ASC’, ‘cat=-Archive’);

    is that correct?

    try using the category ID instead of the name and try this line:


    where ID# is the ID of ‘Archive’. You can look in the admin panel under manage -> categories and find the ID# there.

    Im using wp 2.7 and I cant see id numbers for the categories

    category_name=- doesnt seem to work


    When in the dashboard, edit the categories. When you move your mouse over the existing categories, you’ll see the ID in the URL that is displayed in most browsers’ status area, usually lower left.

    Ah I see the id number now. Still not got a solution. All I want to do is exclude a category from my home page (index.php)

    <?php if (have_posts()) : ?>

    <?php query_posts($query_string.’orderby=title&order=ASC’); while (have_posts()) : the_post(); ?>

    I used a plugin instead


Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘query posts multiple queries’ is closed to new replies.