Bird
0
0

You want to add a custom footer template named footer-special.php and load it only on the homepage. Which code snippet correctly achieves this?

hard📝 Application Q9 of 15
Wordpress - Theme Structure and Basics
You want to add a custom footer template named footer-special.php and load it only on the homepage. Which code snippet correctly achieves this?
A<?php get_footer('special'); ?> everywhere
B<?php if (is_front_page()) { get_footer('special'); } else { get_footer(); } ?>
C<?php if (is_home()) { get_footer('special'); } ?>
D<?php get_footer(); ?> and rename footer.php to footer-special.php
Step-by-Step Solution
Solution:
  1. Step 1: Use conditional to check homepage

    Use is_front_page() to detect the homepage in WordPress.
  2. Step 2: Call get_footer() with parameter for special footer

    Call get_footer('special') to load footer-special.php on homepage, else call default get_footer().
  3. Final Answer:

    <?php if (is_front_page()) { get_footer('special'); } else { get_footer(); } ?> -> Option B
  4. Quick Check:

    Conditional footer loading uses get_footer('name') [OK]
Quick Trick: Use conditional and get_footer('name') for custom footers [OK]
Common Mistakes:
  • Calling get_footer('special') everywhere
  • Using is_home() instead of is_front_page() incorrectly
  • Renaming footer.php without calling get_footer('special')

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes