• 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

Ambiance Pro – Filter Homepage Posts by Category

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 › General Discussion › Ambiance Pro – Filter Homepage Posts by Category

This topic is: resolved

Tagged: ambiance pro, filter, homepage

  • This topic has 5 replies, 2 voices, and was last updated 11 years, 4 months ago by Brad Dalton.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • August 30, 2014 at 8:29 pm #121960
    Webmaster
    Member

    In the Ambiance Pro theme what's the easiest way to get filtered (by category) output? I need to either limit to two categories or exclude all other categories from being displayed on the homepage. I'm probably spacing it, as it seems as though I have accomplished it in the past in Ambiance Pro, but it eludes me now.


    “If it works, mark the post as [Resolved] so others will feel comfortable trying the solution on their website.“

    August 30, 2014 at 9:22 pm #121964
    Brad Dalton
    Participant

    You can use the Genesis > Theme Settings or PHP code in your functions file using the pre_get_posts filter


    Tutorials for StudioPress Themes.

    August 30, 2014 at 9:39 pm #121972
    Webmaster
    Member

    Thanks Brad. The Genesis, Theme Settings are for blog pages - not the home page. Also I was hoping to avoid editing the theme directly, but maybe that's the only way. Seems like there was another way.


    “If it works, mark the post as [Resolved] so others will feel comfortable trying the solution on their website.“

    August 30, 2014 at 10:02 pm #121978
    Brad Dalton
    Participant

    Depends on which theme you're using and if your blog page is your home page and how you have your site setup that's why i provided 2 solutions.

    That's my 2 solutions, if anyone else wants to provide there's, they are welcome to.


    Tutorials for StudioPress Themes.

    August 30, 2014 at 10:23 pm #121981
    Webmaster
    Member

    Sure, I just went ahead and added this to the functions.php file:

    function mywp_include_cat( $query ) {
    if ( is_home() && is_main_query() ) {
    set_query_var( 'cat', '4' );
    }
    }
    add_action( 'pre_get_posts', 'mywp_include_cat' );

    That works, but I was thinking it was simpler than that where one didn't need access to edit functions.php file (so an end user could change the category IDs). Maybe I did it with the simple hooks plugin or something I can't remember. Oh well, thanks again


    “If it works, mark the post as [Resolved] so others will feel comfortable trying the solution on their website.“

    August 30, 2014 at 10:30 pm #121982
    Brad Dalton
    Participant

    You can if you use the featured posts widget or the blog page template on the home page


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Ambiance Pro – Filter Homepage Posts by Category’ is closed to new 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