Okay, okay…!! I’ve been getting lots of emails from WordPress bloggers looking for a copy of my widgetized adaptation of the Leia theme. I’ll try to get a sanitized edition (with EF-specific stuff removed) available for download sometime in the near future. In the meantime, you can insert this code snippit into your theme’s sidebar.php file, replacing both left (izquierda) and right (derecha) sidebar content blocks:
<div id="izquierda">
<ul>
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>
<li><h2>Categories</h2>
<ul>
<?php wp_list_cats(); ?>
</ul>
</li>
</ul>
<ul>
<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
</ul>
<?php endif; ?>
</div>
<div id="derecha">
<ul>
<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
<?php get_links_list(); ?>
</ul>
<?php endif; ?>
</div>
AND– make sure to enter this into your theme’s functions.php file (you might have to create the file if it doesn’t exist already):
<?php
if ( function_exists('register_sidebars') ) register_sidebars(2);
?>
That’s it! You should be widgetized!
Comments
Tags: blog, open source, Web 2.0





Ah, I see what’s wrong. Quotes came through formatted improperly. Try it again with the fixed code, above…
I think what’s happening is WordPress is trying to do us all a favor by “fixing” the single quotes into left and right single quotes. You should try retyping them in to see if that’ll fix the problem. In the meantime, I’ll see if I can coax WP into displaying them correctly when printed as a code block…
Nope. It goes in your theme’s directory. In your case, it’s located at /home/really/public_html/wp-content/themes/leia-english-10/functions.php
Nope. If you’re running a recent version of WP (2.0 and later?), widget support is built in. Set them up from your Presentation tab.
Sorry, but that’s all the support I can give you. I’m off to bed!
Thanks for the code John! I replaced the code sidebar.php as you suggested and I created a file called functions.php & placed it in my theme’s folder with the code you suggested but I ma getting this error: Parse error: syntax error, sidebar.php on line 61, see my blog here: http://www.reallyreally.net/
Ah, I see what’s wrong. Quotes came through formatted improperly. Try it again with the fixed code, above…
I am not sure if you wanted me to edit the functions.php file that is located in the wp-includes folder or to create another file called functions.php that resides in my “leia-english-10″ theme folder. So I did both and when the files were uploaded I got a functions.php error so I changed the wp-includes>functions.php back to it’s original state and now I get the error that I mentioned in the previous post.
Here is the code surrounding line 61 of sidebar.php:
Categories
Pages’ ); ?>
Categories
Pages’ ); ?>
I think what’s happening is WordPress is trying to do us all a favor by “fixing” the single quotes into left and right single quotes. You should try retyping them in to see if that’ll fix the problem. In the meantime, I’ll see if I can coax WP into displaying them correctly when printed as a code block…
So does the second block of code go into: wp-includes>functions.php
I am still getting the error on line 61 of sidebar.php.
Cool ok got that, now do I need to have the widgets plugin installed from here to make this work? http://automattic.com/code/widgets/ After reading this I assume I do? http://automattic.com/code/widgets/themes/
Nope. If you’re running a recent version of WP (2.0 and later?), widget support is built in. Set them up from your Presentation tab.
Sorry, but that’s all the support I can give you. I’m off to bed!
Ok thanks mate I will try & work it
[...] That’s it! Your done! As long as you are running a recent version of WordPress, ie 2.0+ this should work no problems. To make sure it is working log into your admin area and look in, presentation > Widgets, you should see the two bars there with options to add widgets from the bottom of the page. If you don’t then back track and double check everything. Your comments are welcome, let me know if you have any problems, I will be happy to help as best I can Full credit goes to John Moravec at educationfutures.com for showing me how to do this. [...]
Cheers so much John, I now have it up and running. Not sure why I couldn’t get it working at the start lol
If anyone is needs another/different explanation of how to do this I have made a post about it here with full credit to educationfutures.com! http://www.reallyreally.net/chit-chat/add-widgets-to-wordpress-leia-theme.html
All the best,
Regards Jason.
Ohhhh i try this, but not work for me…
When i go to Presentation>Widget, appear this menssage:
Ohhhh i try this, but not work for me…
When i go to Presentation>Widget, appear this menssage:
No Sidebars Defined.
You are seeing this message because the theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please follow these instructions.
Y do exactly you example…
Modify and Remplace the code in sidebar.php
Make file called function.php and upload this files…
I using WordPress 2.2 with widget-plugin integrated…
Any suggest?
Thanks for advanced…
You didn’t provide enough details on what you did, so I have no idea what went wrong.
Sorry… but i did what your you wrote…
Pleace, see my 2 files:
http://delakroketa.joolo.com/sidebar.txt
http://delakroketa.joolo.com/function.txt
I not understand that it happens…
Thanks…
already that this happening, I cannot believe it…
Wrote function.php and the correct thing is functionS.php…
You can erase the previous commentary, the one that contains links pleace?
Sorry…
And thanks for all…
I’m glad that it worked… eventually!
I’m glad that it worked… eventually!
John…great work! Thanks for the codes.
I’m just wondering, how do I change the size of the text on the Sidebar like the one you have? I’m looking all over Style.css can’t figure it out! Thanks a million.
It’s all in your css file. Make sure it refers to h2 class=”widgettitle”.
John…great work! Thanks for the codes.
I’m just wondering, how do I change the size of the text on the Sidebar like the one you have? I’m looking all over Style.css can’t figure it out! Thanks a million.
It’s all in your css file. Make sure it refers to h2 class=”widgettitle”.
I sort of got this to work. I have v2.2.1 of WP. The problem that I’m having is that after I insert all the code in the correct places I go into Widgets to place my widgets. I have two widget sidebars showing, but when I try to drag widgets onto the second sidebar, they won’t stay put. If that’s not clear, then here’s an example: I have the Archives widget and I try to drag it onto Sidebar 2. When I drop it, it pops right back into the box of widgets.
For now I’m just using the left sidebar, but if you have a solution, let me know.
I managed to insert the coade, and the “categories” and “Pages” appeared in my sidebar, but when I go to wordpress page I get this message No Sidebars Defined.
You are seeing this message because the theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please follow these instructions.
Any ideas why?
Yikes.
Kapikua permitting, I’ll try to assemble a clean, widgetized Leia for download in the near future.
Aargh. Sorry. I didn’t mean to add to your workload or anything. I was hoping I was doing something stupid that could be fixed relatively simply.
I figured out what my problem was and apparantly it’s something with the 2.2.1 version of wordpress. What happens is that when you have two or more sidebars, it will not allow you to move widgets modules from one sidebar to the next unless you have put something from the widgets box FIRST into each sidebar. I’m guessing this glitch is fixed with 2.2.2 version.
Anyway, I’m liking just the one sidebar, so don’t bang your head over my problem.
I’m running 2.2 and have the problem, though, so it can’t be fixed.
Weird. I followed the directions and the Sidebar Arrangement page shows up. I have the sidebars that I drag my widgets into. I save them and it says “Saved”. Then I go to my blog and nothing’s changed. I even cleared my cache and reloaded. Nada.
Darrin, it looks like you figured it out. Also, some hosts tend to cache the template files in odd ways. Sometimes you need to wait for it to refresh…
Wooooop!
Guy, I love you!
And of course the widget-function!
Wooooop!
Guy, I love you!
And of course the widget-function!
Unfortunately, no, I didn’t figure it out. The sidebar is there, but changing my widgets and saving leaves me with the exact same sidebar. No change. Grrr….
Aha! I got it to work finally. I had to replace “&&” in the sidebar.php file with “||”. Now it works.
Thanks so much for the Widget Aware leia. It worked great in two minutes! One question: where would I go to change the formatting so that there is some space between all the widgets. For example, if you have categories, and then recent comments, to not have them standing right on each other’s head. Just to create a couple lines of space between each widget. Also, is there a way to enter items into the widget sidebar and have them take up both columns, but then have other widgets just take up one column or the other? Many thanks for any thoughts.
P.S. I find your site very interesting in itself, and hope to explore it more soon. Landed looking for Leia help!
You should change the formatting by tweaking the CSS file.
[...] Education Futures » Sidebar widgets for Leia (tags: Leia wordpress themes) [...]
Hi,
I managed to widgetize this wonderful theme with ur help, but now my plugin nextgen gallery from alex raabe does not work. pictures added into articles are not shown and the nextgen slideshow widget does not work to. Do you have a hint for the reason of this or how i can solve this problem?
sorry solved it, was a bug in the german translation of this great theme!
after i got the sidebar widgets working correctly, i made the files avalible for download.
you can get them here
http://www.burnstyle.net/2008/04/07/since-no-on…
[...] Problem mit den Widgets. Aber nach kurzer Google Recherche habe ich auch das in den Griff bekommen. HIER gibt es eine einfache Anleitung [...]
Thanks for that…works just fine.
http://www.fiveandunder.com.au/blog/
all the best
David
[...] Falls nicht, hier der Link für die Beschreibung, wie man die einbaut. Education Futures [...]