WordPress Multiple Sidebars

October 13th, 2011
By: Cory Mathews

Seems there are a lot of complicated ways to add multiple sidebars to a wordpress theme, so here is a simpler one. Add this to your functions.php file for the theme.

add_action( 'widgets_init', 'add_sidebars' );
function add_sidebars() {
  register_sidebar(
    array(
      'id' => 'right',
      'name' => __( 'right' ),
      'description' => __( 'Right Sidebar' ),
      'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'id' => 'left', 'name' => __( 'left' ), 'description' => __( 'Left Sidebar' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' ) ); // add however many more are needed.. }

Then to place the sidebars in your theme just use:

  dynamic_sidebar( 'right' );
  dynamic_sidebar( 'left' );