-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add language
where arg to menus
#25
Comments
It would be a very nice and useful feature |
Menus themselves are not translateable so this feature request is invalid. See this comment: |
Actually, menus could be filtered by the location and the location language. |
Currently I still have to select the language and location parameter. Funnily the language has to be my default language otherwise It will always show me the default PRIMARY location. Is this happening to someone else as well? |
I don't quite follow. Can you provide the query you are using, what results you get and what did you expect getting? But here's some background how the locations work internally in WP and Polylang which might clear things a bit. When you register a menu location named PRIMARY and then enable Polylang and add three languages: EN, EE, FI and set EN as the default language. Polylang will then assume that the PRIMARY is the location for the default language EN. Then it will create additional locations dynamically based on the PRIMARY location for the other languages. Those will be PRIMARY___EE and PRIMARY___FI. This means that when you query menu items without the Example:
is the same as
But if you do
It's just
because EN was the default language. This means with the Btw, may I ask what's you use case for the But there's another discussion to had here too. Should the query without the language defined (ex. And last thing: I consider the |
EDIT I just had some errors in my syntax.
Then again I guess it would be inconsistent on how WP and Polylang work right now. Since it does not query all the menu items from all languages right now?
I guess the only error I can see is that it can break when somebody defines their own menu location namespaces. Like for example MENU_ENG and MENU_EST instead of PRIMARY and PRIMARY___EN. I am not sure how to deal with this since this is an edge case. Thanks a lot for the plugin and a quick response! |
So we could do this
Note! If you want to get menu items in a specific language for a given location you can use
menuItems
which is used most of the time used when building menus for the frontend.The text was updated successfully, but these errors were encountered: