I want to add sidebars or widgets to wordpress theme, I tried many tuts online but they failed because they are to outdated. My website link is here
I want to add sidebar in three column layout.
Thank you
I want to add sidebars or widgets to wordpress theme, I tried many tuts online but they failed because they are to outdated. My website link is here
I want to add sidebar in three column layout.
Thank you
codex it's not outdated http://codex.wordpress.org/Function_Reference/get_sidebar, this might help you.
Register your sidebars in functions.php
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Footer Widgets Left',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Footer Widgets Center',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array(
'name' => 'Footer Widgets Right',
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="widgettitle">',
'after_title' => '</h2>',
));
Create a template file and name it sidebar-footer.php and include the call to your sidebar
<div class="footer-left>
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Widgets Left') ) : ?><?php endif; ?>
</div>
<div class="footer-center">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Widgets Center') ) : ?><?php endif; ?>
</div>
<div class="footer-right">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Widgets Right') ) : ?><?php endif; ?>
</div>
Note: for styling purposes you should wrap the above function call in a div
I broke it into 3 widget areas for you with the css clases "footer-left", "footer-center", and "footer-right"
You will have to add the styles to display them in your css.
Example: clear any floated divs that come before this.
.footer-left {width:300px;float:left;} .footer-center {width:300px;float:left;} .footer-right {width:300px;float:left;}
make sure the next div clears:both
In your footer.php or at the bottom of any of your templates add
<?php get_sidebar('footer'); ?>