Home Tutorials WP Theme Lesson #6e: Widgetizing Sidebar

WP Theme Lesson #6e: Widgetizing Sidebar

Author

Date

Updated on

Category

A widget-ready sidebar or widgetized sidebar is almost a standard for themes catering the WordPress 2.0 and 2.1 series. But first, what is widgetizing? Widgetizing simply means getting the Sidebar ready for the Widget plugin; this plugin allows you to easily re-arrange features within the Sidebar.

For example, instead of having to modify the Sidebar codes to switch the positions of Categories and Archives, you simply drag the Archives and Catgories listings to their positions.

Step 1: Create functions.php file

Start a new Notepad, leave it blank, save it as functions.php. Copy everything below to your functions.php file. Save and close the functions.php Notepad.

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

Just for review, you should now have four files in the theme folder named, “tutorial.”

number-of-files

Step 2: Widgetize the Sidebar

Type the following codes directly after the sidebar’s first <ul> tag.

<?php if ( function_exists(’dynamic_sidebar’) && dynamic_sidebar() ) : else : ?>

widgetize-if

Type this one directly before the </ul> tag:

<?php endif; ?>

widgetize-endif

Save the index.php file. You will not see any changes on the web page until you’ve installed the Widget plugin. We’ll do that later.

Follow this WordPress Theme Tutorial Series from the beginning.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Recent posts

The importance of SSL Certificates as part of a web hosting package

Building a successful business requires trust, and gaining trust can be difficult especially when you run a business where it is taken for granted...

How Can Domain Name Extensions Influence Your Brand Name?

Are domain name extensions important in naming your brand? The shortest answer is "Yes." In today's online world, it is the first thing that...

Domain Name Generation Tips for Business in the Teen Niche

Choosing a domain name is important for every business; how much more when you want to choose a name for a niche site like...

5 WordPress Plugins to Increase Your Website Speed

 And if you’re an online entrepreneur, you probably know that making people wait is bad for your eCommerce business too — really bad.I mean,...

How to Show Only Images that the User Has Uploaded in WordPress

When using WordPress with multiple authors, many things need to be taken into consideration. The default permissions system leaves much to be desired, and...

Recent comments