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 ars technica

  • Google hits back after Apple exec says AI is hurting search
  • Apple: “Hundreds of millions to billions” lost without App Store commissions
  • Matter update may finally take the tedium out of setting up your smart home
  • Cue: Apple will add AI search in mobile Safari, challenging Google
  • Apps like Kindle are already taking advantage of court-mandated iOS App Store changes

RSS mac surfer

  • Tot is new text editor for Mac, iPhone, and iPad focused on constraints and ease of use
  • TiPbITS: Google Drive Sorting Can Hide New Documents
  • How to take a screenshot on a MacBook Pro
  • How To Create Simple Animation With Mac Keynote
  • Last Week on My Mac: Virus pandemics

Donate

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

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