Updated :: Make Your WordPress Themes Wigitized

Most of the themes available now a days are wigitized but there are a few really good ones that are not wigitized.In this tutorial I’ll show how you can wigitize a WP Theme, which can make it really easy to manage the sidebars of a WP Theme.

To check if your theme is widget ready or not just head to Design -> Widgets.

WP-no-widgets

Which means your theme is not widget enable.

Follow these steps to enable widgets for your theme.

  1. Create a file functions.php in your theme directory.
    <?php

    if ( function_exists('register_sidebar') )

        register_sidebar();

    ?>

    If you want 1 side bar

    [ OR ]

    <?phpif ( function_exists('register_sidebars') )register_sidebars(2);?>

    If you want multiple sidebars.You can replace 2 with any number.
  2. After doing that go to Design -> Widgets and you can find thisWP-widgets
  3. Now displaying the sidebars in your theme, open your sidebar.php present in your template theme, look for the unordered list like in the example below and add this text right after the <ul> tag.
    <?php if ( !function_exists('dynamic_sidebar')

         || !dynamic_sidebar() ) : ?>
  4. And finally close the if loop with the endif before the closing unordered list tag</ul>.<?php endif; ?>
  5. For example like this
<ul id="sidebar-right">

<?php if ( !function_exists('dynamic_sidebar')

     || !dynamic_sidebar() ) : ?>

                <li><h2>Categories</h2></li>

        <?php wp_list_categories(); ?>

    <?php endif; ?>

</ul>

NOTE : If you more than one sidebar, the you have to give the sidebar number in the function like this

    <?php if ( !function_exists('dynamic_sidebar')

         || !dynamic_sidebar(2) ) : ?>

Here the 2 is the sidebar number.If there is no number mentioned then the first sidebar is used.

UPDATE : Wigitize the footer

TechUpdates in the comments asked whether the footer can be wigitized.So here’s how we can wigitize the footer

Step 1: open the functions.php that we created above and add the following lines after the register_sidebar() or register_sidebars(2)

    register_sidebar(Array("name" => "bottomleft"));

    register_sidebar(Array("name" => "bottommiddle"));

    register_sidebar(Array("name" => "bottomright"));

for Example :

<?phpif ( function_exists(‘register_sidebars’) )

register_sidebars(2);

register_sidebar(Array("name" => "bottomleft"));

register_sidebar(Array("name" => "bottommiddle"));

register_sidebar(Array("name" => "bottomright"));

?>

Step 2 :Open the theme folder and look for footer.php

Similar Post  How To Resize WordPress wysiwyg Editor To Full Width In Single Click

          In the file look where the footer div block starts and add these lines

<?php if ( !function_exists(‘dynamic_sidebar’)|| !dynamic_sidebar(‘bottomleft’) ) : ?>

<?php endif; ?>

The footer div block would look start with something like this

<div class="footer-box">


If the footer has some functions by default, you can leave them as is.The wigets will replace the default.

For Ex.

<div class="footer-box">

<?php if ( !function_exists(‘dynamic_sidebar’)|| !dynamic_sidebar(‘bottommiddle’) ) : ?>

<ul>

<?php get_recent_comments(); ?>

</ul>

<?php endif; ?>

</div>

2 comments

  1. Tech Updates Reply

    Wow thats a excellent tutorial , world be useful when we need to use a theme which is real good but does not offer widgets. Also can we add widgets to footer files?

  2. Venkat Post authorReply

    @Tech Updates: Thanks for the comments, I’ll try if we can wigitize the footer as well.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.