You want to override a parent theme's footer.php but also include the parent's footer content inside your child theme's footer. How should you do this?
hard📝 Application Q8 of 15
Wordpress - Theme Structure and Basics
You want to override a parent theme's footer.php but also include the parent's footer content inside your child theme's footer. How should you do this?
ACreate <code>footer.php</code> in child theme and call <code>get_template_part('footer', 'parent')</code>
BCreate <code>footer.php</code> in child theme and call <code>include( get_template_directory() . '/footer.php' );</code> inside it
CCreate <code>footer.php</code> in child theme and call <code>get_template_part('footer', null, ['parent'])</code>
DCreate <code>footer.php</code> in child theme and call <code>get_template_part('footer', '', ['parent'])</code>
Step-by-Step Solution
Solution:
Step 1: Understand how to load parent template specifically
Use get_template_directory() . '/footer.php' to get the parent footer path directly.
Step 2: Include parent's footer inside child footer
Inside child footer.php, call include( get_template_directory() . '/footer.php' ); to include parent's footer content.
Final Answer:
Create footer.php in child theme and call include( get_template_directory() . '/footer.php' ); inside it -> Option B
Quick Check:
include parent footer path directly [OK]
Quick Trick:Use include( get_template_directory() . '/footer.php' ) to include parent footer [OK]
Common Mistakes:
Using incorrect parameters for get_template_part
Expecting get_template_part to load parent automatically without call
Trying to pass parent as argument incorrectly
Master "Theme Structure and Basics" in Wordpress
9 interactive learning modes - each teaches the same concept differently