Add Widget Footer In WordPress

This is my second post about wordpress. I think i started liking wordpress and will shift to wordpress soon. My First post about WordPress was about Optimizing WordPress Blogs For the Search Engines.

Today i am writing how to add widget footer in wordpress Blogs.

So, For that first we have edit functions.php. we needed to tell WordPress to insert new sidebars into theme by altering the footer.php file.

Edit functions.php:

Add the following code in functions.php:


<?php
if ( function_exists('register_sidebar') )
register_sidebars(5,array(
'before_widget' => '',
'after_widget' => '',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
?>

Now the architects have drawn up their plans, the construction team come in to put the new sidebars in place. They need to build the new “sidebar” elements into the footer.

Edit footer.php:

Now Find this code in footer.php


<div id="footer">

And immediately ABOVE/BEFORE it, Add the code:


<div id="footer-sidebar" class="secondary">
<div id="footer-sidebar1">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar(3) ) : ?>
<?php endif; ?>
</div>
<div id="footer-sidebar2">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar(4) ) : ?>
<?php endif; ?>
</div>
<div id="footer-sidebar3">
<?php if ( !function_exists('dynamic_sidebar')
|| !dynamic_sidebar(5) ) : ?>
<?php endif; ?>
</div>
</div> <!-- Close footer-sidebar -->
<div style="clear-both"></div>

That done, when your site loads, the builders come in and add the sidebars into the footer.

Now, Now we need some interior designers to add a bit of style and finesse.

Edit style.css:

Add the code to style.css

#footer-sidebar {
border: 1px solid #cccccc;
display:block;
height: 260px;
}
#footer-sidebar1 {
float: left;
width: 300px;
margin-right:20px;
}
#footer-sidebar2 {
float: left;
width: 300px;
margin-right:20px;
}
#footer-sidebar3 {
float: left;
width: 300px;
}

Now your are completely done with widget footer in your wordpress blog.
post signature


Article by

Isha has written 200 awesome articles.

If you like This post, you can follow Cyber World on Twitter. Subscribe to Cyber World feed via RSS or EMAIL to receive instant updates.

Google Profile | Facebook

Write for us a Guest Post!
Google

2 Comments

  1. Usman says:

    Thanks for sharing this code for adding footer widgets

  2. thanks says:

    is it possible to add 4th widget with just adding:

    ?

    thanks :)

0 Trackbacks

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    *

    You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    CommentLuv badge