Conditional Widgets

Plugin Banner

Conditional Widgets

by Jason LeMahieu (MadtownLems)

Download
Description

IMPORTANT: This plugin will NOT function after the Widgets screen overhaul that is part of WordPress 5.8 unless you use the Classic Widgets plugin (https://wordpress.org/plugins/classic-widgets/). The plugin will continue to be supported/maintained for those using Classic Widgets, but there are no plans to make Conditional Widgets work once Widgets are Blocks.

This plugin adds a form to each widget on the Widgets panel which allows users to choose which pages and/or categories the widget is either displayed on or hidden from.

For each widget, you can choose criteria to either SHOW or HIDE the widget, based on a number of categories. The interface is quite intuitive, and requires no knowledge of php or conditional tags.

Standard Installation Procedure

  1. Upload the cets-conditional-widgets folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  1. Each widget gets an expandable form at the bottom of it for controlling display options on the home page and for both pages and categories.

    Each widget gets an expandable form at the bottom of it for controlling display options on the home page and for both pages and categories.

Can I Use it with Custom Post Types or Taxonomies?

Yes and No.

Conditional Widgets can be configured with additional Type/Taxonomy pairs (both native and custom), similar to how it functions with Posts and Categories. However, it does not support additional Custom Post Types the way it does Pages. (If I were going to write it from scratch, I would have definitely included that, but have no plans to add it given that Widgets themselves are on the way to becoming unsupported.)

The following filter is available to take pairs of Post Type and Taxononmy slugs (use in functions.php or a small plugin):

// Add Conditional Widgets support for Success Stories (Post Type) & Story Groups (Taxonomy)
add_filter('conditional_widgets_type_tax_pairs', 'success_story_conditional_widget_type_tax_pairs' );

function success_story_conditional_widget_type_tax_pairs( $pairs_array ) {

    $success_story_pair = array(
        'type'=> 'success-story',
        'tax'=> 'story-group' 
    );

    $pairs_array[] = $success_story_pair;
    return $pairs_array;

}

If you really want to be able to use Conditional Widgets to control Widget display on individual instances of a Custom Post Type (rather than based on a Taxonomy), the workaround would be to create unique Taxonomy terms for those Custom Posts.

simple and working with wp 5.5

By zinkab on August 24, 2020

I have been looking for such a widget for some time, and found it today. It is working with wp 5.5. Thank you for the plugin.

Very useful

By FeliceAntonio (Antonio_09) on April 5, 2019

Very useful plugin, light, easy to use for customizing each category widget, or page too, it works very well. Thanks -:)

Plugin abandoned?

By momo-fr on August 25, 2018

Hi, I see that this plugin is no longer followed by its developer for a long time, to delete?

Doesn't work well with browser extensions

By tommyg73 on October 13, 2017

If you have certain browser extensions (like Grammerly) it will not work. Somehow the enable crashes or delays too long with them.

Does not work with WooCommerce and Support is bad

By worsin on March 9, 2017

Its currently not compatible with WooCommerce and a post that was made a month ago by someone regarding this was completely ignored. Seems the developer doesn't care about compatibility.

Fantastic Functional Plugin

By stellaseaspirit on September 3, 2016

This plugin is simple and very efficient. Delivers exactly what it promises. Thank you so much for creating it!

Good plugin

By 5764764 on September 3, 2016

Works and very useful

Good Plugin

By Manas Mitra (manas666) on September 3, 2016

Good Plugin. Works as described. Five star no doubt.

Works GREAT even on custom widgets!

By Vicky (vickymedrano) on September 3, 2016

Upon installation and activation it adds a very complete menu to the very widget menu. I had some widgets that came with my theme that were actually custom and this plugin manage to add the menu to those as well. It works perfetly well. I love it. I had been looking for this solution for a few days thank god I saw a post recommending it and here I am, happy user!!

3.3

    Updated tested to version, documented support for custom post type and taxonomy support

3.2

  • Tested through version 6.5.5

3.1

  • Added message to readme explaining the future of Conditional widgets after WordPress 5.8

3

  • Improved string translatability (Props @alexclassroom)

2.2

  • New Features: Hide on Desktop / Hide on Mobile. (Note that using either of these options will immediately hide the widget when the condition is true, and any other options to ‘show’ will be ignored.
  • Fixes lots of small bugs related to the display of the widget control form

2.1

  • Major update of code formatting to better align with WordPress style and guidelines – props @cFoellmann
  • Support Conditional Widgets toggle JavaScript on the Customize screen

2.0.5

  • Attempted to resolve the strict warnings
  • IMPORTANT! If updating in a MultiSite/Network environment, you’ll need to visit the dashboard of every site for the plugin to continue to work properly. If you have a large network, consider using my helper plugin: https://github.com/MadtownLems/cets-multisite-dashboard-crawler

2.0.1

  • Major Rewrite: modified how settings are stored.

1.8

  • Added an additional checkbox for ALL pages/categories to, once again, make the UI even easier to understand

1.7

  • Added VERY basic string translation support
  • Tweaked UI surrounding pages/categories to be easier to understand

1.6

  • Only display the informative debugging text when WP_DEBUG_DISPLAY is true
  • More verbose informative debugging text

1.5

  • Fixed a bug surrounding the extra conditional checks on some configurations (Thanks, mmcginnis!)
  • Added debugging and informative statements while WP_DEBUG is enabled

1.4

  • Added support for Posts Pages (when using Static Front Page)

1.3

  • Added support for saving options on Widgets that didn’t otherwise have options

1.2

  • Added option for Tag Archives (by request)

1.1

  • Added options for Search, 404, Date Archives, and Author Archives

1.0.2

  • Small edit to play nicely with some other plugins and their additional processing

1.0.1

  • Basic bug fixes: resolved some warnings and errors. (Sorry for the inconvenience.)

1.0

  • Initial Release
Back to top