Hi,
I'm doing more or less the same thing as this question: http://wpquestions.com/question/show?id=3997
I want to add widgets to my left hand bar and I followed the directions given in the link above. I see the left navigation showing "No widgets. You should add some widgets" but I can't see them in my admin pane to add them, and I can't figure out how to add them manually.
My first choice would be to see the sidebar tab in the admin tool just like I do with the footer bar currently.
This is my website: http://www.oic-books.com/blog/
Francisco Javier Carazo Gil answers:
This is strange if you have done all, there's no should be any problem.
Try to clear cache and also remember:
1. Create sidebar file php
2. Register it:
if ( function_exists('register_sidebar') )
register_sidebars(2,array(
'before_widget' => '<div class="widget">',
'after_widget' => '</div><!--/widget-->',
'before_title' => '<h2>',
'after_title' => '</h2>',
));
3. Call it with his ID:
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
...
<?php endif; ?>
Emily Wood comments:
Hi Francisco,
In step 3, am I putting that in the functions.php as well?
Francisco Javier Carazo Gil comments:
No, the last one you have to create it into your sidebar file.
You can use names instead of IDs.
In functions.php you have:
<?php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'before_widget' => '<li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
register_sidebar(array('name'=>'mysidebar'));
?>
And then in your sidebar.php in the place where it will be placed use the conditional:
< ?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar('mysidebar') ) : ?>
< ?php endif; ?>
Try now.
Emily Wood comments:
I've got the section showing up in the admin tool now (yeah!), and I added the widgets I wanted (screenshot attached). On the front end of the site, still nothing. I cleared the cache and tried another browser.
Here's the full code of sidebar-header.php:
<!--BEGIN: sidebar-->
<aside id="header-sidebar" role="complementary">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar('mysidebar') ) : ?>
<?php endif; ?>
<!--WP Hook for plugins-->
<?php wp_meta(); ?>
</aside>
<!--END: sidebar-->
I tried just the code you gave, and that showed up in the sidebar. I went back to the original code, and got the "no widgets" message. This code just doesn't show anything. I even tried deleting and add widgets on the off chance I picked ones that wouldn't be compatible with left hand sidebar and no change.
I thought maybe I was doing conflicting code in the functions.php, so I commented out everything with "register_sidebar" except for what you gave me. I'm at a loss.