Beth Motta Design & Marketing

Creating Custom Widget Areas in WordPress

If you have the need to create a custom widget area in WordPress for a section of your site which doesn’t already have a widget area, the steps are pretty simple.

First, create the widget areas in your functions.php file:

if ( function_exists('register_sidebar') )

‘name’ => ‘Sidebar 1’,
‘id’ => ‘sidebar1’,
‘description’ => ‘Some description text here’,
‘before_widget’ => ‘<div class=”sidebar-one”>’,
‘after_widget’ => ‘</div>’,
‘before_title’ => ‘<h3 class=”widget-title”>’
‘after_title’ => ‘</h3>’

'name' => 'Sidebar 2',
'id' => 'sidebar2',
'description' => 'Some description text here',
'before_widget' => '<div class="sidebar-two">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">'
'after_title' => '</h3>'

Then simply call your custom widget area within the appropriate WordPress template:

if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar 1') ) :
<?php endif; ?>

Share this article!


Beth is the owner, lead designer and developer of BMD&M. Beth blogs about design, development and DIY projects. When she's not blogging, she teaches as an adjunct instructor at a local college. Beth also tweets for BMD&M.

Connect with Beth on LinkedIn!

Post your thoughts