Bird
0
0

You want to create a WordPress theme where the header shows a different logo on the homepage and another logo on all other pages. Which is the best way to customize the header for this?

hard📝 state output Q15 of 15
Wordpress - Themes and Appearance
You want to create a WordPress theme where the header shows a different logo on the homepage and another logo on all other pages. Which is the best way to customize the header for this?
ACreate two header files: <code>header-home.php</code> and <code>header.php</code>, then use <code>get_header()</code> or <code>get_header('home')</code> conditionally
BAdd both logos in <code>header.php</code> and use CSS to hide/show based on page
CUse JavaScript to swap logos after the page loads
DCreate a footer file with the logos and include it instead of header
Step-by-Step Solution
Solution:
  1. Step 1: Understand conditional header loading

    WordPress allows loading different header files using get_header('name').
  2. Step 2: Apply conditional logic in template

    Use PHP to check if it is the homepage, then call get_header('home'), else get_header().
  3. Step 3: Organize header files

    Create header-home.php with the homepage logo and header.php with the default logo.
  4. Final Answer:

    Create two header files: header-home.php and header.php, then use get_header() or get_header('home') conditionally -> Option A
  5. Quick Check:

    Conditional header files = C [OK]
Quick Trick: Use get_header('home') for homepage, get_header() for others [OK]
Common Mistakes:
MISTAKES
  • Trying to swap logos only with CSS or JavaScript
  • Putting logos in footer instead of header
  • Not using conditional PHP logic for headers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes