This tutorial will show you how to create new widget area in WordPress. Any widget in WordPress template could be displayed in any place on the page. This could be done using WordPress widget areas.


To add widget area access to your WordPress installation folder.

1. Open ‘wp-content/themes/theme###’ folder.

2. View the functions.php file

3. Use search tool (CTRL+F) and search for ‘widget’. You can fund the following lines:

Here you can see that widgets are defined in the sidebar-init.php file

	//Widget and Sidebar
	require_once $includes_path . 'sidebar-init.php';

This line defines the $includes_path variable value.

	$includes_path = TEMPLATEPATH . '/includes/';

These lines shows you that the widgets are defined in the wp-content/themes/theme###/includes/sidebar-init.php file

4. Open sidebar-init.php file. All widget areas are defined here. The following code is used to define wach area:

			'name' 			=> 'Sidebar 2',
			'id'			=> 'sidebar-2',
			'description'	=> __( 'Located at the right side of pages.'),
			'before_widget'	=> '<div id="%1$s">',
			'after_widget'	=> '</div>',
			'before_title'	=> '<h3>',
			'after_title'	=> '</h3>',

To register new widget area copy the code above and paste it before the closing ‘}’ bracket

Change the ‘name’, ‘id’ and ‘description’ values.


5. Now you can insert the widget area to any part of the template. Go back to the ‘wp-content/themes/theme###‘ folder. You can insert the area to any layout file:

  • header.php
  • footer.php
  • single.php
  • category.php
  • index.php
  • sidebar.php etc

6. Paste the following code to the required place to insert the widget area.

	<?php if ( ! dynamic_sidebar( 'New Widget Area' ) )


 ><?php endif;?>

Replace ‘New Widget Area’ with your widget area name.

7. If everything has been done correctly the new widget area would be available from the WordPress admin panel Appearance>Widgets (right column) .