wordpress-widgets.jpg
(Image credit - Clockless)

Many of the WordPress themes promoted are described as being widget-ready. Widget-ready WordPress theme is a theme that has widgetized areas which allows you to dynamically manipulate these areas in a simple drag-and-drop fashion. Widgetized sidebar is another way to describe the same thing because most of the widgets are used in the sidebars of the themes. However, sometimes you find a WordPress theme that you really like, but discover that it’s not widgets ready. Don’t give up just yet, making themes widget-ready really isn’t as difficult as you might think. Follow the steps in this article and we will teach you how to Widgetize a WordPress theme making it a drag-drop widget theme.


1. Make the changes in functions.php

Open your functions.php file and insert the following code into it, save and close. (Don’t touch anything else there because incorrectly modifying your theme’s functions.php can stop your admin pages from appearing. It’s a good idea to make a backup of your functions.php or even better to backup the whole theme before modifying it) :

<?php
if ( function_exists(’register_sidebar’) )
register_sidebar();
?>

2. Make the changes in sidebar.php

Now open your sidebar.php file and check if the sidebar is widget friendly i.e. if your sidebar uses unordered lists. If not then fix it by formatting the HTML. Here is an example of a typical sidebar:

<div id=”rightcolumn”>
<ul class=”sidebar”>
<li class=”widget”>
<h2>HTML</h2>
<ul>
<li><a href=”#”>HTML</a></li>
<li><a href=”#”>HTML</a></li>
<li><a href=”#”>HTML</a></li>
<li><a href=”#”>HTML</a></li>
<li><a href=”#”>HTML</a></li>
</ul>
</li>
<li class=”widget”>
<h2>HTML</h2>
<h3>HTML…</h3>
<p>HTML HTML HTML HTML</p>
</li>
</ul>
<div class=”clear”></div>
</div>

Just add this template tag in the code directly below the <ul class=”sidebar”> tag:

<?php
if ( function_exists(’register_sidebar’) )
register_sidebar();
?>

3. You are almost there!

And close it by adding the <?php endif; ?> directly above the </ul> tag. That is it. Now go mad with your widgets!

0 Comment

Featured Designs

Parent Society

Parent Society

Marijuana Maps

Marijuana Maps

Cake Journal

Cake Journal

CopyKat Recipes

CopyKat Recipes

Jessica Denay

Jessica Denay

Keith Ferrazzi

Keith Ferrazzi

Rennaissance Yoga

Rennaissance Yoga

Brink Zone

Brink Zone

Illustrious Author

Illustrious Author

Boca Care

Boca Care

KingsCast

Kingscast

Notecook

Note Cook

My Business Musings

My Business Musings