Build Your Own Business Website header image

Whoops, you've found some premium content!

Watch the opening clip of this video to preview it,
the full video is available to paid members.

Part 2 – Register Custom Sidebars in Genesis

Difficulty Level -

Filed Under Topics - ,

Listed Under Lesson Subjects -

Applies to -

Now that you understand the way Genesis registers sidebars is a bit different from the typical WordPress way, let’s start by registering a sidebar. We’re going to work in our custom-functions.php file. This is the one that we had at the end of the Introduction to Customizing Genesis with PHP seminar.

Get the Code

First, let’s head over to Studio Press and look at this How to Register a Widget Area. This is one of the tutorials inside of their Tutorial sections and from this you’ll see it’s actually quite simple to register a sidebar.

You can just copy this to start and then come over here and paste it. I’m going to paste that up here at the top because, unlike some of the functions we’ve created, this is one of those where you don’t wrap it inside of a function and then hook it to a hook.

That’s what is unusual about this. Ordinarily, everything else we’ve wrapped in a function and then hooked the function to the appropriate WordPress hook but when you’re registering sidebars in Genesis that doesn’t work that way.

3 Elements of Registering a Sidebar

The register sidebar has essentially 3 elements. The function name is genesis_register_sidebar. It takes one attribute as an array and at a minimum that attribute has to have 2 elements, the ‘id’ and the ‘name’, but it can also have a ‘description’.


The ‘id’ needs to be a unique id so you can’t actually use one that’s already in use. That is going to cause a problem so you want to use something that’s relatively unique. I’m going to say ‘above-footer’ for its id.


Then we’re going to give it its name ‘Above Footer’, themename’.


For its description let’s add ‘This is a test widget area that will be placed in the footer’, ‘themename’.

How to Internationalize the Code

Note the syntax here. You’ve got the double underscore plus the bracket and then you’ve got the text and then you’ve got this thing that says ‘themename’. This is the method for internationalizing your plugins or themes.

Essentially this is the text domain for the theme and then if somebody has a translation for the theme set up then it will look for this text ‘above-footer’ and replace it with whatever the correct language is.

Chances are for what you are doing you don’t really need internationalization so I’m just going to take it out here. If you are just doing this for yourself or for a client then internationalization probably doesn’t really matter.

This is it in its simplest form, that is genesis_register_sidebar, ‘id’, ‘name’ and ‘description’ without the internationalization.

Someone is asking how is Genesis dealing with internationalization? Let’s just look at their functions.php file and see what they’re doing for that. So, add_theme_support, register_sidebar and they’re using Enterprise. So you could do that as well since that’s what I’m using.

We’re working in the Enterprise Pro child theme so if you were going to retain internationalization, rather than ‘themename’ what you would do would be to use ‘enterprise’ because that’s the text domain that the rest of the theme is working on.

Different Ways of Registering a Sidebar

And now the sidebar is registered. But there are a couple of different ways you can register the sidebar. You can register the sidebar by doing what we just did or you can register the sidebar with a whole bunch of other things.

The minimum is ‘id’ and ‘name’, you can also include ‘description’. You can also include what’s very common for WordPress, ‘before-widget’ and ‘after-widget’ and ‘before-title’ and ‘after-title’. We’ll look at an example of that later today but we’re going to start with just this.

Let’s save this and upload it to our site then come back and look at our widget areas. You can see we have a brand new widget area here. This is widget area ‘above-footer’ and here’s the description. The description is This is a test widget area that will be placed in the footer so that’s the first part of using a sidebar.

Save $200 on Membership Now!

Start learning today for as little as
$0.82 PER DAY!
Subscription Options
0 Comments… add one
0 comments… add one