-
AuthorPosts
-
August 24, 2020 at 2:06 pm #1240366
Hey guys,
I have a problem with switching the default sidebar. For my customer, I had to implement 2 languages (German: native, English: 2nd language). Now, by using the plugin “Polylang”, the url-strukture got extended in case of switching to english: “tld/en/…”
At this point, I want to take the /en/ peace of the url, to give an indicator to load my custom sidebar (Sidebar English) – by default: Sidebar Pages.
I hopefully found the right file, to make this changes: sidebar.php (Theme Editor)At the position…
// general pages sidebars if ($avia_config['currently_viewing'] == 'page' && dynamic_sidebar('Sidebar Pages') ) : $default_sidebar = false; endif;
… I can change the sidebar manually.
Do you have any ideas, to get a solution for my problem?
Background: I want to import content by WP All Import to create single porfolio pages by using prepared import template. There is no chance to trigger an action to load the english sidebar in case of Language: English. That means, I have to change the sidebar for english content manually, for each portfolio page… too much work – to much portfolio pages.
I have no plan with PHP, only HTML, CSS.
Thank you very much in advance for assistance.
Best,
SebastianAugust 30, 2020 at 5:20 am #1241877Hey paralyzer86,
Sorry for the late reply, while I was setting up my localhost with Polylang to research your issue I found that Polylang adds language logic to the widgets.
So my thought is, instead of trying to change the sidebar for the language, how about using the Polylang feature to change which widgets show for each language.
This way you should be able to import with the default sidebars set and then after set the widgets based on your languages.Otherwise I believe you can add another line below the one you posted that would check the page language and change the default to true, like this:
if ($avia_config['currently_viewing'] == 'page' && (pll_current_language() == 'en_US') ) : $default_sidebar = true; endif;
I believe this is what you were trying to do, but I didn’t test this, I think setting the widgets is a better solution.Best regards,
Mike -
AuthorPosts
- You must be logged in to reply to this topic.