Powered by Blogger.

Adding Widget to Your WordPress Theme


Add this to functions.php in ur theme directory

register_sidebar( array(
'name' => __( 'Home Sidebar', 'twentyten' ),
'id' => 'home_widget',
'description' => __( 'home', 'twentyten' ),
'before_widget' => '<li id="%1$s">',
'after_widget' => '</li>',
'before_title' => '<h3>',
'after_title' => '</h3>',
) );

Add this to sidebar.php  or any other file depending on your requirement in ur theme directory

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('home_widget') ) : ?><?php endif; ?>

or

<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar('home_sidebar') ) : else : ?>
 
<?php endif; ?>

No comments