Last active
August 29, 2015 14:01
-
-
Save billerickson/352a67fe320808dff865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add a Blog Sidebar to Genesis | |
* | |
* @author Bill Erickson | |
* @link http://www.billerickson.net/code/blog-sidebar-genesis/ | |
*/ | |
/** | |
* Register Blog Sidebar | |
* | |
* @author Bill Erickson | |
*/ | |
function be_register_blog_sidebar() { | |
genesis_register_sidebar( array( 'id' => 'blog-sidebar', 'name' => 'Blog Sidebar' ) ); | |
} | |
add_action( 'genesis_setup', 'be_register_blog_sidebar', 20 ); | |
/** | |
* Display Blog Sidebar | |
* | |
* @author Bill Erickson | |
*/ | |
function be_blog_sidebar() { | |
if( !( is_home() || is_category() || is_tag() || is_singular( 'post' ) ) ) | |
return; | |
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); | |
if( function_exists( 'ss_do_sidebar' ) ) | |
remove_action( 'genesis_sidebar', 'ss_do_sidebar' ); | |
dynamic_sidebar( 'blog-sidebar' ); | |
} | |
add_action( 'genesis_sidebar', 'be_blog_sidebar', 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment