Lesson 20 of 50
40% Complete
40%

Create a Header and Footer in WordPress

A header and footer are important parts of a website layout. The header usually contains the logo and navigation menu, while the footer contains copyright information, contact details and useful links.

Learning Objective: Learn how to create and customize website headers and footers using the WordPress Site Editor, classic theme options and custom theme files.

1. What Is a Website Header?

A header is the top section of a website. It commonly appears across multiple pages and helps visitors identify the website and navigate to important sections.

Example Website Header

SOOPRO PATHSHALA

Learn. Practice. Grow.
Home Courses Tutorials Contact

Common Header Elements

  • Website logo
  • Site title and tagline
  • Navigation menu
  • Search icon or search form
  • Login, admission or contact button

2. What Is a Website Footer?

A footer is the bottom section of a website. It provides additional information and links that visitors may need.

Example Website Footer
About Us

Computer education and programming tutorials.

Quick Links

Home | Courses | Tutorials

Contact

Email, phone and address information.


© 2026 Soopro Pathshala. All rights reserved.

Common Footer Elements

  • Copyright notice
  • Contact information
  • About us link
  • Privacy policy and terms links
  • Social media links
  • Additional navigation links

3. Header and Footer: Difference

Feature Header Footer
Position Usually at the top Usually at the bottom
Main Purpose Branding and navigation Additional information and links
Typical Content Logo, menu and buttons Copyright, contact and policies
Appearance Often visible immediately Usually appears after page content

4. Create a Header Using a Block Theme

Block themes let you edit website layouts through the WordPress Site Editor. The header is commonly managed as a template part.

Steps to Edit the Header
  1. Log in to your WordPress dashboard.
  2. Open Appearance → Editor.
  3. Open the template parts or navigation area, depending on your WordPress version.
  4. Select the Header template part.
  5. Add or edit the Site Logo, Site Title and Navigation blocks.
  6. Adjust alignment, colors and spacing using available settings.
  7. Preview the changes and click Save.
Note: The exact editor controls depend on your WordPress version and active theme. Some themes provide predefined header layouts.

5. Create a Footer Using a Block Theme

In a block theme, the footer can usually be edited in the Site Editor using a Footer template part.

Steps to Edit the Footer
  1. Open Appearance → Editor.
  2. Find the Footer template part.
  3. Add a Group or Columns block if you need a layout.
  4. Add Paragraph blocks for contact and copyright information.
  5. Add Navigation blocks for useful links.
  6. Customize colors and alignment.
  7. Preview and save your changes.

6. Customize Headers and Footers in Classic Themes

Classic themes may provide header and footer settings in the Customizer, theme options or widget areas. Some classic themes require template-file editing for advanced changes.

Header Options
  • Logo and site title
  • Navigation menu
  • Header background
  • Header layout and spacing
Footer Options
  • Footer widget areas
  • Copyright text
  • Footer navigation
  • Background and text colors

To check available options, open the Customizer or theme settings. The menu names and available controls vary from theme to theme.

7. Understanding WordPress Header and Footer Files

Developers working with classic WordPress themes may use PHP template files to build a reusable header and footer.

Common Classic Theme Files
File Purpose
header.php Contains the shared header markup.
footer.php Contains the shared footer markup.
functions.php Registers theme features and functions.
style.css Contains the theme stylesheet and theme metadata.
index.php Provides a main template fallback in classic themes.
Important: Do not assume every WordPress theme uses the same file structure. Block themes often define layouts using HTML files in a templates directory and block template parts in parts. Avoid editing a parent theme directly because updates may overwrite your changes.

8. Example: A Basic Classic Theme Header

The following is a simplified example for a classic WordPress theme. It demonstrates how a theme can display its title and registered navigation menu.

header.php

Example code for a classic theme's template file:

<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
    <meta charset="<?php bloginfo('charset'); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>
<?php wp_body_open(); ?>

<header class="site-header">
    <div class="site-branding">
        <?php if (has_custom_logo()) {
            the_custom_logo();
        } else { ?>
            <a href="<?php echo esc_url(home_url('/')); ?>">
                <?php bloginfo('name'); ?>
            </a>
        <?php } ?>
    </div>

    <nav class="main-navigation">
        <?php
        wp_nav_menu(array(
            'theme_location' => 'primary',
            'fallback_cb' => false
        ));
        ?>
    </nav>
</header>

Explanation: This example uses WordPress template functions to display the site branding and a registered menu. The theme must register the primary menu location for the menu to appear.

9. Example: A Basic Classic Theme Footer

The footer template commonly contains the footer content and required WordPress footer hooks.

footer.php
<footer class="site-footer">
    <p>
        &copy; <?php echo esc_html(date('Y')); ?>
        <?php bloginfo('name'); ?>.
        All rights reserved.
    </p>
</footer>

<?php wp_footer(); ?>
</body>
</html>

Explanation: The code displays the current year and website name. The wp_footer() hook allows WordPress and plugins to output scripts and other footer content.

These PHP examples are for classic theme development, not for pasting into a normal WordPress page or post. They are simplified examples; a complete theme also needs the appropriate setup, styles, menu registration and template structure.

10. Add CSS Styling to the Header and Footer

In a classic theme, CSS can control the appearance of the header and footer. Add the styles to your theme stylesheet or an appropriate custom CSS area.

Example CSS
.site-header {
    background-color: #0f172a;
    color: #ffffff;
    padding: 20px;
}

.site-header a {
    color: #ffffff;
    text-decoration: none;
}

.site-footer {
    background-color: #212529;
    color: #ffffff;
    padding: 25px;
    text-align: center;
}

.site-footer a {
    color: #f8f9fa;
}

@media (max-width: 768px) {
    .site-header,
    .site-footer {
        padding: 15px;
    }
}

Note: These styles apply to the example class names shown above. Your theme's HTML and CSS classes may be different.

11. Best Practices

  • Keep the header simple and make navigation easy to understand.
  • Use a readable logo and consistent brand colors.
  • Keep footer links organized into useful groups.
  • Check the layout on desktop, tablet and mobile screens.
  • Ensure menus and buttons have working links.
  • Use accessible labels and sufficient text contrast.
  • Back up your website before making significant changes.
  • Use a child theme for custom PHP or CSS changes to a classic theme.
  • Preview changes before publishing them.

12. Practical Assignment

Activity: Create a Professional Header and Footer

Use your WordPress website to complete these tasks:

  1. Choose a theme that supports your desired layout.
  2. Add your website logo and site title.
  3. Create a navigation menu with Home, Courses, About and Contact.
  4. Customize the header colors and spacing.
  5. Add contact information and useful links to the footer.
  6. Add a copyright notice with the current year.
  7. Check the header and footer on a mobile screen.
  8. Save your changes and test all navigation links.

Challenge: Create a header with a logo, navigation menu and admission button, plus a three-column footer for a computer training institute.

Lesson Summary

  • A header appears at the top and usually contains branding and navigation.
  • A footer appears at the bottom and contains additional information and links.
  • Block themes commonly use the Site Editor and template parts.
  • Classic themes may use the Customizer, widgets and PHP template files.
  • header.php and footer.php are common classic theme files.
  • The wp_head() and wp_footer() hooks support WordPress and plugin functionality.
  • Always test your layout on different screen sizes.

Lesson 20 Quiz

Choose the correct answer for each question.

Q1. What is the main purpose of a website header?
Q2. Which file commonly contains a classic theme's footer markup?
Q3. Which WordPress hook is commonly used before the closing body tag?