This blog is NOFOLLOW Free!
Posted @ 2:37 pm

As you may know, I am helping to administer The Woolly Mom. However, the theme we are using doesn’t have a dynamic sidebar. I must correct this! The steps: Decide the layout, Write the CSS, Make it dynamic, Add the Widgets.

Today’s Topic: Widgitize The Sidebar

In order to ad widgets to a sidebar, we must undergo a few simple steps in order to widgetize the theme, assuming the theme isn’t already widget-ready. The first step is to take a look at your sidebar setup. Ours is:

<li><div class="sbartitle">THE TITLE</div>
THE WIDGET
</li>

So to facilitate this, we create a functions.php template file and include the following in it:

<?php
if ( function_exists('register_sidebar') )
    register_sidebar(array(
        'before_widget' => '<li>',
        'after_widget' => '</div></li>',
        'before_title' => '<div class="sbartitle">',
        'after_title' => '</div><div style="margin-right:10px">',
    ));
?>

Once this is setup, I placed the following code where her sidebar should be (after the <ul> tag):

<?php if ( !function_exists('dynamic_sidebar')
        || !dynamic_sidebar() ) : ?>

Then right before the </ul> tag:

<?php endif; ?>

And viola! Add the widgets and that’s that! If you want some items to appear in the sidebar before the widgets (without using the text widget), just add those items before the above code right after the <ul> tag.

Rate this with SezWho :
2.5

Bookmark and Share

Rate this post:
1 Star - So-so...2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars - GREAT! (No Ratings Yet)
Loading ... Loading ...



Related Posts


  ∫  


Categories:   Design / Maintenace   •   Running a Website

Tags:     •     •     •  






RSS feed

Comments

No comments yet.

Sorry, the comment form is closed at this time.

 
Subscribe to
The Webmaster's Edge RSS

Subscribe by
E-Mail Subscription


Recent Posts Title
Recent Posts NoDisplay
Categories Title
Categories NoDisplay
Comments Title
Tag Cloud Title
Tag Cloud NoDisplay
Archives Title
Archives NoDisplay
Commentators
  • No commentators.
Shop Cloud Title
Shop Cloud