Sidebar widgets for Leia
Written by John Moravec on Wednesday, July 25, 2007 at 21:37
If you're new here and like what you read, you may want to subscribe to our RSS feed.
Thank you for visiting!
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!
Related posts
Category: In other news
Comment from Jason
Posted on Wednesday, July 25, 2007 at 22:04
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/
Comment from John Moravec
Posted on Wednesday, July 25, 2007 at 22:15
Ah, I see what’s wrong. Quotes came through formatted improperly. Try it again with the fixed code, above…
Comment from Jason
Posted on Wednesday, July 25, 2007 at 22:19
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’ ); ?>
Comment from Jason
Posted on Wednesday, July 25, 2007 at 22:20
Categories
Pages’ ); ?>
Comment from John Moravec
Posted on Wednesday, July 25, 2007 at 22:26
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…
Comment from Jason
Posted on Wednesday, July 25, 2007 at 22:35
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.
Comment from John Moravec
Posted on Wednesday, July 25, 2007 at 22:38
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
Comment from Jason
Posted on Wednesday, July 25, 2007 at 22:42
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/
Comment from John Moravec
Posted on Wednesday, July 25, 2007 at 22:45
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!
Comment from Jason
Posted on Wednesday, July 25, 2007 at 22:49
Ok thanks mate I will try & work it ![]()
Pingback from ReallyReally.net
Posted on Thursday, July 26, 2007 at 4:17
[...] 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. [...]
Comment from Jason
Posted on Thursday, July 26, 2007 at 5:03
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.
Comment from Mathcv
Posted on Wednesday, August 8, 2007 at 9:36
Ohhhh i try this, but not work for me…
When i go to Presentation>Widget, appear this menssage:
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…
Comment from Mathcv
Posted on Wednesday, August 8, 2007 at 9:37
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…
Comment from John Moravec
Posted on Wednesday, August 8, 2007 at 10:32
You didn’t provide enough details on what you did, so I have no idea what went wrong.
Comment from Mathcv
Posted on Thursday, August 9, 2007 at 6:28
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…
Comment from Mathcv
Posted on Thursday, August 9, 2007 at 6:31
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…
Comment from John Moravec
Posted on Thursday, August 9, 2007 at 12:14
I’m glad that it worked… eventually!
Comment from Rod
Posted on Wednesday, August 15, 2007 at 17:11
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.
Comment from John Moravec
Posted on Wednesday, August 15, 2007 at 17:17
It’s all in your css file. Make sure it refers to h2 class=”widgettitle”.
Comment from jayne d'Arcy
Posted on Thursday, August 23, 2007 at 0:19
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.
Comment from paul crilley
Posted on Thursday, August 23, 2007 at 8:01
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?
Comment from John Moravec
Posted on Thursday, August 23, 2007 at 11:33
Yikes.
Kapikua permitting, I’ll try to assemble a clean, widgetized Leia for download in the near future.
Comment from Anonymous
Posted on Thursday, August 23, 2007 at 13:50
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.
Comment from jayne d'Arcy
Posted on Thursday, August 23, 2007 at 18:38
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. ![]()
Comment from paul crilley
Posted on Friday, August 24, 2007 at 7:16
I’m running 2.2 and have the problem, though, so it can’t be fixed. ![]()
Comment from Darrin
Posted on Friday, September 14, 2007 at 16:18
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.
Comment from John Moravec
Posted on Sunday, September 16, 2007 at 9:20
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…
Comment from Vigi
Posted on Wednesday, September 19, 2007 at 10:10
Wooooop!
Guy, I love you!
And of course the widget-function!
Comment from Darrin
Posted on Wednesday, September 19, 2007 at 13:45
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….
Comment from Darrin
Posted on Thursday, September 20, 2007 at 11:23
Aha! I got it to work finally. I had to replace “&&” in the sidebar.php file with “||”. Now it works.
Comment from Sam
Posted on Thursday, September 27, 2007 at 14:26
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!
Comment from John Moravec
Posted on Thursday, September 27, 2007 at 14:37
You should change the formatting by tweaking the CSS file.
Pingback from Exploring New Learning Spaces » links for 2007-10-06
Posted on Saturday, October 6, 2007 at 6:18
[...] Education Futures » Sidebar widgets for Leia (tags: Leia wordpress themes) [...]
Comment from Daniel
Posted on Thursday, March 27, 2008 at 18:35
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?
Comment from Daniel
Posted on Thursday, March 27, 2008 at 20:53
sorry solved it, was a bug in the german translation of this great theme!
Comment from Burn
Posted on Monday, April 7, 2008 at 17:42
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-one-has-done-this-yet/
