Skip to content

Commit

Permalink
Merge pull request #35 from woothemes/release-1-4-0
Browse files Browse the repository at this point in the history
Release 1 4 0
mattyza committed Feb 17, 2015
2 parents f4bfb11 + 7fe02bb commit 4bbc775
Showing 4 changed files with 42 additions and 8 deletions.
6 changes: 5 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
*** WooSidebars Changelog ***

2015.02.17 - version 1.4.0
* New - Adds a condition to change the widget area for all posts tagged with a selected tag.
/classes/class-woo-conditions.php

2013.08.13 - version 1.3.1
* /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.

@@ -35,4 +39,4 @@
* woosidebars.php - Load WooCommerce integration, if WooCommerce is active.

2012.04.11 - version 1.0.0
* Initial release. Woo!
* Initial release. Woo!
24 changes: 22 additions & 2 deletions classes/class-woo-conditions.php
Original file line number Diff line number Diff line change
@@ -282,6 +282,9 @@ public function setup_default_conditions_reference () {
if ( $k == 'category' ) {
$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 ) ) );
}
if ( $k == 'post_tag' ) {
$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 ) ) );
}
}
}

@@ -377,14 +380,25 @@ function is_hierarchy () {
$this->conditions[] = 'post-type-' . get_post_type();
$this->conditions[] = get_post_type();

// In Category conditions.
$categories = get_the_category( get_the_ID() );

if ( ! is_wp_error( $categories ) && ( count( $categories ) > 0 ) ) {
if ( ! is_wp_error( $categories ) && ( 0 < count( $categories ) ) ) {
foreach ( $categories as $k => $v ) {
$this->conditions[] = 'in-term-' . $v->term_id;
}
}

// Has Tag conditions.
$tags = get_the_tags( get_the_ID() );

if ( ! is_wp_error( $tags ) && ( 0 < count( $tags ) ) ) {
foreach ( $tags as $k => $v ) {
$this->conditions[] = 'has-term-' . $v->term_id;
}
}

// Post-specific condition.
$this->conditions[] = 'post' . '-' . get_the_ID();
}

@@ -448,7 +462,13 @@ public function is_taxonomy () {
*/
public function is_post_type_archive () {
if ( is_post_type_archive() ) {
$this->conditions[] = 'post-type-archive-' . get_post_type();

$post_type = get_query_var( 'post_type' );
if ( is_array( $post_type ) ){
$post_type = reset( $post_type );
}

$this->conditions[] = 'post-type-archive-' . $post_type;
}
} // End is_post_type_archive()

14 changes: 12 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -2,8 +2,8 @@
Contributors: woothemes, mattyza
Tags: widgets, sidebars, widget-areas
Requires at least: 3.3
Tested up to: 3.6.0
Stable tag: 1.3.1
Tested up to: 3.8.0
Stable tag: 1.4.0
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

@@ -71,6 +71,10 @@ Looking to contribute code to this plugin? [Fork the repository over at GitHub](

== Upgrade Notice ==

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

= 1.3.1 =
Bug fix to ensure multiple conditions save correctly.

@@ -88,6 +92,12 @@ Moved to WordPress.org. Woo! Added scope to methods and properties where missing

== Changelog ==

= 1.4.0 =
* 2015-02-17
* WordPress 3.8 compatibility.
* Adds "posts tagged with" condition.


= 1.3.1 =
* 2013-08-13
* Bug fix to ensure multiple conditions save correctly.
6 changes: 3 additions & 3 deletions woosidebars.php
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
* Description: Replace widget areas in your theme for specific pages, archives and other sections of WordPress.
* Author: WooThemes
* Author URI: http://woothemes.com/
* Version: 1.3.1
* Stable tag: 1.3.1
* Version: 1.4.0
* Stable tag: 1.4.0
* License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/

@@ -22,6 +22,6 @@

global $woosidebars;
$woosidebars = new Woo_Sidebars( __FILE__ );
$woosidebars->version = '1.3.1';
$woosidebars->version = '1.4.0';
$woosidebars->init();
?>

0 comments on commit 4bbc775

Please sign in to comment.