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.

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

Your email address will not be published. Required fields are marked *

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

  • Twitter
  • Facebook
  • LinkedIn
  • Google+
  • RSS

Copyright © 2025 � WP Smith on Genesis on Genesis Framework � WordPress � Log in