Put Metro Primary Menu in Subnav Left Widget Area

Community Forums Forums General Discussion Put Metro Primary Menu in Subnav Left Widget Area

This topic is: resolved

This topic contains 3 replies, has 2 voices, and was last updated by  gretchenlouise 10 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #59619

    gretchenlouise
    Participant
    Post count: 9

    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
    #59652

    Sridhar Katakam
    Participant
    Post count: 923

    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.


    #59792

    gretchenlouise
    Participant
    Post count: 9

    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!

    #59794

    gretchenlouise
    Participant
    Post count: 9

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

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.