Add Widgets To Wordpress Leia Theme
Writing by Jason on Thursday, 26 of July , 2007 at 7:49 pm
Have you ever wanted to add sidebar widgets to your Leia Theme in Wordpress? I did it today and would like to share this easy method with everyone. As you can see reallyreally.net currently uses the Leia blog theme, you can view and download the theme from here: http://themes.wordpress.net/?s=Leia
The theme’s full name is leia-english-10. I think it is one of the nicest looking wordpress themes I have ever seen, I just had to get it! The only problem is the theme does not come with dynamic sidebar so that it is not widget aware making it inferior to many other themes out there.
This easy step by step method of widgitizing (is that a word??) the Leia theme is shown below. Works with Wordpress 2.xx.
Step 1. In your, themes > leia-english-10 > sidebar.php file, find the following code, now yours may be different just make sure you find everything between the izquierda & derecha div tags.
<div id="izquierda">
<ul>
<li><h2>Categories</h2>
<ul>
<?php wp_list_cats(); ?>
</ul>
</li>
</ul>
<ul>
<?php wp_list_pages(’title_li=<h2>Websites</h2>’ ); ?>
</ul>
</div>
<div id=”derecha”>
<ul>
<?php get_links_list(); ?>
</ul>
</div>
Replace with this code:
<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>
Step 2. Make a file called “functions.php” with the following code and place the file into your, themes > leia-english-10 directory.
<?php
if ( function_exists(’register_sidebars’) ) register_sidebars(2);
?>
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.
Category: Chit Chat
- Add this post to
- Del.icio.us -
- Meneame -
- Digg
Comment by Josh
Made Monday, 24 of September , 2007 at 8:39 am
Thanks so much for posting this. I just started using this theme today and I couldn’t stand not being able to use widgets. By the way, I had to change some of your apostrophes so single quotes since php doesn’t seem to like that.
Comment by Jason
Made Monday, 24 of September , 2007 at 8:48 am
Thanks Josh, glad to see you could use it. If you get time can you post the updated version, so anyone needing the apostrophes changed can see how. Also what version of php is your server using? I’m not sure if the version matters but we are using php5 here.
Cheers,
Jason.
Comment by Josh
Made Monday, 24 of September , 2007 at 10:30 am
Here is the code that I copied from my blog with the changed apostrophes:
Categories
Pages' ); ?>
I also had to change the functions.php code to work with my blog too:
Comment by Josh
Made Monday, 24 of September , 2007 at 10:32 am
Doesn’t seem like it let me post the code. I’ll try again, but I’ll post it over at my website too. Here is the modified sidebar.php code:
Categories
Pages’ ); ?>
And here is the modified functions.php code:
Comment by Matt Mitchell
Made Saturday, 3 of November , 2007 at 6:35 am
Well, I tried it and I had to change the apostrophies to single quotes as well, in the functions.php file, and the widget area showed right up on the presentation bar. BUT::: now none of my sidebars are showing up at all on the website…I’m still working with it but do you have any suggestions?
Comment by Matt Mitchell
Made Saturday, 3 of November , 2007 at 6:37 am
Whoop, got it. I had to change the single quotes to plain single quotes in the sidebar file. This is great. Thanks for everything (dugg).
Comment by Burn
Made Tuesday, 8 of April , 2008 at 9:43 am
after i got the sidebar widgets working correctly, i made the files available for download.
you can get them here
http://www.burnstyle.net/2008/04/07/since-no-one-has-done-this-yet/



