Help creating widgets for each category
Hi, I'm trying to create separated widgets for each ad category, I'm doing it like it's explained here:
http://bavotasan.com/2012/create-wid...-in-wordpress/
The say that I should add this to functions.php
------------------------------------------------------------------------------------
add_action( 'widgets_init', 'category_sidebars' );
/**
* Create widgetized sidebars for each category
*
* This function is attached to the 'widgets_init' action hook.
*
* @uses register_sidebar()
* @uses get_categories()
* @uses get_cat_name()
*/
function category_sidebars() {
$categories = get_categories( array( 'hide_empty'=> 0 ) );
foreach ( $categories as $category ) {
if ( 0 == $category->parent )
register_sidebar( array(
'name' => $category->cat_name,
'id' => $category->category_nicename . '-sidebar',
'description' => 'This is the ' . $category->cat_name . ' widgetized area',
'before_widget' => '<aside id="%1$s" class="widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
}
------------------------------------------------------------------------------------
Widgets appear when I do that but the widgets created are for the general posts categories, I want to create Ads categories, I don't know where in this code i have to specify that i just want ads categories.
Please help!!