I have managed to switch the primiary navigation menu of my subsites to show the main site primary navigation.
However, it renders above the site-header instead of in the menu location dictated in the code.
Here is the code I currently have:
function wp_multisite_nav_menu() {
global $blog_id;
}
if ( ! is_multisite() || 2 == $blog_id ) {
switch_to_blog( 1 );
wp_nav_menu( array(
'menu' => 2,
'fallback_cb' => false,
'menu_class' => 'genesis-nav-menu',
'theme_location' => 'Primary Navigation Menu',
));
restore_current_blog();
}
I was expecting the menu to be placed in the 'Primary Navigation Menu' location.
What have I missed?
Any clarity is appreciated.
UPDATE
I managed to figure it out for my primary and secondary menus however how do get the site title to change to the main site title and hyperlink?
Here is the code I currently have minus the site title switch
//*Multisite global menus
//*Primary global menu
add_action('genesis_after_header', 'primary_menu_switch');
function primary_menu_switch() {
global $blog_id;
if ( ! is_multisite() || 2 == $blog_id ) {
switch_to_blog( 1 );
wp_nav_menu( array(
'menu' => 2,
'fallback_cb' => false,
'menu_class' => 'genesis-nav-menu',
'theme_location' => 'primary'
) );
restore_current_blog();
}
}
//*Secondary global menu
add_action('genesis_header_right', 'secondary_menu_switch');
function secondary_menu_switch() {
global $blog_id;
if ( ! is_multisite() || 2 == $blog_id ) {
switch_to_blog( 1 );
wp_nav_menu( array(
'menu' => 17,
'fallback_cb' => false,
'menu_class' => 'genesis-nav-menu menu-primary responsive-menu',
'theme_location' => 'primary'
));
restore_current_blog();
}
}
//*Use main site title
function site_title_switch() {
global $blog_id;
if ( ! is_multisite() || 2 == $blog_id ) {
switch_to_blog( 1 );
restore_current_blog();
}
}
I am a complete novice so please excuse the hack job.
Your insights are appreciated.
This is an answer to the updated question, not the one in the title.
This should do the trick, if you put it in a network activated plugin. Read the comments to see what it does exactly. It might not work depending on how your theme is made. I made it for the Twenty Eleven theme.
Keep in mind that it will change the home URL everywhere where it is called with a path '/', not only in the header.