Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to place something before title-area
Tagged: title-area split navigation
- This topic has 3 replies, 2 voices, and was last updated 8 years, 12 months ago by cultivardesigns.
-
AuthorPosts
-
May 1, 2015 at 6:21 pm #149767cultivardesignsMember
This is how you can split up your menu navigation so you can place the logo between two navigation menus. Basically, you will need to add this to your functions.php. I tried searching "how to put things above the title-area gensis" and whole other bunch of combinations and couldn't find what I needed, so I had to combine a lot of different solutions together to come up with this. If there is a better way, I would love to know.
//Split Header add_action( 'init', 'register_left_menu' ); function register_left_menu() { register_nav_menu( 'left-menu' ,__( 'Left Navigation Menu' )); } add_action( 'init', 'register_right_menu' ); function register_right_menu() { register_nav_menu( 'right-menu' ,__( 'Right Navigation Menu' )); } function split_genesis_do_header() { wp_nav_menu( array( 'theme_location' => 'left-menu', 'container_class' => 'genesis-left-nav-menu' ) ); genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div id="title-area">', 'context' => 'title-area', ) ); do_action( 'genesis_site_title' ); do_action( 'genesis_site_description' ); echo '</div>'; wp_nav_menu( array( 'theme_location' => 'right-menu', 'container_class' => 'genesis-right-nav-menu' ) ); } remove_action( 'genesis_header', 'genesis_do_header' ); add_action( 'genesis_header', 'split_genesis_do_header' );
Ask us about Custom Genesis WordPress Themes
May 2, 2015 at 8:10 am #149808Brad DaltonParticipantYou could use 2 widgets in the header and populate them with the custom menu widget.
Many other ways to do this also.
May 2, 2015 at 1:24 pm #149846cultivardesignsMemberYeah, widget areas instead of extra menus could be better, but this is just another way of going about it.
I updated the code so that the menus have widget containers above each menu and the logo sits in between.
//Split Header Nav remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_before_header', 'genesis_do_nav' ); // For mobile nav add_action( 'init', 'register_left_menu' ); function register_left_menu() { register_nav_menu( 'left-menu' ,__( 'Left Navigation Menu' )); } add_action( 'init', 'register_right_menu' ); function register_right_menu() { register_nav_menu( 'right-menu' ,__( 'Right Navigation Menu' )); } //Split Header Widgets unregister_sidebar( 'header-right' ); genesis_register_sidebar( array( 'id' => 'widget-top-left', 'name' => __( 'Header Top Left', 'wpcultivar' ), 'description' => __( 'Header Top Left', 'wpcultivar' ), ) ); genesis_register_sidebar( array( 'id' => 'widget-top-right', 'name' => __( 'Header Top Right', 'wpcultivar' ), 'description' => __( 'Header Top Right', 'wpcultivar' ), ) ); //Header Markup function split_genesis_do_header() { echo '<div class="header-top-left">'; genesis_widget_area( 'widget-top-left', array( 'before' => '<div class="widget-top-left">', 'after' => '</div>', ) ); wp_nav_menu( array( 'theme_location' => 'left-menu', 'container_class' => 'genesis-left-nav-menu' ) ); echo '</div>'; genesis_markup( array( 'html5' => '<div %s>', 'xhtml' => '<div id="title-area">', 'context' => 'title-area', ) ); do_action( 'genesis_site_title' ); do_action( 'genesis_site_description' ); echo '</div>'; echo '<div class="header-top-right">'; genesis_widget_area( 'widget-top-right', array( 'before' => '<div class="widget-top-right">', 'after' => '</div>', ) ); wp_nav_menu( array( 'theme_location' => 'right-menu', 'container_class' => 'genesis-right-nav-menu' ) ); echo '</div>'; } remove_action( 'genesis_header', 'genesis_do_header' ); add_action( 'genesis_header', 'split_genesis_do_header' );
Ask us about Custom Genesis WordPress Themes
May 2, 2015 at 1:29 pm #149847cultivardesignsMember -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.