The marketplace for Premium Themes — & — Templates

2,074,953 People using Mojo
353,476 Downloaded items
2129 Marketplace items
2 Green Monsters

The Mojo Blog

Blog | WordPress Wednesday: Secondary Widget Areas (sidebars)

WordPress Wednesday: Secondary Widget Areas (sidebars)

Posted By MikeHansenMe

1 Comment

WordPress Wednesday: At MOJO Headquarters we are lucky enough to have two in house WordPress Core Contributors, Mike Hansen and Bryan Petty. Each week we’ll be sitting down with them to get the inside scoop on what’s new with WordPress.

Have you ever wondered how some themes add widgets in the footer or even a 3 column design?

In order to create multiple widget areas you need to register the widget area in your functions.php or plugin file.

For the example we will register 1 additional sidebar named “Footer Area”.

	register_sidebar( array(
	   'name'          => __( 'Footer Area', 'your-theme-domain' ),
      	   'id'            => "footer-area",
      	   'description'   => 'This is the widget area in the footer',
      	   'class'         => 'footer-area', //a class so you can style it
      	   'before_widget' => '<li class="widget">',
      	   'after_widget'  => "</li>\n",
      	   'before_title'  => '<h2 class="widgettitle">',
      	   'after_title'   => "</h2>\n"
	) );

So now that we have the widget area(sidebar) registered we can view it under Appearance → Widgets

Screenshot of the footer widget area in the admin

Next we will need to add some code in the footer.php file.

<div id="footer-area" class="widget-area" role="complementary">
	 <?php dynamic_sidebar( 'footer-area' ) ?>

Other notable functions in case you want to get more advanced.

1 Responses

You must be logged in to post a comment.