WordPress Theme: Sidebar
The sidebar can be statically populated with tags in the sidebar.php file or dynamically with widgets selected from the administration panel.
In fact, once you place a widget without sidebar, static beacons are ignored.
File structure is a must-choose, it is the one that generates WordPress for widgets. So widgets and statically defined elements have the same look, they must have the same tag hierarchy.
<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 sidebar is identified by the name "leftside."
The next two markers define the widget scope. Everything we put between them will be removed and replaced with the widget code selected in the admin panel.
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : endif;
Each sidebar element has the following structure:
<li class="widget"> <ul> <li> </li> ...liste d'items... </ul> </li>
It is a structure automatically created for widgets, and it is used for static elements to share the same stylesheet.
You can replace the list of items in a panel item with another tag. In the case of a tag cloud, 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 for connecting to the site is framed 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 one simplified style sheet for this tag hierarchy.
Additional elements
Other items are provided by WordPress that can be added as an option.
Archiving Schedule
<li class="widget">Archives
<?php get_calendar(); ?>
</li>
It is generated by Wordpress in a table .
Internal 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 lists of results on the home page.
Useful documentation