Menus & Bootstrap & Navwalker
-
I have (3) Header.php – 1 for Homepage, 2 for Custom Pages with different menus. Each have their own if signed in or sign off buttons. What I’m trying to do is fix the issue where one menu doesn’t become the menu for the other two custom pages. Here is my navwalker code:
And here is my functions.php custom code that I am using…
/* CUSTOM CODING */
/**
* Register Custom Navigation Walker
*/
function register_navwalker(){
require_once get_template_directory() . ‘/class-wp-bootstrap-navwalker.php’;
}
add_action( ‘after_setup_theme’, ‘register_navwalker’ );if ( ! file_exists( get_template_directory() . ‘/class-wp-bootstrap-navwalker.php’ ) ) {
// File does not exist… return an error.
return new WP_Error( ‘class-wp-bootstrap-navwalker-missing’, __( ‘It appears the class-wp-bootstrap-navwalker.php file may be missing.’, ‘wp-bootstrap-navwalker’ ) );
} else {
// File exists… require it.
require_once get_template_directory() . ‘/class-wp-bootstrap-navwalker.php’;
}register_nav_menus( array(
‘primary’ => __( ‘Main-Menu-Logged-Out’, ‘Main Menu Logged Out’ ),
‘secondary’ => __( ‘Main-Menu-Logged-In’, ‘Main Menu Logged In’ ),
‘3’ => __( ‘Store-Menu’, ‘Store Menu’ ),
‘third’ => __( ‘Auction-Menu’, ‘Auction Menu’ ),
‘fourth’ => __( ‘Club-Menu’, ‘Club Menu’ ),
) );function my_wp_nav_menu_args( $args = ” ) {
if( is_user_logged_in() ) {
$args[‘menu’] = ‘Main Logged In’;
} else {$args[‘menu’] = ‘Main Logged Out’;
}
return $args;
}
add_filter( ‘wp_nav_menu_args’, ‘my_wp_nav_menu_args’ );In WordPress: I have 2 (6 in total) menus for 1 header… one signed in and one signed out.
-
Hi there!
I’m afraid that your site is not hosted with WordPress.com. It is a site using the open-source WordPress software (from WordPress.org) but hosted elsewhere.
Because WordPress.com and WordPress.org are two entirely separate entities, we cannot access files or data for sites that are hosted elsewhere, so we can only assist with sites that are hosted on our servers. You can read more about the differences between WordPress.org software and WordPress.com here:
You can look for help at the community forums here: https://wordpress.org/support/forums/
http://wordpress.org/support/ is also a great resource for sites using the open-source WordPress.org software.
- The topic ‘Menus & Bootstrap & Navwalker’ is closed to new replies.