Wednesday, January 28, 2015

how to add widget in wordpress

go to theme directory then open function.php file then find function function twentyeleven_widgets_init()
add following code inside it:
register_sidebar( array(
'name' => __( 'Main Sidebar', 'twentyeleven' ),
'id' => 'sidebar-1',
'before_widget' => '<aside id="%1$s">',
'after_widget' => "</aside>",
'before_title' => '<h3>',
'after_title' => '</h3>',
) );
then call it by following code:
if(is_active_sidebar(f-1)):?>
dynamic_sidebar('f-1');
endif;

No comments:

Post a Comment

Change priority of dual boot OS

Change priority of dual boot OS  (Windows and Linux): Go to your Linux OS, install Grub customizer. Then change priority by up and down arro...