Forum Replies Created
-
AuthorPosts
-
December 23, 2012 at 10:49 am in reply to: Need help displaying custom sidebar & custom menu automatically #7170sonjayMember
Except, sorry, bits of the code got transformed -- you'll have to mentally change all those ≶ and > bits into
(hope the same thing doesn't happen again. if it does, you'll have to be smart enough to just know what I mean)
(and why isn't there a preview in this forum, so that I can at least see if things are correct before hitting Submit?)
December 23, 2012 at 10:32 am in reply to: Need help displaying custom sidebar & custom menu automatically #7168sonjayMemberThanks for the suggestion. That plugin probably would have accomplished what I needed for the sidebar, but not for the menu. But after looking at the code in the plugin, and doing some more reading in the genesis help files, I figured out what I needed. I'll post it here in case anyone else needs to do the same thing:
For the custom sidebar, I copied the sidebar.php file from the genesis directory to my Lifestyle theme directory, and stuck this code in my sidebar.php file, replacing the line "do_action( 'genesis_sidebar' );"
if ( is_single() || is_archive() || is_page('blog') ) {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_action( 'genesis_sidebar', 'my_genesis_do_blog_sidebar' );
function my_genesis_do_blog_sidebar() {
dynamic_sidebar( 'blogsidebar' );
}
do_action('genesis_sidebar');
} else {
do_action( 'genesis_sidebar' );
}
}
For the menu, I stuck this in my functions.php file:
remove_action('genesis_after_header', 'genesis_do_subnav');
add_action('genesis_after_header','my_custom_subnav');
function my_custom_subnav () {
if ( is_single() || is_archive() ) {
echo '<div id="subnav"><div>';
wp_nav_menu( array('menu' => 'TopGreenBarForBlogSection' ));
echo '</div></div>';
} else {
genesis_do_subnav();
}
}
-
AuthorPosts