[Resolved] How about a language selector for custom sidebars?
I see you have just about all the bases covered for choosing when and where to place a sidebar, except I do not see any way to set a sidebar depending upon the language being displayed.
There is a great plugin for multi-language websites at http://wpml.org and they actually go out of their way to make it easy for plugin developers to add support.
In this case, you would have 2 functions to use. One function will get a list of all the languages used on the website, and the second function will get the current language being displayed.
Having those 2 functions mean you can easily add in a language selector to the sidebar plugin and then have full support for multilingual websites.
icl_get_languages()is a function that will return an array of the active languages
Array ( [en] => Array ( [id] => 1 [active] => 1 [encode_url] => 0 [native_name] => English [language_code] => en [translated_name] => English [url] => http://siteurl/ [country_flag_url] => http://siteurl/wp-content/plugins/sitepress-multilingual-cms/res/flags/en.png ) [de] => Array ( [id] => 3 [active] => 0 [encode_url] => 0 [native_name] => Deutsch [language_code] => de [translated_name] => German [url] => http://siteurl/de/ [country_flag_url] => http://siteurl/wp-content/plugins/sitepress-multilingual-cms/res/flags/de.png ) [el] => Array ( [id] => 13 [active] => 0 [encode_url] => 0 [native_name] => Ελληνικα [language_code] => el [translated_name] => Greek [url] => http://siteurl/el/ [country_flag_url] => http://siteurl/wp-content/plugins/sitepress-multilingual-cms/res/flags/el.png ) )
We are then able to use if/then statements because of the ability of the function above.
So there you have it, the 2 needed functions to VERY EASILY add in another tab of custom language choices to work perfectly with the wpml plugin.
If you are interested in adding in the support I would love to send a copy of wpml to you and work with you on this project as I kind of need it myself and I am not quite sure where to plug this into your plugin.
- The topic ‘[Resolved] How about a language selector for custom sidebars?’ is closed to new replies.