• Resolved Mark Steggles

    (@futurekode)


    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)
  • http://codex.wordpress.org/Template_Tags/query_posts

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

    Thread Starter Mark Steggles

    (@futurekode)

    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:

    query_posts('orderby=title&order=ASC&cat=-ID#');

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

    Thread Starter Mark Steggles

    (@futurekode)

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

    Thread Starter Mark Steggles

    (@futurekode)

    category_name=- doesnt seem to work

    query_posts($query_string.’orderby=title&order=ASC&category_name=-Archive’)

    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.

    Thread Starter Mark Steggles

    (@futurekode)

    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(); ?>

    Thread Starter Mark Steggles

    (@futurekode)

    I used a plugin instead

    Thanks

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