Situation:
I'm working with the wordpress theme "Foundation for Wordpress" by Drew Morris. Link to theme
I've changed the standard structure for the top-bar and implemented the use of wordpress' menus like so:
Goal:
If no menu is assigned I'd like to display the text:
"Please assign a menu (Go to Design -> Menus -> Left/Right menu)"
Problem:
It seems like there is a fallback for that situation already in place.
If no menu is assigned the standard wordpress navigation is chosen. How do I chage that?
Code:
Navigation menus are registered like so:
functions.php
if ( ! function_exists( 'foundation_menus' ) ) :
function foundation_menus() {
register_nav_menus(
array(
'left-menu' => __( 'Left Menu', 'foundation' ),
'header-menu' => __( 'Right Menu', 'foundation' )
)
);
}
add_action( 'init', 'foundation_menus' );
endif;
if ( ! function_exists( 'foundation_page_menu' ) ) :
function foundation_page_menu() {
$args = array(
'sort_column' => 'menu_order, post_title',
'menu_class' => 'large-12 columns',
'include' => '',
'exclude' => '',
'echo' => true,
'show_home' => false,
'link_before' => '',
'link_after' => ''
);
wp_page_menu($args);
}
endif;
Menus are integrated in the theme like so:
header.php
<nav class="top-bar">
<ul class="title-area">
<li class="name"><h1><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo('name'); ?></a></h1></li>
<li class="toggle-topbar menu-icon"><a href="#"><span>Menu</span></a></li>
</ul>
<section class="top-bar-section">
<?php wp_nav_menu( array( 'theme_location' => 'left-menu', 'menu_class' => 'left', 'container' => '', 'fallback_cb' => 'foundation_page_menu', 'walker' => new foundation_navigation() ) ); ?>
</section>
<section class="top-bar-section">
<?php wp_nav_menu( array( 'theme_location' => 'header-menu', 'menu_class' => 'right', 'container' => '', 'fallback_cb' => 'foundation_page_menu', 'walker' => new foundation_navigation() ) ); ?>
</section>
</nav>
Live-site
See it live over here: Link to Live-Site
Closing words
I'm no php professional, so I am grateful for any kind of help I can get. Thank you for your support.
Best wishes from germany. Cheers!