Widget rules is a mechanism which introduces a completely new way of managing website widgets.Now in new version we have hide all features inside one button [Widget Rules]. It occurs in all the widgets available in WordPress. After switching the button on the following options should be displayed under each widget.
This makes it possible to specify such widget features as:
- displaying on selected subpages;
- displaying with a selected widget style (available with the template or custom);
- displaying on selected devices (on all devices, only on Desktop, only on Tablets, only on smartphones, or both Tablets and Smartphones ) ;
- displaying for a selected group of users (all users, only guests, only registered users or only administrator).
The most extended options are those associated with the visibility of a widget on selected subpages. After an option to display a widget on selected pages (or an option to not show a widget on selected pages), a panel similar to the following will appear:
At this point, select the type of page to add (e.g. Category) and then provide the category ID:
After clicking the “Add page” button, a new page will appear on a list of selected pages on which, in our case, a widget will be displayed:
Of course, it is possible to add more pages:
To be clear: each page type is displayed in a different color. An added page added may be removed simply by clicking a “remove” icon placed on the right side of each page.
Using this method, you may set a widget to be displayed on selected pages or, alternately, to be shown on all pages except the ones identified. Generally, however, widgets appear on all pages.
Styles
This rules option is for selecting a widget style. This appends an additional class to the main container of a widget, applying the style specified by the user.
Widget styles are defined in the widget.styles.json file and, in CSS code, in the css/wp.extensions.css file.
We added option to use your own custom CSS class.
This parameter allows you to extend the style for each of your widget. This parameter has no default value. Note that using this parameter you can override/extend the style from theme, just by creating a special styling class, and use it as a value for this parameter. Class selectors are created by typing a dot followed by the class name.
Devices
The option to display a widget on selected devices itself has five options to be set:
- All devices – A widget will be displayed everywhere – on every device.
- Desktop – A widget will be displayed only when neither a tablet.css file nor a mobile.css is loaded.
- Tablets – A widget displays only when a tablet.css file has been loaded and, simultaneously, a mobile.css file will not be loaded.
- Smartphones – A widget will be displayed only when a mobile.css file has been loaded.
- Tablets/Smartphones – A widget will be displayed when at either the tablet.css or the mobile.css file has been loaded.
These settings make it possible to significantly limit the amount of content displayed on devices with small screens.
Users
The option of displaying a widget for a select group of users itself has four options from which to choose:
- All users – A widget will be displayed to all users.
- Only guests – A widget will be displayed to users which are not logged in.
- Only registered users – A widget will only be displayed to logged-in users.
- Only administrator – A widget will be displayed to administrators only.
This option makes it possible to display messages through the use of widget targeting a specific group of users.