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>
-
Well, I don’t recognize that code — mine’s different — but the issue is the same, so I’ll piggy back if I may.
WP 2.0.4, Default. I have downloaded, unzipped, and uploaded files to what should be the proper WP files — according to readme that came with download. I have also activated all I can find to activate, yet NOTHING HAPPENS. My conclusion is pretty much the same as Remex — I need to widgetize. I have from Automattic a suggested 4 line code for my sidebar, but I can’t figure out where in the sidebar code I should put it.
Like many of the problems I am experiencing with WP, it seems my version (the latest one) is newer than most of the fixes given in the Forums. Consequently I can’t compare my files with the examples used in the instructions.
I have emailed a similar message to Automattic, but thus far no response from them. Their web site looks like it would be perfect for modifying another version of WP, but doesn’t look at all familiar to me.
Help appreciated. Thanks.Download the widgets plugin from https://automattic.com/code/widgets/
Uncompress the distro. Copy the classic and default folders to your wp-content/themes folder (which will overwrite ONLY the sidebar.php file, and add the functions.php file). Copy everything else to wp-content/plugins/widgets/ (in that folder you should have a scriptaculous folder, a README file, rss.png graphic and widgets.php file).
In the sidebar.php file for your theme, find the opening nested-list ul tag, and insert immediately after it and before the first opening li tag:
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
Scroll down to just before the closing ul tag, and insert:
<?php endif; ?>
Copy the functions.php file from the classic folder preferably (unless you’re using the vanilla default theme) into your theme folder.
Now, upload the new sidebar.php file and the functions.php file to your wp-content/themes/yourtheme folder online. Upload the widgets folder to wp-content/plugins.
Access wp-admin/plugins – activate widgets. You should see the default widgets in the sidebar widgets tab under the presentation tab.
https://automattic.com/code/widgets/themes/ explains it all. ??
vkaryl,
I’m doing what you suggest with no luck. When I first added the code you suggest, I got an error about a php end not expected, but I have corrected that (not sure how – perhaps typing error)and now the blog loads alright, but still looks exactly like it did before I downloaded the widgets, activated them, and added your suggested code. In my dashboard>themes there is no “widget”.
Though php is not my native language, it looks to me as though the <?php if ( function_exists . . . line is trying to find the “function” and can’t, so as designed it goes on with the previous code.
Even if I’m right about this, I don’t know how to solve the problem, so help is still needed AND appreciated.jimsolt: you did activate the widget plugin, right? I failed to include that instruction above, sorry.
vkaryl: Yes I have activated 3 plugins as a result of this attempt to widgetize. They are del.icio.us, Google search, and sidebar widget. The last says it will add sidebar widgets under presentation. Under my Presentation I have only 3 choices, Themes, Theme editor, and Header Image and Color — No Widgets.
Okay, just checkin’…. best to be on the same page as it were.
What theme are you using? Some themes seem to have a problem interfacing with widgets.
Using Default Theme on WP 2.0.4.
Thanks for all your kindly responses.
jimsolt, so we have the same problem.
Viper007Bond, yes, i have read about the article several times, but the “My sidebar isn’t a list. What do I do?” paragraph didn’t perfectly help me widgetizing my theme. I am a newbie to PHP code and don’t know what code should adding into the “functions.php” to fix.
He’s not alone here, I have downloaded themes that say there fully widget compatible or ready, and than when you go to modify / add widgets, you dont get what you expect.
Anyone? Does anyone have or know of someone who has a Default Theme on WP 2.0.4 that has been widgetized? Or is my time better spent on saving the world?
All you should have to do with the default theme is copy the default folder from the widget download over the default folder you already have. It has the appropriate changes in the sidebar.php file and the appropriate functions.php file.
I realize you may have tried that already, but I just yesterday did this for a client with the default theme. It worked fine, she’s blogging away with widgets in place. I can’t give you a link, she’s not ready for “prime time” I guess – I emailed her earlier, just got a reply asking that I not release the URL.
I’m sorry, I just don’t know what else to say. If you want to give me a day or so, I’ll put one up on one of my own sandboxes and provide a link, but I doubt I’ll have time before tomorrow afternoon at the earliest.
Must be something in the air today… I, too, am trying to widgetize. I’m using a widget-ready theme according to WP list–Blue Memories. https://www.karenshanley.com/blog
I downloaded and dragged and dropped widget folder into contents/plugins folder. Activated sidebar widgets on dashboard and nothing–.
Any other thoughts?
Okay, so there is no mistake.
1) Download the widgets plugin
2) unzip and DOUBLE CHECK that there’s no duplicating yellow files – sometimes this happens. If this is the case, the plugin cannot be read correctly.
3) Upload the Widgets folder containing the PLUGIN to your plugins folder ie: wp-content/plugins/widgets
4) activate the plugin. If necessary, hit ctrl+F5 for hard refresh. You should see a new tab within the Presentation admin area. “Sidebar Widgets”.
5) Upload Default sidebar to the Default Theme Folder. Your FTP program SHOULD ask you if you want to overwrite your current sidebar. Click yes – only if you haven’t modified the sidebar.
6) Upload Classic sidebar to the Classic Theme folder. Your FTP program should ask you if you want to overwrite your sidebar. Click yes if you haven’t modified the sidebar.
7) Upload functions.php to your CURRENT THEME folder
ie: wp-content/themes/default OR
ie: wp-content/themes/classic8) Go to Presentation/Themes/Sidebar Widgets and start playing.
CAVEATS:
From the instructions above, the widget will NOT work if you are using your own theme. Uploading both Default and Classic sidebar.php respectively will only introduce widgets to those themes. It will NOT introduce widgets to your current theme, unless your current theme is indeed Classic or Default.YOUR THEME
1) upload the plugin as mentioned above – double check that there’s no duplicating folder.2) activate the plugin
3) if necessary hit hard refresh
4) Go to Presentation/themes. You should see a new admin page offering Sidebar Widgets
5) go to Presentation/theme editor
6) Select YOUR CURRENT THEME (Not default or Classic, in this case)
6) Insert this code into the sidebar where you want the widgets to work – NOT APPEAR. Notice the difference in wording?
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>
<?php endif; ?>
7) save the sidebar file8) Go to Presentation/Themes/Sidebar Widgets and start playing. What you drop and drag here, will APPEAR in your sidebar, once you save your playing.
Hope that clears up any confusion
Wow, KatGirl. A big thanks! Off to follow your directions.
- The topic ‘How to widgetize this sidebar?’ is closed to new replies.