Home > Uncategorized > Examples of multiple widget capable areas in themes

Examples of multiple widget capable areas in themes

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; ?>

Advertisements
Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: