mirror of
https://github.com/10h30/genesis-simple-sidebars.git
synced 2026-06-05 15:08:34 +09:00
Update for new term meta handling.
This commit is contained in:
+2
-2
@@ -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, $tag->meta['_ss_sidebar'] , false), esc_html( $info['name'] ) );
|
||||
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'] ) );
|
||||
}
|
||||
?>
|
||||
</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, $tag->meta['_ss_sidebar_alt'] , false), esc_html( $info['name'] ) );
|
||||
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'] ) );
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
||||
+15
-33
@@ -9,7 +9,7 @@ Author URI: http://www.nathanrice.net/
|
||||
Text Domain: genesis-simple-sidebars
|
||||
Domain Path: /languages
|
||||
|
||||
Version: 2.0.2
|
||||
Version: 2.0.3
|
||||
|
||||
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.0.0', '>=' ) )
|
||||
ss_deactivate( '2.0.0', '3.6' );
|
||||
if ( ! defined( 'PARENT_THEME_VERSION' ) || ! version_compare( PARENT_THEME_VERSION, '2.2.7', '>=' ) )
|
||||
ss_deactivate( '2.2.7', '4.4.2' );
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ function ss_activation_check() {
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
function ss_deactivate( $genesis_version = '1.8.0', $wp_version = '3.3' ) {
|
||||
function ss_deactivate( $genesis_version = '2.2.7', $wp_version = '4.4.2' ) {
|
||||
|
||||
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,39 +169,21 @@ 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 ( 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 ( 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;
|
||||
}
|
||||
if ( dynamic_sidebar( $sidebar_key ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_tax() || is_category() || is_tag() ) {
|
||||
|
||||
if ( $sidebar_key = get_term_meta( get_queried_object()->term_id, $sidebar_key, true ) ) {
|
||||
dynamic_sidebar( $sidebar_key );
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user