Headers, footers, and sidebars help organize your website. They keep important parts like menus and info in one place.
Header, footer, and sidebar templates in Wordpress
<?php get_header(); ?> <?php get_sidebar(); ?> <?php get_footer(); ?>
Use get_header() to include the header template.
Use get_sidebar() to include the sidebar template.
Use get_footer() to include the footer template.
<?php get_header(); ?> <!-- Page content here --> <?php get_footer(); ?>
header-custom.php.<?php get_header('custom'); ?>sidebar-blog.php.<?php get_sidebar('blog'); ?>This example shows a simple page that includes the header at the top, the sidebar on the side, and the footer at the bottom. The main content is between them.
<?php
// In your theme's index.php or page template
get_header();
?>
<main>
<h1>Welcome to My Website</h1>
<p>This is the main content area.</p>
</main>
<?php
get_sidebar();
get_footer();
?>Header, footer, and sidebar files are usually named header.php, footer.php, and sidebar.php.
You can create multiple versions by adding a suffix, like header-home.php, and call it with get_header('home').
These templates help keep your site consistent and easier to update.
Headers, footers, and sidebars are reusable parts of your WordPress theme.
Use get_header(), get_sidebar(), and get_footer() to include them.
They make your site organized and easier to maintain.