Archive

Posts Tagged ‘Widget Wordpress’

Examples of multiple widget capable areas in themes

May 8, 2012 Leave a comment

File name: FUNCTIONS.PHP

if (function_exists(‘register_sidebar’)) {
register_sidebar(array(
‘name’=> ‘Top Tabs’,
‘id’ => ‘top_tabs’,
‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</li>’,
‘before_title’ => ‘<h2 class=”offscreen”>’,
‘after_title’ => ‘</h2>’,
));
register_sidebar(array(
‘name’=> ‘Top Sidebar’,
‘id’ => ‘top_sidebar’,
‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</li>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’,
));
register_sidebar(array(
‘name’=> ‘Left Sidebar’,
‘id’ => ‘left_sidebar’,
‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</li>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’,
));
register_sidebar(array(
‘name’=> ‘Right Sidebar’,
‘id’ => ‘right_sidebar’,
‘before_widget’ => ‘<li id=”%1$s” class=”widget %2$s”>’,
‘after_widget’ => ‘</li>’,
‘before_title’ => ‘<h3>’,
‘after_title’ => ‘</h3>’,
));
}

RIGHT SIDEBAR:

<?php if (!function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Right Sidebar’)) : ?>
[ do default stuff if no widgets ]
<?php endif; ?>

LEFT SIDEBAR

<?php if (!function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(‘Left Sidebar’)) : ?>
[ do default stuff if no widgets ]
<?php endif; ?>

Categories: Uncategorized Tags: