sidebar.php
Description: The default sidebar.
This template is included by:
Template Code
<div id="sidebar">
<ul>
<?php /* Widgetized sidebar, if you have the plugin installed. */
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<li>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
</li>
<!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.
<li><h2>Author</h2>
<p>A little something about you, the author. Nothing lengthy, just an overview.</p>
</li>
-->
<?php if ( is_404() || is_category() || is_day() || is_month() ||
is_year() || is_search() || is_paged() ) {
?> <li>
<?php /* If this is a 404 page */ if (is_404()) { ?>
<?php /* If this is a category archive */ } elseif (is_category()) { ?>
<p>You are currently browsing the archives for the <?php single_cat_title(''); ?> category.</p>
<?php /* If this is a yearly archive */ } elseif (is_day()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives
for the day <?php the_time('l, F jS, Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives
for <?php the_time('F, Y'); ?>.</p>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<p>You are currently browsing the <a href="<?php bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives
for the year <?php the_time('Y'); ?>.</p>
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
<p>You have searched the <a href="<?php echo bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives
for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
<?php /* If this is a monthly archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<p>You are currently browsing the <a href="<?php echo bloginfo('url'); ?>/"><?php echo bloginfo('name'); ?></a> blog archives.</p>
<?php } ?>
</li> <?php }?>
<?php wp_list_pages('title_li=<h2>Pages</h2>' ); ?>
<li><h2>Archives</h2>
<ul>
<?php wp_get_archives('type=monthly'); ?>
</ul>
</li>
<?php wp_list_categories('show_count=1&title_li=<h2>Categories</h2>'); ?>
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
<?php wp_list_bookmarks(); ?>
<li><h2>Meta</h2>
<ul>
<?php wp_register(); ?>
<li><?php wp_loginout(); ?></li>
<li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
<li><a href="http://gmpg.org/xfn/"><abbr title="XHTML Friends Network">XFN</abbr></a></li>
<li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress</a></li>
<?php wp_meta(); ?>
</ul>
</li>
<?php } ?>
<?php endif; ?>
</ul>
</div>
This template includes the following tags:
bloginfo()is a WordPress function that displays information about your blog. Using various parameters, the function can display the following strings:- Blog title;
- Blog tagline;
- Administrator's email address;
- Document content-type;
- Document charset;
- WordPress version;
- Blog URL;
- Pingback URL;
- URL of the RSS 0.92, RSS 1.0, RSS 2.0, or Atom feed;
- URL of the comments feed;
- URL of the directory in which WordPress is installed;
- URL of the current template's directory;
- URL of the current
style.cssfile; - URL of the stylesheet directory (deprecated)
dynamic_sidebar()is a WordPress tag which creates the widgetized sidebar.is_404()is a conditional tag which returns true if an HTTP 404 error has occured.is_category()is a WordPress conditional tag which returns TRUE when a Category page is being displayed.is_day()is a Wordpress conditional tag which returns true when a daily archive is being displayed.is_day()is a Wordpress conditional tag which returns true when a daily archive is being displayed.is_home()is a conditional tag which returns true on the main blog page.is_month()is a Wordpress conditional tag which returns true when a monthly archive is being displayed.is_page()is a Wordpress conditional tag that returns TRUE when a Page is being displayed.is_paged()is a Wordpress conditional tag which returns TRUE when the page being displayed is "paged," as with an archive or the main page (but not a Post or Page divided into pages using the <!--nextpage--> QuickTag.is_search()is a Wordpress conditional tag which returns TRUE when search results are being displayed.is_year()is a Wordpress conditional tag which returns true when a yearly archive is being displayed.single_cat_title()is a WordPress tag which displays or returns the category title for the current page.- the_search_query() is a WordPress tag which displays the search query for the current request, if a search has been made.
the_time()is a WordPress tag which displays the time of the current post. This tag must be used within The Loop.wp_get_archives()is a WordPress tag which displays a list of archives in chronological order. It replaces get_archives(), which has been deprecated.wp_list_bookmarks()is a WordPress tag which displays the blogroll.wp_list_categories()is a WordPress tag which displays a list of categories. It replaces the deprecatedlist_cats()andwp_list_cats().wp_list_pages()is a WordPress tag which displays a list of WordPress pages.wp_loginout()Displays a login or logout link, depending on whether the user is currently logged in.wp_metais an Action Hook necessary for the functioning of some plugins.wp_register()is a WordPress tag which displays a "Register" or "Site Admin" link, depending on whether the user is logged in.
HTML Skeleton
<div id="sidebar">
<ul>
<li>
[SEARCHFORM.PHP]
</li>
<!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.
<li>
<h2>Author</h2>
<p>A little something about you, the author. Nothing lengthy, just an overview.</p>
</li>
-->
<li class="pagenav">
<h2>Pages</h2>
<ul>
<li class="page_item page-item-[#]">[ITEM]
<ul>
<li class="page_item page-item-[#]">[ITEM]</li>
</ul>
</li>
</ul>
</li>
<li>
<h2>Archives</h2>
<ul>
<li>[ITEM]</li>
</ul>
</li>
<li class="categories">
<h2>Categories</h2>
<ul>
<li class="cat-item cat-item-[#]">[ITEM]</li>
</ul>
</li>
<li>
<h2>Meta</h2>
<ul>
<li>[ITEM]</li>
</ul>
</ul>
</div>
Related CSS Styles
/* Begin Typography & Colors */
body {
font-size: 62.5%; /* Resets 1em to 10px */
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
background: #d5d6d7 url('images/kubrickbgcolor.jpg');
color: #333;
text-align: center;
}
#page {
background-color: white;
border: 1px solid #959596;
text-align: left;
}
#sidebar h2 {
font-family: 'Lucida Grande', Verdana, Sans-Serif;
font-size: 1.2em;
}
h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar h2, #wp-calendar caption, cite {
text-decoration: none;
}
#sidebar {
font: 1em 'Lucida Grande', Verdana, Arial, Sans-Serif;
}
small, #sidebar ul ul li, #sidebar ul ol li, .nocomments, .postmetadata, blockquote, strike {
color: #777;
}
/* Begin Structure */
body {
margin: 0 0 20px 0;
padding: 0;
}
#page {
background-color: white;
margin: 20px auto;
padding: 0;
width: 760px;
border: 1px solid #959596;
}
/* Begin Headers */
#sidebar h2 {
margin: 5px 0 0;
padding: 0;
}
/* Begin Form Elements */
#searchform {
margin: 10px auto;
padding: 5px 3px;
text-align: center;
}
#sidebar #searchform #s {
width: 108px;
padding: 2px;
}
#sidebar #searchsubmit {
padding: 1px;
}
/* Begin Lists */
.entry ul li:before, #sidebar ul ul li:before {
content: "\00BB \0020";
}
#sidebar ul, #sidebar ul ol {
margin: 0;
padding: 0;
}
#sidebar ul li {
list-style-type: none;
list-style-image: none;
margin-bottom: 15px;
}
#sidebar ul p, #sidebar ul select {
margin: 5px 0 8px;
}
#sidebar ul ul, #sidebar ul ol {
margin: 5px 0 0 10px;
}
#sidebar ul ul ul, #sidebar ul ol {
margin: 0 0 0 10px;
}
ol li, #sidebar ul ol li {
list-style: decimal outside;
}
#sidebar ul ul li, #sidebar ul ol li {
margin: 3px 0 0;
padding: 0;
}
/* Begin Sidebar */
#sidebar
{
padding: 20px 0 10px 0;
margin-left: 545px;
width: 190px;
}
#sidebar form {
margin: 0;
}
Resources
- N/A