• 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

Exclude Category from Homepage Not Working!

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 › Exclude Category from Homepage Not Working!

This topic is: not resolved

Tagged: css, Daily Dish, exclude category

  • This topic has 7 replies, 4 voices, and was last updated 10 years, 7 months ago by inkmuser.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • March 2, 2015 at 5:56 pm #142948
    nuena
    Member

    Hey everyone, I'm using the Daily Dish theme and I'm trying to exclude a category from the homepage. I used this code, which was sent to me by someone at Studiopress, but it is not working (I pasted it into the functions.php file and changed the number to the appropriate category id)

    Any idea why this isn't working? I really don't want any of the "income reports" category to appear on the homepage but this code does not seem to be working... the website is http://www.fryhole.com

    add_action( 'pre_get_posts', 'exclude_category_posts' );
    /**
    * @author Brad Dalton - WP Sites
    * @example http://wpsites.net/web-design/exclude-category-posts-page/
    */
    function exclude_category_posts( $query ) {
    if( $query->is_main_query() && $query->is_home() ) {
    $query->set( 'cat', '-263' );
        }
    }
    http://www.fryhole.com
    March 2, 2015 at 7:12 pm #142958
    Christoph
    Member

    If you are using a static page as homepage try using is_front_page instead of is_home.

    http://www.wpexplorer.com/wordpress-homepage-conditional/


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 2, 2015 at 7:18 pm #142959
    nuena
    Member

    Thanks for the reply. The theme is set up as "show posts" and each section is its own widget. I really didn't do anything to this theme besides change some CSS, so functionally it should work, I don't understand why this doesn't isn't working!

    I tried both is_home and is_front_page and neither of them work. Agh!

    March 2, 2015 at 7:43 pm #142962
    Christoph
    Member

    Ok. I think I didn´t understand you right.
    Let´s try again 🙂
    You don´t want the income reports to show up in the recent post widget in the sidebar?


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 2, 2015 at 8:00 pm #142965
    Christoph
    Member

    If you want to exclude the category in the featured widget on the bottom, you can install the Genesis Sandbox Featured Content Widget Plugin and exclude the category by entering the id number of the category in the field "Exclude Terms by ID ".


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    March 2, 2015 at 11:11 pm #142975
    nuena
    Member

    HI Christoph,

    Thanks so much for suggesting the Genesis Sandbox Featured Content Widget plugin... I downloaded it and it works! Yay! Didn't know that plugin existed, so helpful!! THANK YOU!

    Kira

    March 3, 2015 at 2:52 am #143004
    Brad Dalton
    Participant

    @nuena @christoph

    The code won't work for the blog page template and pre_get_posts won't work using the is_front_page() conditional tag.

    If you're using the default reading settings and your frontage displays posts, it will work but not when using a front-page.php file or when using a static page as your posts page in your reading settings.

    You can use the Genesis > Theme Settings > Blog Page Template > Exclude the following Category IDs: to exclude category I,D's from your blog page template


    Tutorials for StudioPress Themes.

    August 8, 2015 at 1:40 pm #161795
    inkmuser
    Member

    The exclude category doesn't work for me...the cat I want hidden still shows!

    Using "latest posts" front page settings, Focus Pro theme.

    Anyone have an idea why this isn't working?

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 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