How to widgetize your WordPress theme


Save 20% with Business Solutions from GoDaddy.com!

This tutorial will show you how to enable widgets in your WordPress theme sidebar.php file.

Widgets allow you to add/remove content in your side bars without editing your template files. Excellent for users who are HTML/PHP challenged.

The first step is to edit your theme’s functions.php file

NOTE: If your theme does not include a functions.php file, create one using Notepad (leave it blank) and then upload it via FTP into your themes folder.

Open your functions.php file in your WordPress admin area. Paste the following code into the file.

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

Save this file.

Now, add the following code into your sidebar.php file:

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

NOTE: This code can be placed anywhere in this file.

Save this file.

That’s it!

You can now click on Widgets” to the left under the Appearances tab to add widgets.

widgets1

If you run into any troubles, let me know below :)

  • Share/Bookmark

Related tutorials that might interest you:

    How to add an author box after my post in WordPress
    Displaying recent posts as thumbnails in sidebar
    Thesis WordPress Theme
    How to change the width of your osCommerce store
    How to add HTML into a WordPress post

2 Responses to “How to widgetize your WordPress theme”

  1. tasarhane says:

    thanks for the quick info..

  2. You are welcome tasarhane, thanks for the visit :)