WooSidebars - Version 1.4.0

Version Description

WordPress 3.8 compatibility. Adds "posts tagged with" condition.

Download this release

Release Info

Developer mattyza
Plugin Icon wp plugin WooSidebars
Version 1.4.0
Comparing to
See all releases

Code changes from version 1.3.1 to 1.4.0

CONTRIBUTING.md CHANGED
File without changes
assets/css/admin-posts.css CHANGED
File without changes
assets/css/admin.css CHANGED
File without changes
assets/images/icon-settings.png CHANGED
File without changes
assets/images/success-off.png CHANGED
File without changes
assets/images/success.png CHANGED
File without changes
assets/js/admin.js CHANGED
File without changes
changelog.txt CHANGED
@@ -1,5 +1,9 @@
1
  *** WooSidebars Changelog ***
2
 
 
 
 
 
3
  2013.08.13 - version 1.3.1
4
  * /classes/class-woo-conditions.php - Re-introduce add_post_meta() instead of update_post_meta() when saving conditions. Using update_post_meta() prevents multiple conditions from being saved.
5
 
@@ -35,4 +39,4 @@
35
  * woosidebars.php - Load WooCommerce integration, if WooCommerce is active.
36
 
37
  2012.04.11 - version 1.0.0
38
- * Initial release. Woo!
1
  *** WooSidebars Changelog ***
2
 
3
+ 2015.02.17 - version 1.4.0
4
+ * New - Adds a condition to change the widget area for all posts tagged with a selected tag.
5
+ /classes/class-woo-conditions.php
6
+
7
  2013.08.13 - version 1.3.1
8
  * /classes/class-woo-conditions.php - Re-introduce add_post_meta() instead of update_post_meta() when saving conditions. Using update_post_meta() prevents multiple conditions from being saved.
9
 
39
  * woosidebars.php - Load WooCommerce integration, if WooCommerce is active.
40
 
41
  2012.04.11 - version 1.0.0
42
+ * Initial release. Woo!
classes/class-woo-conditions.php CHANGED
@@ -282,6 +282,9 @@ class Woo_Conditions {
282
  if ( $k == 'category' ) {
283
  $conditions['taxonomy-' . $k]['in-term-' . $j->term_id] = array( 'label' => sprintf( __( 'All posts in "%s"', 'woosidebars' ), esc_html( $j->name ) ), 'description' => sprintf( __( 'All posts in the %s %s archive', 'woosidebars' ), esc_html( $j->name ), strtolower( $taxonomy->labels->name ) ) );
284
  }
 
 
 
285
  }
286
  }
287
 
@@ -377,14 +380,25 @@ class Woo_Conditions {
377
  $this->conditions[] = 'post-type-' . get_post_type();
378
  $this->conditions[] = get_post_type();
379
 
 
380
  $categories = get_the_category( get_the_ID() );
381
 
382
- if ( ! is_wp_error( $categories ) && ( count( $categories ) > 0 ) ) {
383
  foreach ( $categories as $k => $v ) {
384
  $this->conditions[] = 'in-term-' . $v->term_id;
385
  }
386
  }
387
 
 
 
 
 
 
 
 
 
 
 
388
  $this->conditions[] = 'post' . '-' . get_the_ID();
389
  }
390
 
@@ -448,7 +462,13 @@ class Woo_Conditions {
448
  */
449
  public function is_post_type_archive () {
450
  if ( is_post_type_archive() ) {
451
- $this->conditions[] = 'post-type-archive-' . get_post_type();
 
 
 
 
 
 
452
  }
453
  } // End is_post_type_archive()
454
 
282
  if ( $k == 'category' ) {
283
  $conditions['taxonomy-' . $k]['in-term-' . $j->term_id] = array( 'label' => sprintf( __( 'All posts in "%s"', 'woosidebars' ), esc_html( $j->name ) ), 'description' => sprintf( __( 'All posts in the %s %s archive', 'woosidebars' ), esc_html( $j->name ), strtolower( $taxonomy->labels->name ) ) );
284
  }
285
+ if ( $k == 'post_tag' ) {
286
+ $conditions['taxonomy-' . $k]['has-term-' . $j->term_id] = array( 'label' => sprintf( __( 'All posts tagged "%s"', 'woosidebars' ), esc_html( $j->name ) ), 'description' => sprintf( __( 'All posts tagged %s', 'woosidebars' ), esc_html( $j->name ) ) );
287
+ }
288
  }
289
  }
290
 
380
  $this->conditions[] = 'post-type-' . get_post_type();
381
  $this->conditions[] = get_post_type();
382
 
383
+ // In Category conditions.
384
  $categories = get_the_category( get_the_ID() );
385
 
386
+ if ( ! is_wp_error( $categories ) && ( 0 < count( $categories ) ) ) {
387
  foreach ( $categories as $k => $v ) {
388
  $this->conditions[] = 'in-term-' . $v->term_id;
389
  }
390
  }
391
 
392
+ // Has Tag conditions.
393
+ $tags = get_the_tags( get_the_ID() );
394
+
395
+ if ( ! is_wp_error( $tags ) && ( 0 < count( $tags ) ) ) {
396
+ foreach ( $tags as $k => $v ) {
397
+ $this->conditions[] = 'has-term-' . $v->term_id;
398
+ }
399
+ }
400
+
401
+ // Post-specific condition.
402
  $this->conditions[] = 'post' . '-' . get_the_ID();
403
  }
404
 
462
  */
463
  public function is_post_type_archive () {
464
  if ( is_post_type_archive() ) {
465
+
466
+ $post_type = get_query_var( 'post_type' );
467
+ if ( is_array( $post_type ) ){
468
+ $post_type = reset( $post_type );
469
+ }
470
+
471
+ $this->conditions[] = 'post-type-archive-' . $post_type;
472
  }
473
  } // End is_post_type_archive()
474
 
classes/class-woo-sidebars.php CHANGED
File without changes
index.php CHANGED
File without changes
integrations/integration-woocommerce.php CHANGED
File without changes
lang/woosidebars-en_GB.po CHANGED
File without changes
lang/woosidebars-xx_XX.pot CHANGED
File without changes
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: woothemes, mattyza
3
  Tags: widgets, sidebars, widget-areas
4
  Requires at least: 3.3
5
- Tested up to: 3.6.0
6
- Stable tag: 1.3.1
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -71,6 +71,10 @@ Looking to contribute code to this plugin? [Fork the repository over at GitHub](
71
 
72
  == Upgrade Notice ==
73
 
 
 
 
 
74
  = 1.3.1 =
75
  Bug fix to ensure multiple conditions save correctly.
76
 
@@ -88,6 +92,12 @@ Moved to WordPress.org. Woo! Added scope to methods and properties where missing
88
 
89
  == Changelog ==
90
 
 
 
 
 
 
 
91
  = 1.3.1 =
92
  * 2013-08-13
93
  * Bug fix to ensure multiple conditions save correctly.
2
  Contributors: woothemes, mattyza
3
  Tags: widgets, sidebars, widget-areas
4
  Requires at least: 3.3
5
+ Tested up to: 3.8.0
6
+ Stable tag: 1.4.0
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
71
 
72
  == Upgrade Notice ==
73
 
74
+ = 1.4.0 =
75
+ WordPress 3.8 compatibility.
76
+ Adds "posts tagged with" condition.
77
+
78
  = 1.3.1 =
79
  Bug fix to ensure multiple conditions save correctly.
80
 
92
 
93
  == Changelog ==
94
 
95
+ = 1.4.0 =
96
+ * 2015-02-17
97
+ * WordPress 3.8 compatibility.
98
+ * Adds "posts tagged with" condition.
99
+
100
+
101
  = 1.3.1 =
102
  * 2013-08-13
103
  * Bug fix to ensure multiple conditions save correctly.
woosidebars.php CHANGED
@@ -5,8 +5,8 @@
5
  * Description: Replace widget areas in your theme for specific pages, archives and other sections of WordPress.
6
  * Author: WooThemes
7
  * Author URI: http://woothemes.com/
8
- * Version: 1.3.1
9
- * Stable tag: 1.3.1
10
  * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
  */
12
 
@@ -22,6 +22,6 @@
22
 
23
  global $woosidebars;
24
  $woosidebars = new Woo_Sidebars( __FILE__ );
25
- $woosidebars->version = '1.3.1';
26
  $woosidebars->init();
27
  ?>
5
  * Description: Replace widget areas in your theme for specific pages, archives and other sections of WordPress.
6
  * Author: WooThemes
7
  * Author URI: http://woothemes.com/
8
+ * Version: 1.4.0
9
+ * Stable tag: 1.4.0
10
  * License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
  */
12
 
22
 
23
  global $woosidebars;
24
  $woosidebars = new Woo_Sidebars( __FILE__ );
25
+ $woosidebars->version = '1.4.0';
26
  $woosidebars->init();
27
  ?>