Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    If you email it to me, I’ll tell you what to do. No trouble. Adding widgets to a theme is very easy, you’ll be shocked at how simple it is once you see how to do it. ??

    [email protected]

    Thread Starter darkmis29

    (@darkmis29)

    Thanks for the reply. I will send asap.

    widgetized ?

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Okay, I got your theme and modified it and sent it back to you. Here’s a quick overview of the changes:

    First, I added a new functions.php file, since you didn’t have one. Here’s the content of that file:
    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar();
    ?>

    That’s it. Nothing complicated. All it does is to check that you have the widgets plugin activated and if you do, then it tells the widgets plugin you have a sidebar.

    Then I took a look at your sidebar.php. You have a fairly standard sidebar. The whole thing is basically one big Unordered List. This makes it trivial, all I did was to add:
    <?php if ( !function_exists('dynamic_sidebar')
    || !dynamic_sidebar() ) : ?>

    at the top, after the UL, and then add:
    <?php endif; ?>
    at the bottom, just before the /UL.

    This code causes your sidebar to get replaced with the widgets sidebar, if it exists.

    That’s really all there is to it. Straightforward example from the explanation here: https://automattic.com/code/widgets/themes/

    Now, note that after you activate the widgets plugin, the sidebar you currently have will be gone, replaced with the widgets sidebar. That is, of course, the whole point. ??

    Thread Starter darkmis29

    (@darkmis29)

    Thanks so much Otto!! You will be credited appropriately! Thanks again! And it seems very easy from your example.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can you widgetize my theme??’ is closed to new replies.