Sunday, June 22, 2008

WP Theme Lesson #6e: Widgetizing Sidebar

By Sofhal Jamil   Posted at  5:51 AM   No comments

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 in functions.txt to your functions.php file. Save and close the functions.php Notepad.


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


number-of-files.gif


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.gif


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


<?php endif; ?>


widgetize-endif.gif


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.

About the Author

Nulla sagittis convallis arcu. Sed sed nunc. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.
View all posts by: BT9

0 comments:

Back to top ↑
Connect with Us

What they says

© 2013 Dongeng Sebelum Tidur. Distributed By Blogger Themes | WP Mythemeshop Converted by Bloggertheme9
Blogger templates. Proudly Powered by Blogger.