Skip to content

Instantly share code, notes, and snippets.

@j-mccarthy
Last active August 29, 2015 14:09
Show Gist options
  • Save j-mccarthy/e26c97d9b603da30f4e1 to your computer and use it in GitHub Desktop.
Save j-mccarthy/e26c97d9b603da30f4e1 to your computer and use it in GitHub Desktop.
<?php // <- Remove <?php if your using this snippet
// Register New Layout
function jm_custom_layout() {
genesis_register_layout( 'layout-name', array(
'label' => __('custom/layout/name', 'genesis'),
'img' => get_bloginfo('stylesheet_directory') . '/images/yourlayout.gif'
) );
}
add_action( 'init', 'jm_custom_layout' );
// 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