Skip to content

Instantly share code, notes, and snippets.

@billerickson
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/352a67fe320808dff865 to your computer and use it in GitHub Desktop.
Save billerickson/352a67fe320808dff865 to your computer and use it in GitHub Desktop.
<?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