Sub menus not switching language
-
permalinks settings: postname
static front page : yes, based on template
polylang settings: language set from directory name, hide url for default, remove /language/, detect browser language, synchro – featured image.the main menu is working correctly, switching between languages. the other menus are not switching though I have a total of 10 menu locations and 10 menus created and assigned appropriately – one for each language for the 5 theme locations defined.
Have following code:
// wp menus
add_theme_support( ‘menus’ );// registering wp3+ menus
register_nav_menus(
array(
‘main-nav’ => __( ‘Main Menu’, ‘bonestheme’ ), // main nav in header
‘footer-links’ => __( ‘Footer Menu’, ‘bonestheme’ ), // secondary nav in footer
‘location-sub-nav’ => __( ‘Location Sub Menu’, ‘bonestheme’ ), // tertiary nav
‘retail-sub-nav’ => __( ‘Retail Sub Menu’, ‘bonestheme’ ), // tertiary nav
‘sign-sub-nav’ => __( ‘Sign Sub Menu’, ‘bonestheme’ ) // tertiary nav
)
);********************************
// the main menu
function bones_main_nav() {
// display the wp3 menu if available
wp_nav_menu(array(
‘container’ => false, // remove nav container
‘container_class’ => ‘menu clearfix’, // class of container (should you choose to use it)
‘menu’ => __( ‘Main Menu’, ‘bonestheme’ ), // nav name
‘menu_class’ => ‘nav top-nav clearfix’, // adding custom nav class
‘theme_location’ => ‘main-nav’, // where it’s located in the theme
‘before’ => ”, // before the menu
‘after’ => ”, // after the menu
‘link_before’ => ”, // before each link
‘link_after’ => ”, // after each link
‘depth’ => 0, // limit the depth of the nav
‘fallback_cb’ => ‘bones_main_nav_fallback’ // fallback function
));
} /* end bones main nav */// the footer menu (should you choose to use one)
function bones_footer_links() {
// display the wp3 menu if available
$footer_menu = wp_nav_menu(array(
‘container’ => false, // nav container
‘container_id’=>’footer-boxes’, // footer nav id
‘container_class’ => ‘footer-links clearfix’, // class of container (should you choose to use it)
‘menu’ => __( ‘Footer Menu’, ‘bonestheme’ ), // nav name
‘menu_class’ => ‘nav footer-nav clearfix’, // adding custom nav class
‘theme_location’ => ‘footer-links’, // where it’s located in the theme
‘before’ => ”, // before the menu
‘after’ => ”, // after the menu
‘link_before’ => ”, // before each link
‘link_after’ => ”, // after each link
‘items_wrap’ => ‘<div class=”%2$s”>%3$s</div>’, // item wrap
‘echo’ => false, // display now or not
‘depth’ => 0, // limit the depth of the nav
‘walker’ => new power_walker, // extend walker class
‘fallback_cb’ => ‘bones_footer_links_fallback’ // fallback function
));
echo str_replace( ‘li’, ‘div’, $footer_menu );
} /* end bones footer link */// the location sub menu
function bones_location_nav() {
// display the wp3 menu if available
wp_nav_menu(array(
‘container’ => false, // remove nav container
‘container_class’ => ‘menu clearfix’, // class of container (should you choose to use it)
‘menu’ => __( ‘Location Sub Menu’, ‘bonestheme’ ), // nav name
‘menu_class’ => ‘nav location-sub-nav sub-nav clearfix’, // adding custom nav class
‘theme_location’ => ‘location-sub-nav’, // where it’s located in the theme
‘before’ => ”, // before the menu
‘after’ => ”, // after the menu
‘link_before’ => ”, // before each link
‘link_after’ => ”, // after each link
‘depth’ => 0, // limit the depth of the nav
‘fallback_cb’ => ‘bones_tertiary_nav_fallback’ // fallback function
));
} /* end bones location sub nav */// the retail sub menu
function bones_retail_nav() {
// display the wp3 menu if available
wp_nav_menu(array(
‘container’ => false, // remove nav container
‘container_class’ => ‘menu clearfix’, // class of container (should you choose to use it)
‘menu’ => __( ‘Retail Sub Menu’, ‘bonestheme’ ), // nav name
‘menu_class’ => ‘nav retail-sub-nav sub-nav clearfix’, // adding custom nav class
‘theme_location’ => ‘retail-sub-nav’, // where it’s located in the theme
‘before’ => ”, // before the menu
‘after’ => ”, // after the menu
‘link_before’ => ”, // before each link
‘link_after’ => ”, // after each link
‘depth’ => 0, // limit the depth of the nav
‘fallback_cb’ => ‘bones_tertiary_nav_fallback’ // fallback function
));
} /* end bones retail sub nav */// the sign sub menu
function bones_sign_sub_nav() {
// display the wp3 menu if available
wp_nav_menu(array(
‘container’ => false, // remove nav container
‘container_class’ => ‘menu clearfix’, // class of container (should you choose to use it)
‘menu’ => __( ‘Sign Sub Menu’, ‘bonestheme’ ), // nav name
‘menu_class’ => ‘nav sign-sub-nav sub-nav clearfix’, // adding custom nav class
‘theme_location’ => ‘sign-sub-nav’, // where it’s located in the theme
‘before’ => ”, // before the menu
‘after’ => ”, // after the menu
‘link_before’ => ”, // before each link
‘link_after’ => ”, // after each link
‘depth’ => 0, // limit the depth of the nav
‘fallback_cb’ => ‘bones_tertiary_nav_fallback’ // fallback function
));
} /* end bones sign sub nav */// this is the fallback for header menu
function bones_main_nav_fallback() {
wp_page_menu( array(
‘show_home’ => true,
‘menu_class’ => ‘nav top-nav clearfix’, // adding custom nav class
‘include’ => ”,
‘exclude’ => ”,
‘echo’ => true,
‘link_before’ => ”, // before each link
‘link_after’ => ” // after each link
) );
}
The topic ‘Sub menus not switching language’ is closed to new replies.