• 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

Updating this conditional secondary navigation snippet

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 › Updating this conditional secondary navigation snippet

This topic is: not resolved

Tagged: conditional navigation

  • This topic has 2 replies, 3 voices, and was last updated 12 years, 7 months ago by joyv.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • November 18, 2013 at 8:10 pm #74103
    ameeker
    Member

    http://ahjira.com/create-a-conditional-secondary-menu-for-genesis-child-themes

    The snippet below is from the post above, which details how to use the custom menus to show top-level items in the Primary nav location and their conditional sub-menu items in the Secondary. The article does reference that it's out of date since 2.0. I tried it on a new installation using the Sample Child Theme, and the primary nav disappeared. Wondered if anyone is around who could take a look and see what, if anything, needs to be updated in it for 2.0? Will be brilliant if it works.

    add_filter( 'genesis_do_nav', 'ahjira_nav_args', 10, 3 );
    
    function ahjira_nav_args( $nav_output, $nav, $args ) {
      if( $args['theme_location'] == 'primary' ) {
        $args['depth'] = 1;
      }
      $nav = wp_nav_menu($args);
      $pattern = genesis_markup( '<nav class="primary">%2$s%1$s%3$s</nav>', '<div id="nav">%2$s%1$s%3$s</div>', 0 );
    	$nav_output = sprintf( $pattern, $nav, genesis_structural_wrap( 'nav', 'open', 0 ), genesis_structural_wrap( 'nav', 'close', 0 ) );
      return $nav_output;
    }

    Looking for Genesis website design backed by strategy? http://www.angiemeekerdesigns.com

    November 21, 2013 at 3:46 pm #74784
    cdils
    Participant

    This may not be the fix, but looking at the markup in 2.0, there are some differences.
    Note the class of "nav-primary" on <nav> and the id/classes on the <ul> tag.

    Here's an HTML excerpt from the Genesis demo (http://my.studiopress.com/themes/genesis/#demo-full)

    <nav class="nav-primary" itemtype="http://schema.org/SiteNavigationElement" itemscope="itemscope" role="navigation">
    <div class="wrap">
    <ul id="menu-secondary-navigation" class="menu genesis-nav-menu menu-primary">

    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂

    I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.

    January 8, 2014 at 9:42 pm #84109
    joyv
    Member

    I would also love to know how to make this work if anyone could help.

    ameeker, did you find a solution?

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘General Discussion’ 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