Adding a Custom Widget Area to a WordPress Template

The Codex has a chapter on how to add new widget areas (commonly referred to as ‘sidebars’) to a theme’s template: ‘Widgetizing Themes

This example here is to give you the direct code to add to functions.php and to the template of your theme.

First step: register the custom sidebar

– this goes into functions.php:

'name'         => 'Custom Widget Area',
'id'            => 'custom-widgets',
'description'   => 'a custom widget area',
'before_widget' => '<li id="%1$s">',
'after_widget'  => '</li>',
'before_title'  => '<h2>',
'after_title'   => '</h2>'    ));

Second step: the custom div with the dynamic ‘sidebar’

– this goes into the template at the location where you want the custom widget to appear:

<?php if ( is_active_sidebar( 'custom-widgets' ) ) : ?>
<div class="custom"><ul>
<?php if ( !dynamic_sidebar( 'custom-widgets' ) ) : ?>
<?php endif; ?>
<?php endif; ?>

The outer conditional statement makes sure that the custom div with the widget is only shown if there is actually an active widget in the custom area.

The most basic code to output the widget would be:

<?php dynamic_sidebar( 'custom-widgets' ); ?>

The parameter for registering the widget are taken from the example in the codex; you need to adapt them to fit the existing structure of your theme.
You will of course need to add some styles to format the new custom widget area according to your ideas;
for instance to style the title and to suppress the bullets:

.custom .widgettitle { font-family: arial, sans-serif; }
.custom ul { list-style-type: none; }

The Guru and the Puzzle of Life

Imagine – the whole life is a gigantic puzzle, where we have all the pieces, but no clue how to put them together. There is no template or picture with the puzzle. And to make things even worse, most parts are so similar that is easily possible to match them in a wrong way.
Just sit back and think of it.
So we grow up and trust others more than our own intuition, and we put pieces together in a way we get told – from parents, teachers, friends, employers, the media, religion, social conventions, and so on. The list of our advisers is endless.
And once we put the pieces together we tend to believe this is the one and only way that they will fit, and that this is the right way.

We do not dare taking things apart, because we still have no clue how the finished puzzle will look like.
Now- sometimes we encounter a guru, or a teacher, who succeeded in solving a part of the puzzle for himself, and who is enthusiastic and willing to share the picture of this part with us.
If we trust this teacher, we can allow ourselves to undo a few small bits of our puzzle, and to put them together in a new way that will open up a greater vision towards the whole.
Each one of us has a different puzzle to solve – no two puzzles are exactly the same. However, they have large areas in common.
Remember – the guru cannot solve the puzzle for you, he can only hold up small picture details like bits of a collage, or actually he can only describe these details of the puzzle with his own words.

And it comes even harder: the puzzle of our life is not two dimensional – it is multi-dimensional.
And there are way too many bits to put together in a lifetime …

So – go ahead and look for your guru – a man with a vision greater than your’s; a man whose language you understand; a man who inspires you to keep working on your puzzle.

“If the student is ready – the guru will appear.”

See you in class …

Be aware – gurus come in all forms and disguises.