Skip to content

Instantly share code, notes, and snippets.

@j-mccarthy
Last active August 29, 2015 14:09
Show Gist options
  • Save j-mccarthy/cf8e28587a5e19dbcd47 to your computer and use it in GitHub Desktop.
Save j-mccarthy/cf8e28587a5e19dbcd47 to your computer and use it in GitHub Desktop.
<?php // <- Remove <?php if your using this snippet
// Hook in just before the main content-sidebar-wrap
add_action( 'genesis_before_content_sidebar_wrap', 'custom_layout_sidebar' );
function custom_layout_sidebar() {
$layout = genesis_site_layout();
// check to see if the custom layout exists
if( 'layout-name' == $layout ) {
echo '<div id="custom-sidebar">';
// Open genesis structural wrap
// Registered your wrap with add_theme_support( 'genesis-structural-wraps', array(, 'custom-sidebar' ) ); in functions.php
genesis_structural_wrap( 'custom-sidebar' );
// Add our sidebar
dynamic_sidebar( 'custom-sidebar' );
// Close the structural wrap
genesis_structural_wrap( 'custom-sidebar', 'close' );
echo '</div>';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment