• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Hiding selected categories

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Hiding selected categories

This topic is: resolved

Tagged: exclude category, homepage

  • This topic has 6 replies, 2 voices, and was last updated 12 years, 8 months ago by Dorian Speed.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • July 5, 2013 at 1:31 pm #49384
    middayminer
    Member

    Hi, I want to create a couple of categories where I can publish posts on but not have them show up on the homepage, is there a way to set their visibility that way? Googling shows me a plugin for this but it doesn't look very compatible, plus it's not listed on wordpress.org.

    Using the prose theme btw.

    July 5, 2013 at 2:51 pm #49404
    Dorian Speed
    Member

    Which is it that you want to do - exclude posts that are in a particular category from the homepage, or not have the label for that particular category name show up beneath posts that are on the homepage?

    I am going to assume it's the former, in which case you should add the following code to your functions.php file. (Make sure you do this via FTP and make a backup copy of functions.php before you make any changes, because it's possible to encounter the White Screen of Death if you accidentally leave out a semicolon or other small errors when editing PHP.)

    if ( is_home() ) {
    query_posts( 'cat=-3' );
    }

    That would work for the category with the ID of 3. To easily see the ID numbers for categories, posts, etc., you can install a plugin called Reveal IDs that will add a column with the ID numbers.

    You can read more about how to implement this here on the codex.


    Bringing websites Up to Speed
    Firebug will light the way to understanding the secrets of the Internet!

    July 5, 2013 at 4:08 pm #49424
    middayminer
    Member

    Hi Dorian, thanks for replying! 🙂

    Well, I think I have to defer on the file I should be editing, because the codex entry says I have to put the code in index.php

    Problem is, it still doesn't work. I assume the index.php it's referring to is the one directly in the wp-content folder? There's one or two in the theme folders and thereabouts. Either I break the website, or get no change. http://www.foundwonders.com

    pretty much just using`

    
    <?php
    if ( is_home() ) {
    	query_posts( 'cat=-33' );
    }
    ?>

    To confirm, the category is indeed the one called 'pending approval', ID 33. I'm very likely just missing something obvious.

    Oh, and I have seen more than a few white screens since I started making the website, but always have a backup of the file handy. Very thankful that nothing has irreversibly broken yet.

    July 5, 2013 at 4:41 pm #49430
    Dorian Speed
    Member

    Let's see - so, did you try adding it to functions.php? Here's another solution via Bill Erickson, WordPress/Genesis Genius.


    Bringing websites Up to Speed
    Firebug will light the way to understanding the secrets of the Internet!

    July 5, 2013 at 4:43 pm #49431
    Dorian Speed
    Member

    Completely unrelated: if you're using this to filter posts based on a workflow of some sort, I would recommend you check out the superfantastic plugin Edit Flow. It uses custom statuses and lots of other neat features to flag posts that still need approval/components before they're ready for prime time. Here's a nice overview that Suzette Franck did of the plugin and its various features.


    Bringing websites Up to Speed
    Firebug will light the way to understanding the secrets of the Internet!

    July 5, 2013 at 5:02 pm #49436
    middayminer
    Member

    I did try it there just in case, and in custom code at well. No luck.
    This from the comments section of your link does work though!

    function exclude_cat($query) {
    if ( $query->is_home) {
    $query-> set('cat','-33');
    }
    return $query;
    }
    add_filter('pre_get_posts','exclude_cat');

    And indeed I am trying to sort out my workflow and other terrible things that get in the way of making content happen. Thanks for both the help and the tip! 🙂

    July 5, 2013 at 9:53 pm #49474
    Dorian Speed
    Member

    Excellent! Glad you got it working the way you want. Feel free to hit me up for questions about Edit Flow if you do use it. You can mark this thread as resolved if your question was answered.


    Bringing websites Up to Speed
    Firebug will light the way to understanding the secrets of the Internet!

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble