Coolest Guides on the Planet

coolest guides on the planet

Coolest Guides On The Planet

  • Home
  • macOS
  • WebDev
  • All Posts
  • Contact

Set a certain Sidebar to Categories and Tags or Posts with Simple Sidebars installed on Genesis

May 1, 2014 3 Comments

Simple Sidebars is a great plugin to use different sidebars on posts, pages, categories and tags in a Genesis theme.

Easy to set up and set for individual pieces of content. However their is no option to bulk set a specific sidebar to a certain category or tag or bunch of posts or any other set of conditionals.

If you don’t fancy doing it manually by selecting each piece of content and selecting the menu from the dropdown,  it can be applied automatically to all desired content with a couple of functions in your theme functions.php file. The example below targets all posts, categories and tags to have specific sidebar whilst leaving any page to have its sidebar as set in Simple Sidebars manually.

function themeprefix_remove_sidebar() {
	if ( is_single() || is_category() || is_tag() ) { 
		remove_action( 'genesis_sidebar', 'ss_do_sidebar' );
		remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
		add_action( 'genesis_sidebar', 'themeprefix_add_sidebar' );
	}   
}
 
//Alternative Sidebar
function themeprefix_add_sidebar() {
	dynamic_sidebar( 'category-sidebar' );
}
 
add_action( 'genesis_before_sidebar_widget_area', 'themeprefix_remove_sidebar' ); //sets the ball rolling

Ok so we have 2 functions and an action, the bottom action triggers it all.

The first function themeprefix_remove_sidebar() selects what we are targetting, in this example it is all posts, categories and tag archive pages are selected. The 2 pipe symbols mean ‘or’ and you can change the conditional syntax to suit. (PHP and WordPress refs).

Then the Simple Sidebar  and regular Genesis sidebar are removed in the next 2 actions, the third action adds in the sidebar we want by calling the function below it.

In that function below – themeprefix_add_sidebar() the name/ID of the required sidebar is passed into the dynamic sidebar which will replace the sidebar for the desired content, category-sidebar in this example.

How you find the name/ID of the Simple Sidebar….

genesis-simple-sidebars

Full Gist with Comments

Cats: 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 feed: ars technica ars technica

  • It's a weird time to buy a laptop, but the new MacBook Pro doesn't skimp on quality
  • 2026 iPad mini review: Maximizing the mini
  • Coming in 2027: Apple’s $1,000 home robot for FaceTime and switching on lights
  • Touchscreen MacBook Pro hands-on: OLED looks great on a Mac
  • Apple announces touchscreen MacBook Pro with OLED display

RSS feed: mac surfer mac surfer

  • Apple Invites Gains Guest Polls and Emoji Effects
  • Google Gemini Launches on Apple CarPlay
  • iPhone Duo Draws Mixed Reactions From Early Buyers
  • Apple Meets Thai Officials Over Mercenary Spyware Alerts
  • Apple Support Community Forums Close November 20

Donate

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

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