Developers
wpchefgadget |
alanft |
Download Stats
Today | 509 |
Yesterday | 817 |
Last Week | 5,283 |
All Time | 2,030,872 |
This plugin gives every widget an extra control field called "Widget logic" that lets you control the pages that the widget will appear on. The text field lets you use WP's Conditional Tags, or any general PHP code.
PLEASE NOTE The widget logic you introduce is EVAL'd directly. Anyone who has access to edit widget appearance will have the right to add any code, including malicious and possibly destructive functions. There is an optional filter 'widget_logic_eval_override' which you can use to bypass the EVAL with your own code if needed. (See Other Notes).
The configuring and options are in the usual widget admin interface.
Configuration
Aside from logic against your widgets, there are three options added to the foot of the widget admin page (see screenshots).
Use 'wp_reset_query' fix -- Many features of WP, as well as the many themes and plugins out there, can mess with the conditional tags, such that is_home is NOT true on the home page. This can often be fixed with a quick wp_reset_query() statement just before the widgets are called, and this option puts that in for you rather than having to resort to code editing
-
Load logic -- This option allows you to set the point in the page load at which your widget logic if first checked. Pre v.50 it was when the 'wp_head' trigger happened, ie during the creation of the HTML's HEAD block. Many themes didn't call wp_head, which was a problem. From v.50 it happens, by default, as early as possible, which is as soon as the plugin loads. You can now specify these 'late load' points (in chronological order):
- after the theme loads (after_setup_theme trigger)
- when all PHP loaded (wp_loaded trigger)
- after query variables set (parse_query) this is the default
- during page header (wp_head trigger)
You may need to delay the load if your logic depends on functions defined, eg in the theme functions.php file. Conversely you may want the load early so that the widget count is calculated correctly, eg to show an alternative layour or content when a sidebar has no widgets.
Don't cache widget logic results -- From v .58 the widget logic code should only execute once, but that might cause unexpected results with some themes, so this option is here to turn that behaviour off. (The truth/false of the code will be evaluated every time the sidebars_widgets filter is called.
Releases (30 )
Version | Release Date | Change Log |
---|---|---|
5.10.4 | 2019-07-03 |
|
5.10.3 | 2019-07-01 |
|
5.10.2 | 2019-06-26 |
|
5.9.0 | 2017-11-14 | wp_reset_query works better under certain conditions. |
5.8.2 | 2017-06-12 | The code has been adapted to work on the servers with restricted <?= Fixed support for the wp_register_sidebar_widget widgets. Some content was prepared for translation. |
5.8.1 | 2017-05-17 | Fixed the issue of displaying errors under certain conditions. |
5.8.0 | 2017-05-17 | Added full support for WP customizer. In case of a fatal error in logic, the widget will not be displayed. |
5.7.4 | 2017-04-26 | Fixed the "Warning: Attempt to assign property of non-object" bug. https://wordpress.org/support/topic/latest-update-seems-break-my-installation/ |
5.7.3 | 2017-04-25 | Fixed the issue when in some cases the plugin displayed user logic errors in the Widgets section and this didn't allow to save the widgets. https://wordpress.org/support/topic/an-error-has-occurred-please-reload-the-page-and-try-again-3/ Fixed ini_set() related warnings for some rare hosting configurations. https://wordpress.org/support/topic/ini_set-diabled-warning/ |
5.7.2 | 2017-02-09 | Removed conflicts with outdated WP versions. |
5.7.1 | 2017-02-08 | Fixed the settings form not being saved settings under some circumstances. Added a setting to show logic code errors for admins (turned off by default). Fixed the issue with quotes in error messages on some WP installations. |
5.7.0 | 2017-02-06 | Fixed PHP 7 compatibility issue. Fixed a conflict with the latest WPML plugin. A new default load logic point attached to the action 'parse_query'. By default the widget logic is only evaluated once. Translation added: Ukrainian by Roman Sulym |
0.57 | 2015-02-16 | Small fixes to satisfy some define('WP_DEBUG', true) errors |
0.56 | 2013-01-06 | Small fix to the original WP3.5 fix in 0.54 that had the side effect of failing to save logic text on newly added widgets. |
0.55 | 2013-01-06 | Restored a striplashes that vanished in 0.54 causing much grief. Translation: Spanish by Eduardo Larequi http://wordpress.org/support/profile/elarequi |
0.54 | 2012-12-20 | Removed a WP 3.1+ function call, hopefully making it 2.8 compatible again. A little 'trim' of WL code to stop "syntax error, unexpected ')'" errors, which could occur if your WL was just a single space. Thanks to https://twitter.com/chrisjean for pointing this out. Translation support! Thanks to Foe Services Labs http://wordpress.org/support/profile/cfoellmann for the work on this and the German translation files. Added a 'widget_logic_eval_override' filter. This allows advanced users to bypass EVAL with a function of their own. |
0.52 | 2012-05-01 | Two new features: optional delayed loading of logic (see Configuration under Installation), and the ability to save out and reload all your site's widget logic into a config file |
0.51 | 2011-12-28 | One important bug fix (fairly major and fairly stupid of me too) |
0.50 | 2011-12-28 | For the first time since this started on WP 2.3, I've rewritten how the core widget logic function works, so there may be 'bumps ahead'. It now uses the 'sidebars_widgets' filter (as it should have done when that was introduced in WP2.8 by the look of it). The upshot is that is_active_sidebar should behave properly. Widget callbacks only get intercepted if the 'widget_content' filter is activated, and much more briefly. (A widget's 'callback' is rewired within the 'dynamic_sidebar' function just before the widget is called, by the 'dynamic_sidebar_param' filter, and is restored when the callback function is invoked.) |
0.48 | 2011-04-02 | Kill some poor coding practices that throws debug notices - thanks to John James Jacoby. |
0.47 | 2011-02-06 | FINALLY tracked down the elusive 'wp_reset_query' option resetting bug. |
0.46 | 2010-01-12 | Fix to work with new WP2.8 admin ajax. With bonus fixes. |
0.45 | 2009-02-08 | |
0.44 | 2009-01-13 | |
0.43 | 2009-01-06 | |
0.42 | 2008-05-19 | |
0.4 | 2008-04-20 | |
0.31 | 2008-04-03 | |
0.3 | 2008-02-29 | |
0.2 | 2008-02-29 |