Hard code the menu. Yes please?
-
Hey, I got your plugin working, wp_nav_menu() works as it should.
But, suppose a little submenu: home – about us -contact. (there would also be other pages in a main menu with f.e. services – blog – ao )
In this case, I would prefer it to hardcode this submenu, but in such a way that the languages are correct.
So the English home page would have:
<a href="english contact url">english anchor text</a>
in its submenu while the french homepage would have this<a href="french contact url">french anchor text</a>
in its submenu.Is this possible? Why? To relieve a client setting up a new language on his site. (and to avoid mistakes)
I took a quick look at wp_page_menu(); , which actually displays the right language links but doesn’t allow you to select the right pages since you would need to use include or exclude parameters (page ID’s).
It wouldn’t have the be really hard coded. I was thinking in terms of
$defaults = array( 'theme_location' => 'primary', 'menu' => 'submenu', 'echo' => false ); $my_localized_submenu_links = magical_polylang_function( wp_nav_menu( $defaults ) );
A limited version of what I’m asking would be this for the home page:
<a href="<?php echo pll_home_url(); ?>"><?php _e( 'home' , 'my-text-domain'); ?></a>
- The topic ‘Hard code the menu. Yes please?’ is closed to new replies.