• Skip to main content
  • Skip to primary sidebar

Mintstone

Custom Website Development

  • Home
  • Capabilities
    • Website Design
    • Custom Solutions
    • Technical Support
  • Portfolio
  • About
  • Contact Us

December 4, 2018

Output a Genesis Simple Sidebar Title

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’ );

 

Filed Under: Genesis, WordPress

Primary Sidebar

Categories

  • Genesis
  • Gravity Forms
  • PHP/MySQl
  • Popups
  • Search
  • WordPress
Copyright © 2023 - Mintstone Software Solutions | All Rights Reserved | Privacy Policy | Sitemap