• houseofboyd

    (@houseofboyd)


    I wanting to exclude a specific category from my Recent Post in the sidebar. I’m using this call to display the 10 most recent posts:

    < ?php get_archives(‘postbypost’, 10); ? >

    But I want to exclude any posts in category 88. Anybody know if there is a way to do this? Any help is appreciated.

    House Of Boyd

Viewing 3 replies - 1 through 3 (of 3 total)
  • boober

    (@boober)

    ive never seen it done that way before. this is the code i use to show my adides
    <?php query_posts('cat=2&showposts=5'); ?>

    so for you it would be
    <?php query_posts('cat=-88&showposts=10'); ?>

    Thread Starter houseofboyd

    (@houseofboyd)

    Thanks for the info Boober, but unfortunately, this yielded no results.

    Thread Starter houseofboyd

    (@houseofboyd)

    Well, I don’t know if this was the easy way or the hard way of doing it, but I got this to work with the following code:

    <li id="Recent">
    	<h2>Recently Written</h2>
    <ul>
    <?php $temp_query = $wp_query; query_posts('showposts=10&cat=-88'); ?>
    <?php while (have_posts()) { the_post(); ?>
    <li><a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to &ldquo;<?php the_title(); ?>&rdquo;"><?php the_title(); ?></a></li>
    <?php } $wp_query = $temp_query; ?>
    </ul>
    </li>
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How To Exclude Category From Recent Posts’ is closed to new replies.