• drstir

    (@drstir)


    Does anyone know whether it’s possible to prevent posts from certain categories from appearing on the home page? I want all other posts in other categories to show, but not those in a category that isn’t so relevant. I hope that makes sense! Any help would be much appreciated. Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • asechrest

    (@asechrest)

    Plugin: Advanced Category Excluder.

    Or, hard-code the exclusion in index.php.

    Thread Starter drstir

    (@drstir)

    Thanks for the response.

    I just tried ACE and had a very bizarre result. It reversed the date order of all my posts on the home page – the first (6mths ago) appearing at the top. Deactivate the plug-in and it’s fine. Reactivate and reverse order.

    I tried ACE on a brand new install – using exactly the same theme – and it worked fine. So I’m at a complete loss with it!

    It’s just one category amongst a lot of others want to hide – so I’m not sure how I’d go about hard-coding its exclusion.

    If anyone knows of a more stable version of a category excluder like ACE, please let me know.

    TinaHunter

    (@tinahunter)

    Try the code talked about in this topic:

    http://wordpress.org/support/topic/233668?replies=35

    Might work for you. At least they talk about hard coding an exclusion.

    asechrest

    (@asechrest)

    Strange! There must be a plugin conflict of some sort? I run well over a dozen plugins and ACE works fine for me.

    In your index.php, could you simply wrap your post output (within the Loop) in a conditional statement? For example:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <?php if ( !(in_category('catID')) ) { ?>
    <div>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <?php the_content(); ?>
    </div>
    <?php } ?>
    <?php endwhile; else: ?>

    Replace catID with the category ID you want to exclude. I think this might do the trick.

    Thread Starter drstir

    (@drstir)

    The only other plug in I’m using is a contact form. And switching that off makes no difference. ACE still reverses the date order of all my posts.

    The only difference between the site that works and the one that doesn’t is that I’ve upgraded the WP version of the older site over the last six months. And there’s far more posts, categories and archives.

    I like the way ACE works, so before trying the hard-coding, I just wondered if it’s possible to rebuild the database – to see if that might clear out any glitches. Any suggestions gratefully received.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Preventing certain category posts from showing on home page’ is closed to new replies.