WP Smith

Creating WordPress & Genesis Websites Since 2010

  • Home
  • About
  • Services
  • Blog
  • Contact

Jul 18 2012

How to Filter the Genesis Sidebar Defaults

By default, Genesis registers its sidebars. For styling reasons, we may want to filter those; however, this can prove difficult with Genesis if you don’t understand how Genesis calls the various files and their order. WordPress follows this priority order:

  1. Plugins
  2. Child Theme
  3. Parent Them

First, WordPress gives prioirity to plugins, so modifying these defaults works well in a core functionality plugin.

Second, Genesis “teaches” many people to place their content below the statement require_once( get_template_directory() . '/lib/init.php' ) that often appears at the top of the functions.php file. In essence, by doing this you are executing genesis_init and genesis_setup hooks. So anything that hooks to those functions that appear below (and even before) this statement WILL NOT be executed.

So, let me demonstrate:

THIS WILL NOT WORK!

So, the way I build my child themes is to use functions for everything, so there is no dropping in code in functions.php, like so many do (and even as WordPress and Genesis encourages). While Genesis can do things like add_theme_support(), or genesis_register_sidebar(), etc. These are best placed inside a function that hooks to genesis_setup, genesis_init, or after_setup_theme. However, this is more about the philosophy and the praxis of child theme development.

So, if you use your functions.php as most people do, my recommendation is to either (1) add this to your core functionality plugin, or (2) develop another plugin (drop-in [plugin file that is placed in wp-content/plugins directly, see also hakre on wordpress’s (sic) post on Must-Use Plugins and Drop-Ins] even). To help you, here is the plugin code you will need:

Or you can download it here: [download id=”20″]

Once you download the file, just upload and install just like you would any other plugin.

Share this:

  • Twitter
  • Facebook
  • LinkedIn
  • Print
  • Email

Written by Travis Smith · Categorized: Genesis

StudioPress Premium WordPress Themes     WP Engine Managed WordPress Hosting

What can I do for you!?

Custom Development

We develop plugins by determining both business/functional and technical requirements, following WordPress development best practices, and using agile methodology to ensure you get the best solution.

Consulting

Have questions? Need a reliable developer to consult? Please contact us today!

Customized Theme

We can customize your theme or child theme, or create a child theme for you based on your needs while enhancing the performance of every individual attribute.

Customized Plugin

We can customize your plugins, extend plugins (e.g., Gravity Forms, Jetpack, Soliloquy) based on your needs ensuring security, performance, and positive business impact.

Contact Us

About Travis Smith

As a WordPress enthusiast, developer, and speaker, Travis writes about what he learns in WordPress trying to help other WordPress travelers, beginners and enthusiasts with tutorials, explanations, & demonstrations.

Leave a Reply Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Need Help?

Please let us know how we can help you!

Get Help

Recommendations

Genesis WordPress Framework
Sucuri Security
Gravity Forms
GetSoliloquy
Get Envira
Scribe SEO
BackupBuddy
WordPress Video User Manuals

Recent Posts

  • Hiding an User in the WordPress Admin
  • Custom Rewrite Rules for Custom Post Types and Taxonomies
  • WordPress JavaScript Manager Native Functions
  • Causes of WordPress Site Performance Slowdown
  • Need for Speed

Latest Tweets

  • New post on my blog: Complete text of the Bill Gates “Trustworthy Computing” Memo https://t.co/dbhC7d85ht May 9, 2019 1:33 pm
  • New post on my blog: The Argument About What Is Stp in Chemistry https://t.co/YBPMm1bzks April 18, 2019 3:21 pm
  • New post on my blog: Infographic: The Entire JavaScript Language in One Single Image https://t.co/F1rTxCIWas March 22, 2019 5:45 pm
  • New post on my blog: Jim Casey’s “A Talk with Joe” https://t.co/KfWzsEd6qz March 22, 2019 5:45 pm
  • New post on my blog: Email in Real Life https://t.co/gM0W4vffZQ March 22, 2019 5:45 pm
  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2019 WP Smith on Genesis on Genesis Framework WordPress Log in

loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.