Skip to content

Instantly share code, notes, and snippets.

@vajrasar
Created June 24, 2013 18:02
Show Gist options
  • Save vajrasar/5852103 to your computer and use it in GitHub Desktop.
Save vajrasar/5852103 to your computer and use it in GitHub Desktop.
to engage sidebar-content-sidebar layout in Genesis.
<?php
/*
The below written code went into functions.php
*/
genesis_register_sidebar( array(
'id' => 'wishes-sidebar',
'name' => 'wishes Sidebar',
'description' => 'This is wishes Sidebar.',
) );
genesis_register_sidebar( array(
'id' => 'wishes-sidebar-alt',
'name' => 'wishes Sidebar Alt',
'description' => 'This is wishes Sidebar alt.',
) );
add_action( 'get_header', 'cpt_sidebar_logic' );
function cpt_sidebar_logic() {
if ( is_post_type_archive( 'wishes' ) || is_singular( 'wishes' ) || is_tax( 'wish_category' )) {
remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
add_action( 'genesis_after_content', 'wishes_get_blog_sidebar' );
}
}
function wishes_get_blog_sidebar() {
get_sidebar( 'wishes' );
}
/*
the following code went into sidebar-wishes.php
*/
?>
<div id="sidebar" class="sidebar widget-area">
<?php
genesis_structural_wrap( 'sidebar' );
do_action( 'genesis_before_sidebar_widget_area' );
dynamic_sidebar('wishes-sidebar');
do_action( 'genesis_after_sidebar_widget_area' );
genesis_structural_wrap( 'sidebar', 'close' );
?>
</div>
<?php
/*
and the following went into archive-wishes.php and single-wishes.php
*/
add_filter( 'genesis_pre_get_option_site_layout', 'child_do_layout' );
function child_do_layout( $opt ) {
$opt = 'sidebar-content'; // i will change this to sidebar-content-sidebar once I get the solution
return $opt;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment