For example, I want my sidebar to be different for home, different for archive, different for pages, and different for single posts.
I can do this easily for non-widgetized themes by modifying the template files. But, what about those themes that use widgets? Any way to do this?
You can do this with widgets as easily as hard-coding in your template files. I’m running widgets to seven(7) different sidebars.
ie:
articles (global article categories)
articles sub (global article single)
books (main cat)
books sub (main sub cat)
books sub sub (main sub-sub cat)
books sub sub 2 (single for sub & sub-sub)
search
Books is a legitimate e-commerce bookstore. I presently use ten (10) text boxes (and a host of other widgets) to display different information in different sections of my site on different sidebar templates.
To call the individual widgets text boxes per specific sidebar template but NOT for other sections in my site, I use:
HTML/PHP
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('articles-sidebar') ) : else : ?>
where the ‘articles-sidebar’ I simply change to reflect the template I want the widge to appear in.
In functions.php I coded this:
{
register_sidebar(array(
‘before_widget’ => ‘
<div id="%1$s" class="widget %2$s">
‘,
‘after_widget’ => ‘
</div>
‘,
‘before_title’ => ‘
<p class="subheading">
‘,
‘after_title’ => ‘
</p>
‘,
‘name’=>’articles-sidebar’,
));
where ‘name’ articles-sidebar I ADDED a new entry directly underneath that said ‘name=’articles-sub-sidebar (complete code, of course) and so forth for each template I want the widgets to appear on.
Does that help?
Unless someone else has a cleaner way of doing things ??