jebu1104
9/24/2015 - 12:34 PM

create new widget area http://premium.wpmudev.org/blog/how-to-widgetize-a-page-post-header-or-any-other-template-in-wordpress/

Step 1: Register the widget areas in your functions.php file:

You should see this:

1
2
3
4
5
6
7
8
9
10
11
12
13
if ( function_exists('register_sidebar') ) {
register_sidebar(array(
'before_widget' => '
<ul>
    <li id="%1$s" class="widget %2$s">',
'after_widget' => '</li>
</ul>
',
'before_title' => '
<h2 class="widgettitle">',
'after_title' => '</h2>
',
));
Beneath it, register your two new widget areas by adding this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
register_sidebars( 1,
array(
'name' => 'widgetized-page-top',
'before_widget' => '
<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>
',
'before_title' => '
<h2 class="widgettitle">',
'after_title' => '</h2>
'
)
);

register_sidebars( 1,
array(
'name' => 'widgetized-page-bottom',
'before_widget' => '
<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>
',
'before_title' => '
<h2 class="widgettitle">',
'after_title' => '</h2>
'
)
);
Step 2: Save a copy of your page.php and give it a different name. Then add this to the top so that WordPress recognizes it as a new page template:

1
2
3
4
<!--?php <br ?--> /*
Template Name: Widgetized Page
*/
?&gt;
Step 3: Add the widgets to your new page template inside the content div, just below (or above, if you’d rather) the php that calls the page content:

1
2
3
4
5
<!--?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("widgetized-page-top") ) : ?-->
<!--?php endif; ?-->

<!--?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("widgetized-page-bottom") ) : ?-->
<!--?php endif; ?-->
You can of course split those up and put static or dynamic content in between your multiple widgets. They just need to contain these basic elements.