• 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

Put Metro Primary Menu in Subnav Left Widget Area

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 › Put Metro Primary Menu in Subnav Left Widget Area

This topic is: resolved

Tagged: menu, Metro, nav, subnav, widget area

  • This topic has 3 replies, 2 voices, and was last updated 9 years, 7 months ago by gretchenlouise.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • August 29, 2013 at 6:08 pm #59619
    gretchenlouise
    Member

    I've tried putting a Custom Menu Widget in the Subnav Left Widget Area of the Metro Theme, but it doesn't look a thing like the menu is supposed to. Is there any way to replace the Subnav Left Widget Area with the Primary Menu, so that the Primary Menu is on the left and the Subnav Menu is on the right?

    Thank you!

    http://kindredgrace.com
    August 29, 2013 at 11:57 pm #59652
    Sridhar Katakam
    Participant

    Is there any way to replace the Subnav Left Widget Area with the Primary Menu, so that the Primary Menu is on the left and the Subnav Menu is on the right?

    Yes.

    In functions.php, change

    // Adds widget area before the .menu on #subnav
    add_filter( 'genesis_do_subnav', 'child_do_subnav_widget', 10, 2 );
    function child_do_subnav_widget( $subnav_output, $subnav ){
    	ob_start();
    	genesis_widget_area( 'subnav-left', array(
    		'before' => '<div class="subnav-left widget-area">',
    	) );
    	$widget_area = ob_get_clean();
    
    	return str_replace( $subnav, $widget_area . $subnav, $subnav_output );
    }

    to

    // Adds widget area before the .menu on #subnav
    add_filter( 'genesis_do_subnav', 'child_do_subnav_widget', 10, 2 );
    function child_do_subnav_widget( $subnav_output, $subnav ){
    	ob_start();
    	echo genesis_do_nav();
    	$widget_area = ob_get_clean();
    
    	return str_replace( $subnav, $widget_area . $subnav, $subnav_output );
    }

    and then to remove the Primary navigation below the header, add this:

    remove_action( 'genesis_after_header', 'genesis_do_nav' );

    Screenshot.


    Genesis Tutorials | Follow me on Twitter

    August 30, 2013 at 4:42 pm #59792
    gretchenlouise
    Member

    That worked beautifully! Except that I'd like to have just one line of navigation instead of two. Is there a way to specify the width of each nav bar and have it only be half the width? Thank you!

    August 30, 2013 at 5:00 pm #59794
    gretchenlouise
    Member

    I figured it out. A simple float: left. Thank you so much!

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

© 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