WordPress.org

Support

Support » How-To and Troubleshooting » Get sidebar for same category

Get sidebar for same category

  • Hello…

    I have the following code:

    if(function_exists(‘register_sidebar’)) {
    foreach((array)(get_categories()) as $category) {
    register_sidebar(array(
    ‘name’ => ”.$category->cat_name,
    ‘before_widget’ => ‘<div id=”%1$s” class=”%2$s widget”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h3 class=”widget-title”>’,
    ‘after_title’ => ‘</h3>’, ));
    }
    }

    this code create a sidebar with the same name of the categories created in my site… which code I use to load each page sidebar categories in each category.

    Any help is much appreciated.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get sidebar for same category’ is closed to new replies.
Skip to toolbar