=== Ethan's New Display Widgets ===
Contributors: ethanjhulbert
Tags: widgets, widget visibility, block widgets, sidebar, conditional
Requires at least: 5.9
Tested up to: 6.6
Requires PHP: 7.2
Stable tag: 1.1.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Show or hide any widget -- classic or block -- by page, category, taxonomy, post type, role, login state, or date.

== Description ==

Sidebars rarely need the same widgets on every page. This plugin adds a "Display Rules" panel to each widget, letting you decide exactly where it shows up, without duplicating sidebars or writing conditional template code.

It works with both widget systems WordPress currently ships: the classic Widgets screen, and the block-based widgets editor (Widgets screen block view and the Customizer). Whichever one your theme and setup use, the same rules apply.

= Target by page, category, taxonomy, and post type =
Check the front page, blog page, archives, author archives, search results, 404, individual pages, individual posts, categories, tags, custom taxonomies, or custom post type archives -- in any combination.

= Show or hide =
Every rule can work either way: hide the widget on the pages you check, or show it only on the pages you check.

= Role and login-state targeting =
Restrict a widget to logged-out visitors, logged-in visitors, or specific user roles.

= Date-range scheduling =
Give a widget a start date, an end date, or both, for seasonal or event-driven sidebar content that turns itself off automatically. The date range works independently of Hide/Show on checked pages -- outside the range, the widget is hidden everywhere; inside it, your page rules apply as usual.

= Built for both widget systems =
Classic widgets get a lazy-loaded checklist panel that only fetches its full page/category list when you actually open it, so it stays fast even on large sites. Block widgets get the same rules through the block Inspector Controls panel, available on any block placed in a widget area.

= Small conveniences =
A live filter field for long page or category lists, select-all/select-none per section, and a "Restricted" badge so you can tell which widgets have rules applied without opening each one.

= Optional WooCommerce targets =
If WooCommerce is active, the Shop, Cart, Checkout, and My Account pages appear as additional targets automatically.

== Where to find it ==

Classic Widgets screen: open any widget and use the "Display Rules" panel at the bottom of its settings.

Block widgets editor (Appearance > Widgets, or Customizer > Widgets): select any block inside a widget area and open the "Display Rules" panel in the block's Inspector Controls (right-hand sidebar).

== Good to know ==

This plugin was written from scratch, but the idea of adding show/hide checkboxes to individual widgets isn't new -- an older plugin called Display Widgets, originally by Stephanie Wells, did the same thing for years before it changed ownership in 2017 and had malicious code added to later versions. That old plugin is long gone from the WordPress.org repository and shouldn't be trusted in any form. This one shares nothing with it but the basic concept and is built and maintained independently.

WPML language targeting is supported automatically if WPML is active, matching the languages you have configured.

Full source, no build step, no tracking, no external requests beyond what WordPress itself does.

== Installation ==

1. Upload the `ethans-new-display-widgets` folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins menu.
3. Open any widget's settings (classic or block) and use the Display Rules panel.

== Frequently Asked Questions ==

= Does this work with the classic Widgets screen and the new block-based one? =

Yes, both, at the same time if your site has a mix of widget types.

= Will this slow down my site? =

The visibility check happens once per widget on each page load and doesn't add any queries beyond what WordPress already runs for the page itself. Page/category/taxonomy lists are cached for a week and refreshed automatically when content changes.

= Does this store anything outside my widget settings? =

No. Rules live inside the widget's own saved data (classic widget options, or the block's own attributes), the same way WordPress stores everything else about a widget.

== Changelog ==

= 1.1.0 =
Added Posts, Tags, and Author Archive as their own targets, alongside the existing Pages and Categories. Added a note explaining how the date range interacts with Hide/Show on checked pages. Added an expand/collapse indicator next to Display Rules, and a divider under the additional IDs field for a cleaner handoff to the widget's own settings.

= 1.0.1 =
Fixed the "Restricted" badge showing on every widget regardless of whether it actually had a rule applied. CSS was overriding the native hidden attribute that controls it.

= 1.0.0 =
Initial release.
