Name your Widgets for WP Theme Development

One of my current projects includes of 6 widgets areas for customization. I wont go into detail of why :). And if you’re either making a theme for yourself or for others it’s always a good idea to be very explicit, that way you don’t have to explain the what/where/why.

So, instead of running through the total amount of sidebars you want in the functions.php file, example below:

if ( function_exists('register_sidebars') )
    register_sidebars(3,array(
        'before_widget' => '<div class="side-box">',
        'after_widget' => '</div>',
        'before_title' => '<h5>',
        'after_title' => '</h5>',
    ));

create an array of widgets – naming each one, example below:

if ( function_exists('register_sidebars') )
register_sidebar(array(
   	'name' => 'Left Sidebar Top',
   	'before_widget' => '<div class="side-box">',
   	'after_widget' => '</div>',
   	'before_title' => '<h5>',
   	'after_title' => '</h5>',
));

register_sidebar(array(
   	'name' => 'Home Announcement',
   	'before_widget' => '<div class="side-box">',
   	'after_widget' => '</div>',
   	'before_title' => '<h5>',
   	'after_title' => '</h5>',
));

register_sidebar(array(
   	'name' => 'Right Sidebar Top',
   	'before_widget' => '<div class="side-box">',
   	'after_widget' => '</div>',
   	'before_title' => '<h5>',
   	'after_title' => '</h5>',
));

About the Author, Dan Cameron:

I'm the owner and solution engineer at Sprout Venture, a web solutions company that specializes in web development including WordPress.

I started my first blog in 2003 and transitioned to WordPress in 2004. Since moving to WordPress I've written a few plugins and themes for public consumption. Lately I'm busy engineering/building/coding and have only been able to share a few code snippets.

If you're in need of some web development, web design or custom WordPress plugins and/or themes contact me, I'll be happy to discuss it with you.

Read More »

blog comments powered by Disqus