How to add conditional widgets in Multi-language WordPress site
WordPress have made our life a lot easier than we can imagine these days. We create most than 12 kind of different sites with the help of WordPress. We have almost all kind of support in WordPress even we can convert our site into multiple languages with a most favorable plugin called ‘WPML’. Anyways, what we are going to show you today is little tricky. You might wanna know this and it is pretty helpful actually. If you owns a WordPress multi-language website then you might need to add conditional widgets in multi-language WordPress site.
Before you begin to read further about conditional widgets, learn how to display or hide widgets in on posts/pages or custom post types in WordPress. If you are already using WordPress Jetpack plugin you can also display or hide widgets with Jetpack module as well.
Adding conditional widgets in Multi-language WordPress
Restrict Widgets WordPress plugin is one of the greatest plugin and all in one solution for WordPress conditional widgets management. As mentioned previously that you can control widgets on posts/pages and custom post types in WordPress very easily and restrict widgets WordPress plugin aims to accomplish this for you in all perspectives.
Features of Restrict Widgets WordPress plugin:
- Hide or display each widget on selected pages, posts, categories, custom taxonomies, custom post types, single posts, archives, special pages, for logged in or logged out users, current language, mobile device and so on
- Select which user roles are restricted to manage widgets
- Select which sidebars will be restricted to admins only
- Select which widgets will be restricted to admins only
- Select which widget options will be restricted to admins only
- Choose to display or not widget options as groups
- Option to modify the is_active_sidebar() function to use Restrict Widgets display settings
- Multisite compatible
- WPML compatible
- Polylang compatible
- .pot file for translations included
Why would somebody need to display or hide widgets at the very first place? Fair enough, well in order to avoid creating multiple sidebars and duplicating widgets. In my opinion, WordPress should add conditional widget feature in WordPress core framework and we hope to see it near in future of course.
However, by default you are provided with the option Hide widget on selected (enabled) and below that you have to select posts/pages/languages or custom post types, categories/taxonomies on which you don’t want the specific widget to display.
Above settings will restrict that widget not to display on single pages.
How to conditional widgets in Multi-language pages in WordPress
Well, of course you can hide/display widgets on multi language pages in WordPress. See the following screenshot where we are hiding tag cloud widget on Arabic pages.
For your information, if you select nothing then all current widgets will continue to display on all pages.