Skip to content

Instantly share code, notes, and snippets.

@misterebs
Created September 29, 2016 04:21
Show Gist options
  • Save misterebs/acb15934f220ffbcc193e65484feb995 to your computer and use it in GitHub Desktop.
Save misterebs/acb15934f220ffbcc193e65484feb995 to your computer and use it in GitHub Desktop.
Dynamic multiple widget area
// Custom Widget Area
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name' => 'Sidebar 1',
'id' => 'sidebar1',
'description' => 'This is the widgetized sidebar1',
'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h1>',
'after_title' => '</h1>'
));
register_sidebar(array(
'name' => 'Sidebar 2',
'id' => 'sidebar2',
'description' => 'This is the widgetized sidebar2.',
'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>'
));
}
Insert this code in loop to control of display
<?php if (function_exists('dynamic_sidebar') && dynamic_sidebar('team1')) : else : ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment