Codex tools: Log in / create account
Contents |
Includes the sidebar.php template file from your current theme's directory. if a name is specified then a specialised sidebar sidebar-special.php will be included. If the theme contains no sidebar.php file then the sidebar from the default theme wp-content/themes/default/sidebar.php will be included.
<?php get_sidebar( $name ); ?>
The following code is a simple example of a template for an "HTTP 404: Not Found" error (which you could include in your Theme as 404.php).
<?php get_header(); ?> <h2>Error 404 - Not Found</h2> <?php get_sidebar(); ?> <?php get_footer(); ?>
Two sidebars in o theme.
<?php get_header(); ?>
<?php get_sidebar('left'); ?>
<?php get_sidebar('right'); ?>
<?php get_footer(); ?>
Different sidebar for different pages.
<?php
if ( is_home() ) :
get_sidebar('home');
elseif ( is_404() ) :
get_sidebar('404');
else :
get_sidebar();
endif;
?>
Since: 1.5.0
get_sidebar() is located in wp-includes/general-template.php.
get_header, get_sidebar, get_search_form, comments_template, get_footer