Bird
0
0

You want to create a custom footer template named footer-special.php and include it only on the homepage. Which code snippet correctly includes this custom footer in your theme's index.php?

hard📝 Application Q15 of 15
Wordpress - Theme Structure and Basics
You want to create a custom footer template named footer-special.php and include it only on the homepage. Which code snippet correctly includes this custom footer in your theme's index.php?
Aif (is_front_page()) { get_footer('special'); } else { get_footer(); }
Bget_footer('special'); if (is_front_page()) { get_footer(); }
Cget_footer(); if (is_front_page()) { get_footer('special'); }
Dif (is_home()) { get_footer(); } else { get_footer('special'); }
Step-by-Step Solution
Solution:
  1. Step 1: Understand get_footer() with parameters

    Calling get_footer('special') loads footer-special.php. Without parameters, it loads footer.php.
  2. Step 2: Use conditional to check homepage

    is_front_page() returns true on the homepage. So, use it to load the special footer only there, else load default footer.
  3. Step 3: Analyze options

    if (is_front_page()) { get_footer('special'); } else { get_footer(); } correctly uses the conditional to load footer-special.php on homepage and default footer elsewhere. Other options call footers incorrectly or in wrong order.
  4. Final Answer:

    if (is_front_page()) { get_footer('special'); } else { get_footer(); } -> Option A
  5. Quick Check:

    Conditional footer load = C [OK]
Quick Trick: Use get_footer('name') with condition for custom footers [OK]
Common Mistakes:
  • Calling both footers unconditionally
  • Using is_home() instead of is_front_page() for homepage
  • Reversing the conditional logic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes