Translated content + nav block
Permalink
Hi,
I'm quite fresh with c5, and I've faced really difficult as for beginner issue.
I want my page be multi language, and I think I've achieved what I want - content is multi language.
Problem I faced is to how to display translated pages in nav block according to language selected.
Currently all pages are displayed in nav block, but what I want is:
I select chinese got only items in chinese
I select german got only items in german
and so on, right now all items are shown, does not matter what language I select I see in nav block every 1 st lvl page.
I'm quite fresh with c5, and I've faced really difficult as for beginner issue.
I want my page be multi language, and I think I've achieved what I want - content is multi language.
Problem I faced is to how to display translated pages in nav block according to language selected.
Currently all pages are displayed in nav block, but what I want is:
I select chinese got only items in chinese
I select german got only items in german
and so on, right now all items are shown, does not matter what language I select I see in nav block every 1 st lvl page.
You've saved my day.
Thank you for help :)
Thank you for help :)
If it solves your problem, then please mark it as best answer so others can get help from it.
Great answer!
My sitemap is identical to yours. I have two languages, and a single-level tree below it of, let's say, 8 pages. However, the result I am looking for is slightly different. I'd like to include the 8 sub-pages from the language in the menu, but also the actual language 'Homepage' (the ones you named 'Norwegian' and 'English'). This would mean I would have 9 menu items.
A dirty solution I could come up with is to create the homepage as a sub-page as well, and then automatically redirect the language page to that homepage.. but that does not seem to be the way it was intended to work.
How do you suggest I go about this?
My sitemap is identical to yours. I have two languages, and a single-level tree below it of, let's say, 8 pages. However, the result I am looking for is slightly different. I'd like to include the 8 sub-pages from the language in the menu, but also the actual language 'Homepage' (the ones you named 'Norwegian' and 'English'). This would mean I would have 9 menu items.
A dirty solution I could come up with is to create the homepage as a sub-page as well, and then automatically redirect the language page to that homepage.. but that does not seem to be the way it was intended to work.
How do you suggest I go about this?
Then in your theme header.php, you can add the below code:
Then add the below code where you want to display your menu.
Note: You may need to change the $locale (ch, gr) as per your requirement. Then you need to add autonav as like the attached image autonav.png settings. Also I'm attaching a sample sitemap for your reference.
Hope this helps.
Rony