How to Replace a WordPress Classic-Theme Header
Use a supported theme hook or child-theme override, preserve critical WordPress hooks, and avoid replacing the document shell with a demo fragment.
Updated 2026-10-09Classic themes do not all share the same header structure. A safe replacement begins with the active theme’s documentation and a staging copy. The browser-only header examples in this library supply a visible component; they do not supply your theme’s entire PHP document shell.
Prefer a supported theme integration
Check whether the theme exposes a documented header builder, hook, or template override. A supported hook may let you replace the visible header while preserving the document structure and other theme functions. Use the actual hook and removal callback documented by your theme; there is no universal header hook that works in every classic theme.
If no supported route exists, a developer may need a compatible child-theme template override. Read the official classic template-file guide and the parent theme’s integration instructions. Do not edit the parent directly, because updates can overwrite the change.
Preserve the document shell
The theme’s header file may include the doctype, HTML attributes, head content, wp_head(), opening body, wp_body_open(), wrappers, and a skip link. Removing these to paste a short header fragment can prevent scripts and styles from loading, break plugin behavior, or damage accessibility.
Copy the correct parent template into a child theme only when that override is compatible. Replace the intended visible header portion while preserving required hooks and structure. This guide cannot provide a drop-in header.php for an unidentified theme. A static browser fragment is not enough information to reconstruct its shell safely.
The glass header and static header tutorials explain their own visible markup and behavior. Use them as components inside a proper theme-specific integration, not as complete PHP templates.
Load styles and scripts properly
Keep the snippet’s stylesheet and optional script in the child theme and enqueue them through WordPress’s APIs. Use unique handles, actual file paths, and suitable versions. The official asset guidance describes enqueueing; the parent theme’s dependencies must be checked rather than guessed.
Our JavaScript guide provides an illustrative local-file enqueue. The CSS guide explains selector scope and theme overrides. Additional CSS can style existing markup but cannot replace the global header by itself.
Decide how menus are managed
The downloadable examples contain static links. Replace them with real URLs if you keep that variant. For a dynamic classic-theme integration, use the appropriate registered menu location and a deliberate wp_nav_menu configuration. Its generated list markup and classes may differ from the demo.
Adapt CSS and disclosure behavior to the actual output. Do not assume that swapping in a WordPress menu automatically preserves the sample IDs, ARIA relationships, or open-state selectors. The responsive navigation component explains the behavior you need to preserve.
Test the whole theme
Inspect the home page, a post, a standard page, an archive, and any custom templates affected by the replacement. Confirm that there is one header, the document structure remains intact, and plugin assets still load. Test both logged-in and logged-out views.
For sticky or fixed positioning, account for the admin toolbar and any content spacer. A static header should scroll away normally without leaving an old fixed-header gap. Keep visible keyboard focus, real link destinations, a working mobile disclosure, and the original skip-link route.
Unsupported integrations and rollback
If the theme has no documented hook and a compatible child override has not been reviewed, label the installation unsupported rather than advising a risky generic replacement. A page-level demonstration can still help you assess the design without changing the global header.
Retain the original template and the exact enqueue changes. Restore them if the integration breaks. Real WordPress theme testing has not been performed in this repository; browser screenshots and code checks validate the component, not every parent-theme boundary.
If your active theme is actually a block theme, use the Header template-part guide instead. The different architecture requires a different replacement path.


