Bird
0
0

How do you correctly load a custom header file named header-landing.php in a WordPress theme template?

easy📝 Syntax Q3 of 15
Wordpress - Themes and Appearance
How do you correctly load a custom header file named header-landing.php in a WordPress theme template?
A<?php get_template_part('header-landing'); ?>
B<?php include('header-landing.php'); ?>
C<?php get_header('landing'); ?>
D<?php load_header('landing'); ?>
Step-by-Step Solution
Solution:
  1. Step 1: Use get_header() with a parameter

    The function get_header('landing') loads header-landing.php automatically.
  2. Step 2: Avoid direct includes

    Directly including files is discouraged as it bypasses WordPress template hierarchy and hooks.
  3. Final Answer:

    -> Option C
  4. Quick Check:

    Custom header files use get_header('name') [OK]
Quick Trick: Use get_header('name') to load custom headers [OK]
Common Mistakes:
  • Using include() instead of get_header()
  • Using get_template_part() for header files
  • Calling a non-existent function like load_header()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes