• 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

subnav dependent on post 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 › Design Tips and Tricks › subnav dependent on post category

This topic is: not resolved

Tagged: category, menu, simple menus, subnav

  • This topic has 2 replies, 2 voices, and was last updated 9 years, 11 months ago by gretchenlouise.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • April 14, 2013 at 3:10 pm #35468
    gretchenlouise
    Member

    I've been using Simple Menus to use a different subnav menu on particular pages and categories. I wish it had an option to automatically set the menu to apply to all posts within specific categories, as well.  Previously, I'd been using Prose, and the code below my functions.php. But now that I'm using Genesis itself, it breaks the styling and makes the menu extremely ugly on any post or category page in my chosen category. Any ideas on what the conflict might be? Thank you!

    <code>// Subnav dependent on category
    remove_action('genesis_after_header', 'genesis_do_subnav');
    add_action('genesis_after_header', 'custom_do_subnav');
    function custom_do_subnav() {
    echo '<div id="subnav"><div>';
    if ( in_category('tech')  && !is_front_page() && !is_home() ) { wp_nav_menu( array('menu' => 'Tech' ));
    }
    else {
    genesis_do_subnav();
    }
    echo '</div></div>';
    }

    </code>

    April 16, 2013 at 2:25 pm #35818
    Brad Dalton
    Participant

    What theme are you using?

    Can you link to your site please.


    Tutorials for StudioPress Themes.

    April 16, 2013 at 3:07 pm #35829
    gretchenlouise
    Member

    Thank you. I just finally got it working (at http://gretchenlouise.com/) by using more specific div classes:

    `echo '<div id="subnav"><div class="wrap"><ul id="menu-tech-2" class="menu genesis-nav-menu menu-secondary superfish sf-js-enabled">';`

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

© 2023 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