0
0
Wordpressframework~10 mins

Custom headers and footers in Wordpress - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Custom headers and footers
Start WordPress Theme
Load header.php
Render header content
Load main content
Load footer.php
Render footer content
Page fully rendered
WordPress loads header.php first, then main content, then footer.php to build the full page.
Execution Sample
Wordpress
<?php get_header(); ?>
<main>
  <h1>Welcome</h1>
</main>
<?php get_footer(); ?>
This code loads the header, shows main content, then loads the footer.
Execution Table
StepActionFile LoadedContent RenderedNotes
1Call get_header()header.phpHeader HTML outputHeader template loaded and displayed
2Render main contentN/A<main><h1>Welcome</h1></main>Main page content shown
3Call get_footer()footer.phpFooter HTML outputFooter template loaded and displayed
4Page completeN/AFull page with header, main, footerRendering finished
💡 All parts loaded and page fully rendered
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
header_loadedfalsetruetruetruetrue
footer_loadedfalsefalsefalsetruetrue
page_contentemptyheader HTMLheader + main HTMLheader + main + footer HTMLfull page HTML
Key Moments - 2 Insights
Why does get_header() load header.php and not main content?
get_header() specifically loads header.php as shown in execution_table step 1; main content is separate and rendered after.
Can I customize header.php and footer.php separately?
Yes, header.php and footer.php are separate files loaded independently (steps 1 and 3), so you can edit them individually.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what file is loaded at step 3?
Aheader.php
Bindex.php
Cfooter.php
Dfunctions.php
💡 Hint
Check the 'File Loaded' column at step 3 in execution_table
At which step is the main content rendered?
AStep 2
BStep 1
CStep 3
DStep 4
💡 Hint
Look at the 'Content Rendered' column to find main content rendering
If you remove get_footer() from the code, what changes in variable_tracker?
Aheader_loaded becomes false
Bfooter_loaded stays false, page_content misses footer HTML
Cpage_content becomes empty
Dheader_loaded becomes true later
💡 Hint
Check footer_loaded and page_content changes after step 3 in variable_tracker
Concept Snapshot
WordPress loads header.php with get_header() and footer.php with get_footer().
Main content is rendered between these calls.
Customize header and footer by editing their files.
This builds the full page in order: header, main, footer.
Use these functions to keep theme parts organized.
Full Transcript
In WordPress, pages are built by loading separate parts: header, main content, and footer. The function get_header() loads the header.php file which contains the top part of the page like logo and menu. Then the main content is shown, for example a welcome message inside a main tag. Finally, get_footer() loads footer.php which contains the bottom part like copyright info. This order ensures the page is complete and organized. You can customize header.php and footer.php separately to change how the top and bottom of your site look. The execution table shows each step: first header.php loads, then main content renders, then footer.php loads, and the page is done. Variables track which parts are loaded and how the page content grows. If you remove get_footer(), the footer does not load and the page content misses that part. This method keeps your theme clean and easy to manage.