Friday, 19 October 2012

Wordpress - Add a Widget space to a template and add a widget to it.

This is a simple task that any developer making changes to a Wordpress template will need to know.

It's pretty simple; theres two elements to it. Firstly to make sure it's picked up in your admin then edit function.php  - and add it to the template itself.

in function.php ( in your template folder )

the code here for me was


( function_exists('register_sidebars') )


and the call up in the template is

to use multiple widget areas I changed function.php to

if ( function_exists('register_sidebars') ){
    'name' => 'Right Sidebar',
    'name' => 'Top Middle',

and the call up needs to be changed to - if you get the gist.

                                       if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Top Middle') ) : endif;                    ?>

No comments: