stemillar
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Changing primary nav on certain pages?Thanks again for the reply.
I’ve tried the above code but unfortunately had no success, however when changed to:
<nav id="navigation" class="col-full" role="navigation"> <?php $exclude_pages = ('shop'); if (has_nav_menu( 'shop-menu' ) && !is_page($exclude_page_id)) { wp_nav_menu( array( 'depth' => 6, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fr', 'theme_location' => 'shop-menu' ) ); } elseif(has_nav_menu( 'primary-menu' ) && is_page($exclude_page_id)) { wp_nav_menu( array( 'depth' => 6, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fr', 'theme_location' => 'primary-menu' ) ); } else { ?> <ul id="main-nav" class="nav fl"> <?php if ( is_page() ) $highlight = 'page_item'; else $highlight = 'page_item current_page_item'; ?> <li class="<?php echo $highlight; ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Home', 'woothemes' ); ?></a></li> <?php wp_list_pages( 'sort_column=menu_order&depth=6&title_li=&exclude=' ); ?> </ul><!-- /#nav --> <?php } ?> </nav><!-- /#navigation -->
I get success, basically what I done was slip the order of the ‘primary-menu’ and the ‘shop-menu’ and altered the first part to read:
$exclude_pages = ('shop');
this now gives me the desired effect but is there a way of adding additional pages to the exclude argument for example the My Account page or Checkout page?
I was guessing that it would simply be:
$exclude_pages = ('shop', my-account');
but can’t seem to get it to work?
Thanks again for your help.
Forum: Fixing WordPress
In reply to: Changing primary nav on certain pages?Thanks for the reply dude,
So just to double check, in functions.php I have:
/*-----------------------------------------------------------------------------------*/ /* Register WP Menus */ /*-----------------------------------------------------------------------------------*/ if ( function_exists( 'wp_nav_menu') ) { add_theme_support( 'nav-menus' ); register_nav_menus( array( 'primary-menu' => __( 'Primary Menu', 'woothemes' ) ) ); register_nav_menus( array( 'top-menu' => __( 'Top Menu', 'woothemes' ) ) ); register_nav_menus( array( 'shop-menu' => __( 'Shop Menu', 'woothemes' ) ) ); }
and in the header.php file I have:
<nav id="navigation" class="col-full" role="navigation"> <?php if ( function_exists( 'has_nav_menu' ) && has_nav_menu( 'primary-menu' ) ) { wp_nav_menu( array( 'depth' => 6, 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fr', 'theme_location' => 'primary-menu' ) ); } else { ?> <ul id="main-nav" class="nav fl"> <?php if ( is_page() ) $highlight = 'page_item'; else $highlight = 'page_item current_page_item'; ?> <li class="<?php echo $highlight; ?>"><a href="<?php echo esc_url( home_url( '/' ) ); ?>"><?php _e( 'Home', 'woothemes' ); ?></a></li> <?php wp_list_pages( 'sort_column=menu_order&depth=6&title_li=&exclude=' ); ?> </ul><!-- /#nav --> <?php } ?>
I probably didn’t explain very well above but what I’m looking for is to have the primary navigation appear and all but one of the pages – the other page, where I’m looking to have the shop-menu appear instead.
Its starting to hurt my head!