Header

Globally visible website area displayed on all pages, containing a logo, various navigation areas of unlimited depth, and a search function.

WordPress

patterns/header-fse-1-dynamic.php


patterns/header-fse-2-dynamic.php


patterns/header-fse-3-dynamic.php


patterns/header-1-dynamic.php


patterns/header-2-dynamic.php


patterns/header-3-dynamic.php


patterns/header-4-dynamic.php


patterns/header-5-dynamic.php


patterns/header-6-dynamic.php


patterns/header-6-woo-dynamic.php


patterns/header-checkout-dynamic.php

Figma

Docs

Make sure that navigation menus have a correct accessible name via aria-label. In WordPress, this is derived from the name of the assigned navigation menu.

Customizing

The custom theme defines CSS variables that simplify the visual customization of the custom headers. Alternatively, they can be overridden in the Site Editor using custom CSS. Note that the variables are scoped to the header template part and must therefore be defined in .site-header rather than :root.

Each submenu also has an individual CSS class so that the respective menu can be targeted.

How it works

All header patterns are set up as <div> elements — this is correct, as they are included within a <header> element in the header template part.

Depending on the pattern, the navigation, search, or both are toggled via a toggle button.

Toggle buttons

Two buttons are dynamically rendered via JS:

SelectorIconOpens
.toggle-button-menu#icon-menu (Hamburger)#toggle-container-menu
.toggle-button-search#icon-search (Magnifier)#toggle-container-search

Toggle containers

The containers group all elements that are shown and hidden via a button. Each container has an ID for JS and a class for styling:

  • #toggle-container-menu / .toggle-container-menu
  • #toggle-container-search / .toggle-container-search

Visibility is controlled via aria-hidden, which is set by JS. Submenus work on the same principle.

Breakpoint

The breakpoint for the custom headers is defined as an SCSS variable in globals/_header.scss and simultaneously exported as a CSS custom property. The JS reads --header-breakpoint at runtime and uses matchMedia(). The breakpoint only needs to be changed in one place in the SCSS code.

$header-breakpoint: 50rem; // SCSS for media queries

:root {
  --header-breakpoint: #{$header-breakpoint};
}
Structure of a header pattern with buttons and their corresponding containers. Red = container-search-navigation; Blue = container-search
Structure of a header pattern with buttons and their corresponding containers. Red = toggle-button-menu / toggle-container-menu; Blue = toggle-button-search / toggle-container-search

Miscellaneous

  • We recommend placing the language selector in the footer rather than in the header’s secondary navigation.
  • Skip links are included as a separate pattern (patterns/skiplinks.php) above the header pattern in the template part (header.php). WordPress’s built-in skip links are disabled via functions.php, as they can be extended more effectively in the custom pattern.
Back to top