Theme for Wordpress: The sidebar
The side panel can be populated statically by tags in the sidebar.php file or dynamically with widgets, chosen from the admistering panel.
In fact as soon as you place a widget in the sidebar, all the static tags defined inside it are ignored.
The file structure is a forced choice, it is that Wordpress generate for widgets. So that the widgets and components defined statically have the same appearance, they must be given the same hierarchy of tags.
<div id="leftside"> <?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar() ) :
?> <?php if ( !is_front_page() || is_paged() ) { ?>
<li class="widget">
<a href="<?php bloginfo('home') ?>"> <?php _e('Home', ''); ?> </a>
</li>
<?php } ?> <li class="widget"><?php _e('Meta', '') ?>
<ul> <?php wp_register() ?> <li><?php wp_loginout() ?></li> <?php wp_meta()?> </ul>
</li> <?php endif; ?> </div> // End of leftside
The side panel is identified by the name "leftside".
The two following markers define the widgets area. All that is placed between them will be removed and replaced by the code of widgets that are chosen through the administering panel.
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : endif;
Each element of sidebar has the following structure:
<li class="widget"> <ul> <li> </li> ... list of items ... </ul> </li>
The structure is automatically generated for the widgets and is reproduced to static elements, to share the same stylesheet.
The list of items within an element may be replaced by another tag. In the case of a cloud of tags, it is replaced by a paragraph tag.
<li class="widget"><?php _e('Tags', '') ?>
<ul id="tag-cloud">
<p><?php wp_tag_cloud() ?></p>
</ul>
</li>
The meta element to connect to the site is flanked by two PHP markers:
<?php wp_register() ?> <li><?php wp_loginout() ?></li> <?php wp_meta()?>
Our definition of sidebar is optimal. It allows you to use a single style sheet for this simplified hierarchy of tags.
Additional Elements
Other elements are provided by Wordpress which can be added as an option.
The calendar of archives
<li class="widget">Archives
<?php get_calendar(); ?>
</li>
It is generated by Wordpress in a table.
Search form
<li class="widget">
<?php _e('Tag Search', '') ?> <form id="searchform" method="get" action="<?php bloginfo('home') ?>"> <input type="text" value="<?php the_search_query() ?>" size="12" /> <input type="submit" value="<?php _e('Search', '') ?>" /> </form>
</li>
It displays the list of results on the home page.
Documentation