WordPress.org

Ready to get started?Download WordPress

Forums

wp_get_archives and get_archives - exclude category (4 posts)

  1. Stahn
    Member
    Posted 7 years ago #

    I'm having a hell of a time trying to do this.

    Please implement this in the next version, it should'n be that hard to do.

  2. dleigh
    Member
    Posted 7 years ago #

    I 2nd the motion! Same problem!

  3. tsguitar
    Member
    Posted 7 years ago #

    Trying to do what? What is it that you want to do, exactly? If you're trying to list an archive page and exclude categories from that list, you can modify your Loop on that page:
    http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category

    Or use query_posts to do it:
    http://codex.wordpress.org/Template_Tags/query_posts#Excluding_Multiple_Categories

    Or, if that isn't quite it, here's my loop that excludes posts from category 2:
    <?php if (have_posts()) : query_posts($query_string .'&cat=-2'); while (have_posts()) : the_post();

  4. baster
    Member
    Posted 7 years ago #

    I'm now using

    <ul>
    <?php $temp_query = $wp_query; query_posts('showposts=10&cat=-9'); ?><br />
    <?php while (have_posts()) { the_post(); ?>
    <li><a>" rel="bookmark" title="Permanent Link to &ldquo;<?php the_title(); ?>&rdquo;"><?php the_title(); ?></a></li>
    <?php } $wp_query = $temp_query; ?>
    </ul>

    and than 9 excludes the catagory. The only problem I encounter now is that it not only excludes the catagory from my sidebar, but also from the content page... does anyone know why?

    Thanx!

Topic Closed

This topic has been closed to new replies.

About this Topic