How to widgetize this sidebar?
-
Just wondering whether it can be widgetized, if the answer is yes, what code should I adding to the code in functions.php?
This is the sidebarcode:
<div id=”categories”>
<h3><span>Categories</span></h3><ul>
<?php wp_list_cats(‘sort_column=name&hide_empty=0&hierarchical=0’); ?>
</ul>
</div><div id=”archives”>
<h3><span>Archives</span></h3><ul>
<?php wp_get_archives(‘type=monthly’); ?>
</ul>
</div>
-
For those trying to impliment a different sidebar into their theme with widgets, this is what’s inside my functions.php which is exists inside my CURRENT THEME folder.
I use TWO sidebars – sidebar.php and sidebar1.php (actually, I use more than that, but for this purpose this exercise will do)
FUNCTIONS.PHP
<?php
>
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
'name'=>'sidebar',
));
register_sidebar(array(
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
'name'=>'sidebar1',
));
}
?hope that helps too.
you can add as many additional functions as you like, depending on how many sidebars you use and what you call them. Don’t forget to change the name to reflect the name of your additional sidebar.
EDIT: sorry, forgot to add that my sidebar ISN’T a standard list. ie:
<li id="wp-pages">Pages
<li>link 1</li>
<li>link 2</li>
</li></ul>
</ul>
That should help the posters above who mentioned that their sidebar wasn’t a list, either.
KatGirl, I got as far as getting everything where it should be. But I’m confused on your directions:
***6) Insert this code into the sidebar where you want the widgets to work – NOT APPEAR. Notice the difference in wording?
Where am I supposed to be looking to see the difference in wording. Insert what code into sidebar? The below? I did that. If you’re referring to something else, I don’t understand. I also don’t understand “NOT APPEAR” Am I supposed to put that somewhere?
***<?php if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar() ) : else : ?>
<?php endif; ?> “Is this supposed to be cut and pasted where it says:
<?php /* if the Sidebar Widgets plugin is enabled */ if ( function_exists(‘dynamic_sidebar’) && dynamic_sidebar(1) ) : else : ?>
Obviously, I don’t know my arse from my elbow here.
Thanks for your help and patience.I also tried cutting and pasting your code into my functions php. I’m still not able to drag and drop widgets into the sidebar. But then why would that work when I don’t have the sidebar php working yet. Sigh. A desperate act by a tired woman.
Hi Karensh1
Take a deep breath… Okay. Maybe my instructions were a little confusing.
All you need to do is insert the code into your sidebar where you want the widgets to work/appear. I just wanted those to understand that while insertion of code into the sidebar calls the widgets into play, NOTHING will show unless something has been dropped and dragged into a sidebar box within the Presentation/Sidebar Widgets Admin Page.
Does that make sense?
You should copy & paste the code to a text file first, and save to desk top. You shouldn’t copy & paste anything from a webpage directly into wordpress software as it tends to introduces cruft.
Here’s the code:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>
<?php endif; ?>
I noticed you provided an already existing widgets code from your sidebar template.
<?php /* if the Sidebar Widgets plugin is enabled */ if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
If you have only one sidebar, try removing the 1 from within the brackets. Don’t remove the brackets themselves.
If you have a sidebar that’s called something else, you’ll need to do this:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('articles-sidebar') ) : else : ?>
<?php endif; ?>
See where I’ve added the name of my new sidebar inside the brackets?
You mention that you’re still unable to drop and drag stuff into your widgets. Do you have a new page within Presentation/Themes/Sidebar Widgets?
Can you see a list of widgets you can drop and drag? Like links? Categories? Pages? Calendar? Stuff like that?
Do you have directly above those choices, a large-ish box that is called Sidebar?
EDIT: When I said NOT APPEAR. See the difference in wording?, I was indicating that nothing will show in your webpage/sidebar unless, and until, you actually drop and drag stuff into the nominated sidebar box that exists within the Sidebar Widgets Admin Page. Hope that clears up any confusion.
Hi KatGirl. First, thank you so much for your time and effort. It’s much appreciated.
I tried putting in your code and still nothing.
Yes, I the sidebar page is there and I can see the sidebar and the widgets. I just can’t drag and drop the widgets.
I’m so tired now, I’m cross-eyed. So, if you’re able to untangle the mystery, I’ll try again first thing in the morning.
Nominating you for sainthood.
KarenOkay, my last question before you nod off. What browser are you using to work the back end?
Do you use FF? I’ve noticed the IE tends to be quirky.
Just a thought. And don’t despair. You’ll get it working. You’re troubleshooting the problem with dedication.
I admire that. ??
Sorry, I nodded off immediately after my last post. I’m an early riser, which also makes me early to bed.
Yes, I use Firefox.
I also tried installing another plugin, AdminDropMenues 2.o, to see if I could get something else working. No go there either.
Before I closed out last night, I put everything back the way it was to get a fresh start this morning.
Hmm. serious deja vu here. Anyway, thanks for the supportive words. They do help.
P.S. There is often a single file page php with each plugin that stands outside the folder for that plugin. I’ve assumed that should go in the content/plugin folder as well. Does it need to go into the specific folder for that plugin or just at the bottom of the contents/plugin folder?
WooHoo–and Duh
KatGirl, I printed out all your posts and went through each step again. WooHoo!!! I got the sidebar widget working!!!
And Duh on me, because I did check to see if there was a double widget folder, but didn’t think that one widget folder being a subfolder of the first counted as a duplicate. Anyway, got rid of one of the folders–and Voila!!!It’s amazing what a nite’s sleep does to get the ol’ brain working again.
Many, many, many thanks!!!
- The topic ‘How to widgetize this sidebar?’ is closed to new replies.