Version Description
= 0.8.1 = (1) Revert to a legacy method for attaching widget control settings in order to make it work with old plugins. (2) Fix the word count context logic.
= 0.8 = Major code rewrite and refactoring to improve plugin performance and usability.
= 0.7.2 = Fix PHP warnings/notices.
= 0.7.1 = Confirm that plugin works with the latest version of WordPress.
= 0.7 = Bug fix: check for active sidebars only after $paged has been set.
= 0.6 = Performance improvements - don't check if sidebar has any widgets on every widget load.
Download this release
Release Info
Developer | jamescollins |
Plugin | Widget Context |
Version | 0.8.2 |
Comparing to | |
See all releases |
Code changes from version 0.8.1 to 0.8.2
- readme.txt +8 -2
- widget-context.php +23 -10
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: kasparsd
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kaspars%40konstruktors%2ecom&item_name=Widget%20Context%20Plugin%20for%20WordPress&no_shipping=1&no_note=1&tax=0¤cy_code=USD&lc=LV&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
Tags: widget, widget context, context, logic, widget logic, cms
|
5 |
Requires at least: 3.0
|
6 |
-
Tested up to: 3.
|
7 |
-
Stable tag: 0.8.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Show or hide widgets on specific posts, pages or sections of your site.
|
@@ -30,6 +30,12 @@ Widget Context allows you to show or hide widgets on certain sections of your si
|
|
30 |
|
31 |
== Changelog ==
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
**0.8.1**
|
34 |
|
35 |
* Revert back to changing callback function in `$wp_registered_widgets` for attaching widget context setting controls.
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=kaspars%40konstruktors%2ecom&item_name=Widget%20Context%20Plugin%20for%20WordPress&no_shipping=1&no_note=1&tax=0¤cy_code=USD&lc=LV&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
Tags: widget, widget context, context, logic, widget logic, cms
|
5 |
Requires at least: 3.0
|
6 |
+
Tested up to: 3.6.1
|
7 |
+
Stable tag: 0.8.2
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Show or hide widgets on specific posts, pages or sections of your site.
|
30 |
|
31 |
== Changelog ==
|
32 |
|
33 |
+
**0.8.2**
|
34 |
+
|
35 |
+
* Improved SSL/HTTPS detection.
|
36 |
+
* Fix: Ensure that is_active_sidebar() & is_dynamic_sidebar() don't return true when there are no widgets displayed on a page.
|
37 |
+
* Two new filters so that other plugins can override widget context display/visibility logic.
|
38 |
+
|
39 |
**0.8.1**
|
40 |
|
41 |
* Revert back to changing callback function in `$wp_registered_widgets` for attaching widget context setting controls.
|
widget-context.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Widget Context
|
4 |
-
Plugin URI: http://wordpress.org/
|
5 |
Description: Display widgets in context.
|
6 |
-
Version: 0.8.
|
7 |
Author: Kaspars Dambis
|
8 |
Author URI: http://konstruktors.com/
|
9 |
|
@@ -40,8 +40,9 @@ class widget_context {
|
|
40 |
add_action( 'init', array( $this, 'load_plugin_settings' ) );
|
41 |
// Amend widget controls with Widget Context controls
|
42 |
add_action( 'sidebar_admin_setup', array( $this, 'attach_widget_context_controls' ) );
|
43 |
-
//
|
44 |
-
|
|
|
45 |
// Add admin menu for config
|
46 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
47 |
// Save widget context settings, when in admin area
|
@@ -92,11 +93,17 @@ class widget_context {
|
|
92 |
}
|
93 |
|
94 |
|
95 |
-
function
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
}
|
101 |
|
102 |
|
@@ -128,7 +135,7 @@ class widget_context {
|
|
128 |
else
|
129 |
$uri = $_SERVER['REQUEST_URI'];
|
130 |
|
131 |
-
return (
|
132 |
? "https://".$_SERVER['SERVER_NAME'].$uri
|
133 |
: "http://".$_SERVER['SERVER_NAME'].$uri;
|
134 |
}
|
@@ -203,6 +210,9 @@ class widget_context {
|
|
203 |
if ( is_search() ) $currently['is_search'] = true;
|
204 |
if ( is_404() ) $currently['is_404'] = true;
|
205 |
if ( is_attachment() ) $currently['is_attachment'] = true;
|
|
|
|
|
|
|
206 |
|
207 |
// Check for selected pages/sections
|
208 |
if ( array_intersect_key( $currently, $vis_settings['location'] ) )
|
@@ -240,6 +250,9 @@ class widget_context {
|
|
240 |
} else {
|
241 |
$do_show = true;
|
242 |
}
|
|
|
|
|
|
|
243 |
|
244 |
return $do_show;
|
245 |
}
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Widget Context
|
4 |
+
Plugin URI: http://wordpress.org/plugins/widget-context/
|
5 |
Description: Display widgets in context.
|
6 |
+
Version: 0.8.2
|
7 |
Author: Kaspars Dambis
|
8 |
Author URI: http://konstruktors.com/
|
9 |
|
40 |
add_action( 'init', array( $this, 'load_plugin_settings' ) );
|
41 |
// Amend widget controls with Widget Context controls
|
42 |
add_action( 'sidebar_admin_setup', array( $this, 'attach_widget_context_controls' ) );
|
43 |
+
// Remove widget from widetized area (sidebar) on front end only
|
44 |
+
if ( !is_admin() )
|
45 |
+
add_filter( 'sidebars_widgets', array( $this, 'maybe_unset_widget' ), 10 );
|
46 |
// Add admin menu for config
|
47 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
48 |
// Save widget context settings, when in admin area
|
93 |
}
|
94 |
|
95 |
|
96 |
+
function maybe_unset_widget( $sidebars_widgets ) {
|
97 |
+
foreach( $sidebars_widgets as $widget_area => $widget_list ) {
|
98 |
+
if ( $widget_area == 'wp_inactive_widgets' || empty( $widget_list ))
|
99 |
+
continue;
|
100 |
+
|
101 |
+
foreach( $widget_list as $pos => $widget_id ) {
|
102 |
+
if ( ! $this->check_widget_visibility( $widget_id ) )
|
103 |
+
unset( $sidebars_widgets[$widget_area][$pos] );
|
104 |
+
}
|
105 |
+
}
|
106 |
+
return $sidebars_widgets;
|
107 |
}
|
108 |
|
109 |
|
135 |
else
|
136 |
$uri = $_SERVER['REQUEST_URI'];
|
137 |
|
138 |
+
return (is_ssl())
|
139 |
? "https://".$_SERVER['SERVER_NAME'].$uri
|
140 |
: "http://".$_SERVER['SERVER_NAME'].$uri;
|
141 |
}
|
210 |
if ( is_search() ) $currently['is_search'] = true;
|
211 |
if ( is_404() ) $currently['is_404'] = true;
|
212 |
if ( is_attachment() ) $currently['is_attachment'] = true;
|
213 |
+
|
214 |
+
// Allow other plugins to override the above checks
|
215 |
+
$currently = apply_filters( 'widget_context_currently', $currently, $widget_id, $vis_settings );
|
216 |
|
217 |
// Check for selected pages/sections
|
218 |
if ( array_intersect_key( $currently, $vis_settings['location'] ) )
|
250 |
} else {
|
251 |
$do_show = true;
|
252 |
}
|
253 |
+
|
254 |
+
// Allow other plugins to override any of the above logic
|
255 |
+
$do_show = apply_filters( 'widget_context_visibility', $do_show, $widget_id, $vis_settings );
|
256 |
|
257 |
return $do_show;
|
258 |
}
|