Using wp_nav_menu() , how can I append a value at end of each URL?
For example, I have the following url: http://www.example.com/ but I have to append a language parameter at the end, so the url should be: http://www.example.com/?lang=$language
|
|
|
You can either use a whole custom Walker - see codex or just a filter call to In case of filter, your code in theme's functions.php would look like this:
This code is a copy of start_el function of Walker_Nav_Menu class, which you can find in wp-includes/nav-menu-template.php - see it's code. |
|||
|
|
|
I found the solution modifying the behaviour of
This modifies every item in the navigation menu. So if you have an external link, it will be changed as well. Plus, modifying the URL is not as easy as it seems. The URL of an item can be |
|||
|
|
