Support » Fixing WordPress » Any way to make some categories invisible?

  • Im searching for a way to deactivate a category in the main blog listing. That means, i have 3 cats, a,b and c and i dont want to view c per default, it should be clickakle on the cat navigation bar, but not viewed on the blog by it self.

    Any ways to archieve that without recode the blog?

Viewing 15 replies - 1 through 15 (of 17 total)
  • wp_list_cats() template tag features an “exclude” parameter so it would look something like this, featuring only the exclude parameter:

    <?php wp_list_cats('exclude=3, 10'); ?>

    Thread Starter Seikilos


    But how could i exclude the posts in the category?
    Example, i make a cat “About me” that includes all users of a blog and their about me info.
    Nice to read but not important for the main Blog list, and im searching a way to exclude them from main listing.
    At the sidebar About me is still klickable and you can see the pages

    Good question…something I’ve been thinking about myself. As well as removing posts from the main blog listing (as Seikilos mentions), I could use such a capability for admin purposes. For instance, I’ve been thinking about creating a “private” category. If I ‘Manage Posts’, I can select by category, but what about searching for those “Private” or “Draft” attributions to posts when you’ve got hundreds of posts to go through? An ‘excluded’ category (including the posts themselves, when you want to remove *published* posts from the main blog list, but not the category itself) would be nifty indeed! (Of course, as I write this, someone’s prolly writing the plugin!)


    Thread Starter Seikilos


    Well, i could fix my problem by writing a plugin or rather a modification, but i hoped someone knew a better way

    Thread Starter Seikilos


    Here am i. I took a minute to modify the things.

    To exclude a cat from being viewed just simply search at the index.php of YOUR THEME the line
    <?php while (have_posts()) : the_post(); ?>
    add below it the line
    <?php if (!in_category(‘NUMBER’) ): ?> <- Number is the number of the excluded cat of your choice.
    Then you should see a <div> Tag, usually with the class=”post”
    The script uses whitespaces to split the different tags, so go a little bit down and at the same height with the <div> you should find the </div> Tag for the same div.
    Add BELOW it the line
    <?php endif; ?>
    and be happy 🙂

    Warning: I modified the trackback and rss feed tags, being precisely i removed them, so proceed with caution, the version above works for me, but be carefull if you place the rss feed below the endif line, an rss feed is generated for the invisible post.

    There is no posibility to make a plugin for it, except rewriting some functions of WP and this is diffucult because all of you want other categories invisible, im sure 🙂

    Hey, thanks Seikilos! That was fast! I’ll try this hack when I get a minute…


    You can also use the Front Page Cats plugin. You tell it what categories you want to show on the main page, then it excludes the others.

    Yes, there are already plugins like Front Page Cats and others that can do exactly this.

    Hacking the loop to just ‘drop’ entries in a category is a really bad approach if you are doing a certain number of posts per page… just fyi. Plugins will wire it up at the query level, which is the way you’d want it done.


    I’ve just created a plugin that creates private categories. Check it out

    A question, Seikilos. Can you exclude more than one category from the frontpage with that? I tried it and it didn’t quite work on the site I need it for…

    The Front Page Cats plugin no longer exists at

    I have found this at the codex:
    but they only exclude one category and if I do something like (2,3) the loop gets broken. I wanted to exclude a page about my Team, I’m already excluding the category FAQ: I call them on separate pages, as it’s not difficult to only call one category, as can be seen here:

    I guess I should add the site I’m talking about, but it’s in German :P, . It’s going to be the school newspaper ^^.

    Addition: Front Page Cats does exist, just not at the place and links I found for it, but if you use this link:
    you’ll find it. For some reason you can’t find it if you browse the normal page for the plugins:

    I’ve installed it now (with WP and it works like a charm for what I want.

    Estara, i went to that page but could only find a file called front_page_cats.php in one of the folders

    i put it in my plugins folder but nothing happened, where did you put it? there doesn’t seem to be any instructions

    ok my mistake, i was saving the link and saving the wp-plugins code also, so i installed it, it appeared in the plugins, acitvated it and worked like a treat, except it gave me some funny errors in the admin side

    i had a load of these above the admin panel

    Warning: Cannot modify header information – headers already sent by (output started at /home/arcadia/public_html/wp-content/plugins/front_page_cats.php:2) in /home/arcadia/public_html/wp-admin/admin.php on line 13

    any ideas?

    That most likely means there are extra spaces or line feeds/newlines in the plugin file. Check that there is nothing before the first <? and nothing after the last ?>

    arrggg, now see i’ve had that before, and you are completely correct, a simple little space after the last ?> was causing the problem, hehe,

    thanyou very much 🙂

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Any way to make some categories invisible?’ is closed to new replies.