2011-05-17, 01:19:35
crusher88 Wrote:Thanks! This made life easier since I basically want to have different sidebar content on each page.
Is there any way of combining this function with the i18n plugin?
http://get-simple.info/extend/plugin/i18n/69/?
You could of course change the component master function to behave "I18Nily".
Or you can use Chris' way to do it, where you can replace get_component with get_i18n_component.
Or you can do it like this (example for additional language German):
- Install the I18N CustomFields plugin
- Create your sidebar components, e.g. "sidebar1", "sidebar1_de", "sidebar2", "sidebar2_de", ...
- Goto Plugins/Configure I18N Custom Fields and add a field named "sbcomp", text "Sidebar", type "dropdown" and enter an empty line and all possible sidebars below the type, e.g.
Code:
sidebar1
sidebar2
- Edit each page which should have a custom sidebar component and select the corresponding component from the list, then save.
- Include the following code in your template:
Code:
<?php get_i18n_component(return_custom_field('sbcomp') ? return_custom_field('sbcomp') : 'sidebar'); ?>
The advantage to Zegnat's approach is that you can use a component for multiple pages, a disadvantage might be that you have to select the sidebar component per page.