Custom walker/more options for separate language switcher
-
I am trying to add a separate language switcher using
pll_the_languages()
.As far as I can tell it’s not possible to customize things such as classes and title attributes for link text (outside of
pll_flag_title
andpll_the_languages
).Because of this I tried adding a language switcher menu using
register_nav_menus()
and a corresponding language switcher menu in Appearance -> Menus. I associated all translations for the language switcher with this menu and a custom walker specified usingwp_nav_menu()
.The problem with this approach is that WP ignores menus with 0 items (since 3.5) and I can’t seem to find a setting to disable this behavior. That aside it also seems that the language switcher items are not modified by the walker function (classes from the switcher are still added for instance).
Currently I’ve resorted to regex replacing inside
pll_the_languages
, but I find this approach pretty hacky and would like to request either a custom walker or a function where it is possible to get the language items and build the HTML from these.
- The topic ‘Custom walker/more options for separate language switcher’ is closed to new replies.