• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
wpdesigner-logo

WPDesigner

WordPress Themes, Blog Design, and Web Development

  • News
  • Tutorials
    • Theme Development
    • WordPress Tips
  • Resources
  • Reviews
    • Hosting Reviews
  • Collections
    • Plugin Collections
    • Theme Collections
  • Contests
  • WWMD
  • Our Themes
  • Login
WPDesigner » Tutorials

WP Theme Lesson #6e: Widgetizing Sidebar

Last Updated on May 8, 2018 by Jazib Zaman

widgetize-endif

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.

About Jazib Zaman

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

  • LinkedIn
  • Pinterest
  • RSS
  • Twitter

Recent Posts

  • Secure Your WordPress Admin Area with Some Reliable Tools
  • What is SEO and How Does it Work?
  • 40+ Solutions to Supercharge Your WordPress Website
  • Create Your Own Website or Outsource to a Web Studio?
  • 4 Things You Will Need for a Successful Career in the Tech Industry

Copyright © 2023 · All Rights Reserved · A Project of TechAbout LLC.
All of our themes are 100% GPL compatible.

  • About
  • Write for us
  • Archives
  • Contributions
  • Privacy Policy
  • Feedback
  • Terms & Conditions