Revert "Update for new term meta handling."

This reverts commit 93a304aa06.
This commit is contained in:
Nick Croft
2016-10-28 16:08:50 -04:00
parent 92eb20b3ed
commit ab505f5ea6
2 changed files with 32 additions and 14 deletions
+2 -2
View File
@@ -37,7 +37,7 @@ function ss_term_sidebar($tag, $taxonomy) {
<option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php
foreach ( (array) $_sidebars as $id => $info ) {
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_sidebar', true ), false), esc_html( $info['name'] ) );
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, $tag->meta['_ss_sidebar'] , false), esc_html( $info['name'] ) );
}
?>
</select>
@@ -54,7 +54,7 @@ function ss_term_sidebar($tag, $taxonomy) {
<option value=""><?php _e( 'Default', 'genesis-simple-sidebars' ); ?></option>
<?php
foreach ( (array) $_sidebars as $id => $info ) {
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, get_term_meta( $tag->term_id, '_ss_sidebar_alt', true ), false), esc_html( $info['name'] ) );
printf( '<option value="%s" %s>%s</option>', esc_html( $id ), selected( $id, $tag->meta['_ss_sidebar_alt'] , false), esc_html( $info['name'] ) );
}
?>
</select>
+30 -12
View File
@@ -9,7 +9,7 @@ Author URI: http://www.nathanrice.net/
Text Domain: genesis-simple-sidebars
Domain Path: /languages
Version: 2.0.3
Version: 2.0.2
License: GNU General Public License v2.0 (or later)
License URI: http://www.opensource.org/licenses/gpl-license.php
@@ -30,8 +30,8 @@ register_activation_hook( __FILE__, 'ss_activation_check' );
*/
function ss_activation_check() {
if ( ! defined( 'PARENT_THEME_VERSION' ) || ! version_compare( PARENT_THEME_VERSION, '2.2.7', '>=' ) )
ss_deactivate( '2.2.7', '4.4.2' );
if ( ! defined( 'PARENT_THEME_VERSION' ) || ! version_compare( PARENT_THEME_VERSION, '2.0.0', '>=' ) )
ss_deactivate( '2.0.0', '3.6' );
}
@@ -42,7 +42,7 @@ function ss_activation_check() {
*
* @since 1.0.0
*/
function ss_deactivate( $genesis_version = '2.2.7', $wp_version = '4.4.2' ) {
function ss_deactivate( $genesis_version = '1.8.0', $wp_version = '3.3' ) {
deactivate_plugins( plugin_basename( __FILE__ ) );
wp_die( sprintf( __( 'Sorry, you cannot run Simple Sidebars without WordPress %s and <a href="%s">Genesis %s</a>, or greater.', 'genesis-simple-sidebars' ), $wp_version, 'http://my.studiopress.com/?download_id=91046d629e74d525b3f2978e404e7ffa', $genesis_version ) );
@@ -169,19 +169,37 @@ function ss_do_sidebar_alt() {
*/
function ss_do_one_sidebar( $sidebar_key = '_ss_sidebar' ) {
static $taxonomies = null;
if ( is_singular() && $sidebar_key = genesis_get_custom_field( $sidebar_key ) ) {
if ( dynamic_sidebar( $sidebar_key ) ) {
return true;
}
if ( dynamic_sidebar( $sidebar_key ) ) return true;
}
if ( is_tax() || is_category() || is_tag() ) {
if ( is_category() ) {
$term = get_term( get_query_var( 'cat' ), 'category' );
if ( isset( $term->meta[$sidebar_key] ) && dynamic_sidebar( $term->meta[$sidebar_key] ) ) return true;
}
if ( $sidebar_key = get_term_meta( get_queried_object()->term_id, $sidebar_key, true ) ) {
dynamic_sidebar( $sidebar_key );
return true;
if ( is_tag() ) {
$term = get_term( get_query_var( 'tag_id' ), 'post_tag' );
if ( isset( $term->meta[$sidebar_key] ) && dynamic_sidebar( $term->meta[$sidebar_key] ) ) return true;
}
if ( is_tax() ) {
if ( null === $taxonomies )
$taxonomies = ss_get_taxonomies();
foreach ( $taxonomies as $tax ) {
if ( 'post_tag' == $tax || 'category' == $tax )
continue;
if ( is_tax( $tax ) ) {
$obj = get_queried_object();
$term = get_term( $obj->term_id, $tax );
if ( isset( $term->meta[$sidebar_key] ) && dynamic_sidebar( $term->meta[$sidebar_key] ) ) return true;
break;
}
}
}
return false;