Codex tools: Log in
Contents |
Includes the sidebar.php template file from your current theme's directory. If a name ($name) is specified then a specialized sidebar sidebar-{name}.php will be included.
If the theme contains no sidebar.php file then the sidebar from the default theme wp-includes/theme-compat/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 one theme.
<?php get_header(); ?>
<?php get_sidebar('left'); ?>
<?php get_sidebar('right'); ?>
<?php get_footer(); ?>
The file names for the right and left sidebars should be sidebar-right.php and sidebar-left.php respectively.
Different sidebar for different pages.
<?php if ( is_home() ) : get_sidebar( 'home' ); elseif ( is_404() ) : get_sidebar( '404' ); else : get_sidebar(); endif; ?>
The file names for the home and 404 sidebars should be sidebar-home.php and sidebar-404.php respectively.
get_sidebar() is located in wp-includes/general-template.php.
Include Tags: get_header(), get_footer(), get_sidebar(), get_template_part(), get_search_form(), comments_template()
Widgets: is_active_widget(), the_widget(), register_widget(), unregister_widget(), wp_register_widget_control(), wp_unregister_widget_control(), wp_convert_widget_settings(), wp_get_widget_defaults(), wp_widget_description()