If your Genesis site uses different sidebars on different pages then Genesis Simple Sidebars makes this really simple.
But when you need to display the sidebar title before rendering the sidebar itself, here’s how you grab it:
function add_custom_sidebar_heading() {
$sidebarID= genesis_get_custom_field( ‘_ss_sidebar’ );
$sidebars = Genesis_Simple_Sidebars()->core->get_sidebars();
if ( array_key_exists( $sidebarID, (array) $sidebars ) ) {
$sidebar = stripslashes_deep( $sidebars[ $sidebarID ] );
$sidebarTitle = $sidebar[‘name’];
}
echo ‘<div class=”custom-sidebar-title”>
<div class=”custom-sidebar-title-wrap”>
<h1 class=”sidebar-title”>’.$sidebarTitle.'</h1>
</div>
</div>’;
}
add_action( ‘genesis_before_sidebar_widget_area’, ‘add_custom_sidebar_heading’ );