Your Genesis child theme likely has several “widget areas” built-in, where you can place one or more widgets to display in various areas on your site. If you would like to create additional widget areas, you must “register” the new widget area, and then add it to your theme in one of two ways, described below.
Register the New Widget Area
Open your child theme’s functions.php file and add the following code:
You should customize the parameters for each of the three options in the example, described below:
- id: This value must be unique, all lowercase, with no special characters or spaces (numbers are allowed). This value is how the widget area is identified behind the scenes.
- name: This value is more flexible, and can include spaces and other special characters. This is the name that appears for this widget area in your dashboard.
- description: A description of the widget area that appears in your dashboard. Use this field to briefly describe where the widget area will be used.
You can add as many widget areas as you like using this code, however each one must have a unique ID. You should also give each widget area a unique name and description to avoid confusion.
Display the Widget Area
There are two ways by which you can display a newly registered widget area in your theme. The first option is to place the widget code directly in a template file (such as home.php) where you want to display the widget area:
The second option is to display the widget area using a hook. This example adds the after-post widget area after the post content on single posts:
Be sure to replace the widget ID with whatever your widget’s ID is.
Note: If you’re using an HTML5 Pro theme, you will need to use genesis_entry_footer instead of genesis_after_post_content as the hook.
Also note that we used the same after-post to call the correct widget area, and a conditional to show it on single posts only. You can change the hook and the conditional to have the widget area show up in different areas.
You might want to include additional CSS, depending on widget placement.
See the WordPress® codex for additional information on widgets.1
