Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Create Another Header-Right Widget Area in Genesis Theme to Display on Certain Posts and Categories

February 23, 2014 Leave a Comment

I had to create a separate Genesis Header-Right Widget Area for a client that needed to display different elements on posts in a certain category.

Create the Extra Widget Area and Initialize It

//Add in new Header Right area
function cgp_extra_widgets() {	
	genesis_register_sidebar( array(
	'id'          => 'HeaderRight2',
	'name'        => __( 'headerright2', 'genesischild' ),
	'description' => __( 'This is the Header Right2 Position', 'genesischild' ),
	) );	
}
add_action( 'widgets_init', 'cgp_extra_widgets' );

 

 Conditionally Create the New Header for Header Right Widget 2

function cgp_remove_header() {
	if (is_single('') && in_category('red') )  {
		remove_action( 'genesis_header', 'genesis_do_header' );
		add_action( 'genesis_header', 'cgp_special_header' );
		}

	function cgp_special_header() {
	//my new header code
		genesis_markup( array(
		'html5'   => '<div %s>',
		'xhtml'   => '<div id="title-area">',
		'context' => 'title-area',
		) );
		do_action( 'genesis_site_title' );
		do_action( 'genesis_site_description' );
		echo '</div>';

		genesis_markup( array(
		'html5'   => '<aside %s>',
		'xhtml'   => '<div class="widget-area header-widget-area">',
		'context' => 'header-widget-area',
		) );
		dynamic_sidebar( 'headerright2' );
		genesis_markup( array(
		'html5' => '</aside>',
		'xhtml' => '</div>',
		) );
		}
}
add_action('get_header', 'cgp_remove_header');

So the above is one whole function followed by an action. The first part of the function cgp_remove_header looks to conditionally remove the default Genesis header only in single posts that belong to the category red. You can string multiple conditions here or just leave it at one. So the header is removed from those pages and a new one is created cgp_special_header.

The nested function cgp_special_header  then re-creates the header with genesis_markup , the new widget area is called into the code dynamic_sidebar( ‘headerright2’ );

Finally the cgp_remove_header is actioned by the get_header function.

Full Gist

References Sridhar Katakam and Ryan Meier

 

Cats: Theming, WordPress

Tags

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls

Donate a Beer to the Coolest Guides

Get Beaver Builder Now!

Discuss

3gs 10.6 apache backup baseband boot clean urls cpanel css curl custom database drupal el capitan git Google image instadmg ios iphone jailbreak keys lion mac macos mojave macos sierra menu mysql OSX panda php phpmyadmin private public redirect redsn0w remote rsa SEO shell ssh terminal unstoppables upgrade urls
Get DesktopServer

Lynda

Lynda.com Online Training Videos

TreeHouse

smlinks

Learn WordPress
osx-modify-shell-path

How to Add to the Shell Path in macOS Big Sur and Catalina using Terminal

October 19, 2019

virtual-hosts osx 10.10 yosemite

Set up Virtual Hosts on macOS Catalina 10.15 in Apache

October 19, 2019

Installing Homebrew on macOS Catalina 10.15, Package Manager for Linux Apps

October 18, 2019

Where is the bash shell in macos Catalina?

October 12, 2019

Refine your search

  • All
  • Modules
  • Themes
  • Documentation
  • Forums & Issues
  • Groups

RSS ars technica

  • Apple takes Epic fight over app store fees to the Supreme Court
  • Russian citizens told "switch to Android" after Apple blocks key Russian apps
  • Apple ratchets up prices, blames the cost of memory
  • Apple patches high-severity eavesdropping vulnerability in Beats Studio Buds
  • 20 years of Intel Macs: Why Apple switched, and why it switched again

RSS mac surfer

  • iOS 27 Beta Code Hints at Camera AirPods, AirPods Ultra
  • Apple Watch Series 12 Rumored to Add Health Sensor in Band
  • Apple Suspends Camera AirPods Development: Report
  • Apple Seeks Dismissal of YouTube Channels AI Lawsuit
  • Jon Prosser Fires Back at Apple, Blames Co-Defendant

Donate

Copyright © 2026· Neil Gee - All Rights Reserved - Hosted by Runcloud

Copyright © 2026 · gee on Genesis Framework · WordPress · Log in