-
AuthorPosts
-
May 26, 2014 at 12:44 pm #48571
Hi, I am using the X integrity theme of wordpress, and i am looking to add a new menu to my header, currently have top bar (social icons showing ) and a category nav.
I need to add a new menu to get my cart/bag showing up?
My theme says supports 2 menus. i want to add i new one?
How do i do this?
my dev site is here: http://dev.carandkitchen.co.uk/
Theme Location Assigned Menu
Primary Menu Categorues menu
Footer Menu top level menuMay 27, 2014 at 12:24 am #48699Hey Ben,
To add an extra Header Menu location, please add the code below in your functions.php.
function register_header_menu() { register_nav_menu('header-menu',__( 'Header Menu' )); } add_action( 'init', 'register_header_menu' );
To output the menu in the template, use the code below.
if ( has_nav_menu( 'header-menu' ) ) : wp_nav_menu( array( 'theme_location' => 'header-menu', 'container' => false, 'menu_class' => 'x-nav sf-menu' ) ); endif;
Hope that helps. 🙂
May 28, 2014 at 4:25 pm #49463That work, added it, just need to style now! – with x theme is there no default bag/cart links?
also if i wanted to add another menu, can i do the same thing again, but change the naming.?
May 28, 2014 at 4:28 pm #49466Wait a minute those links even show in the backend, inside the dashboard…
how do i stop this? when you said to output
output the menu in the template, use the code below.Were was this meant to be placed? – not within the functions.php?
May 29, 2014 at 7:18 am #49785Hey Ben,
X doesn’t come with cart links but you can use the Woocommerce Cart widget in your sidebar.
And yes, you can use the same code. Just replace header-menu with a different name.
The code
if ( has_nav_menu( 'header-menu' ) ) : wp_nav_menu( array( 'theme_location' => 'header-menu', 'container' => false, 'menu_class' => 'x-nav sf-menu' ) ); endif;
must be place on a template file like wp-header.php located in framework/views/(YOUR STACK) not in functions.php.
Hope that helps. 🙂
May 29, 2014 at 1:54 pm #49990Added this to the wp_header.php
<?php if ( has_nav_menu( ‘header-menu’ ) ) :
wp_nav_menu( array(
‘theme_location’ => ‘header-menu’,
‘container’ => false,
‘menu_class’ => ‘x-nav sf-menu’
) );
endif; ?>it didnt work?
my full code here..
<?php
// =============================================================================
// VIEWS/INTEGRITY/WP-HEADER.PHP
// —————————————————————————–
// Header output for Integrity.
// =============================================================================?>
<?php x_get_view( ‘global’, ‘_header’ ); ?>
<!–
BEGIN #top.site
–><div id=”top” class=”site”>
<?php x_get_view( ‘global’, ‘_slider-revolution-above’ ); ?>
<header class=”<?php x_masthead_class(); ?>” role=”banner”>
<?php x_get_view( ‘global’, ‘_topbar’ ); ?>
<?php x_get_view( ‘global’, ‘_navbar’ ); ?>
<?php x_get_view( ‘integrity’, ‘_breadcrumbs’ ); ?><?php if ( has_nav_menu( ‘header-menu’ ) ) :
wp_nav_menu( array(
‘theme_location’ => ‘header-menu’,
‘container’ => false,
‘menu_class’ => ‘x-nav sf-menu’
) );
endif; ?>
swimwear365
</header><?php x_get_view( ‘global’, ‘_slider-revolution-below’ ); ?>
<?php x_get_view( ‘integrity’, ‘_landmark-header’ ); ?>May 29, 2014 at 9:13 pm #50202Hi Ben,
Try it without has_nav_menu() condition.
<?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'container' => false, 'menu_class' => 'x-nav sf-menu' ) ); ?>
And be sure that your file name is wp-header.php and not wp_header.php
Let us know.
-
AuthorPosts