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

  • OpenAI feels “burned” by Apple’s crappy ChatGPT integration, insiders say
  • Desperate Trump taps "Tim Apple," Jensen Huang, Elon Musk to attend Xi summit
  • Court rules Trump's 10% tariff is just as illegal as the tariff it replaced
  • Which Macs are suffering from shortages—and where are things getting worse?
  • Mac mini starting price goes up to $799, may be hard to get for "months"

RSS mac surfer

  • Apple Registers GenAI Subdomain Ahead of WWDC
  • Ben Stiller, Mike Judge Team for Apple TV Comedy
  • Apple Asks Supreme Court to Review Epic Contempt Ruling
  • Apple TV to Broadcast MLS Game on iPhone 17 Pro
  • OLED MacBook Pro Display Production Back on Track

Donate

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

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