Bird
0
0

Consider this WordPress theme template snippet:

medium📝 component behavior Q13 of 15
Wordpress - Themes and Appearance
Consider this WordPress theme template snippet:
<?php get_header(); ?>
<main>Content here</main>
<?php get_footer(); ?>

What will be the output on the webpage if header.php contains a <header> with "Welcome" text and footer.php contains a <footer> with "Goodbye" text?
AThe page will show an error because get_header() and get_footer() need parameters
BOnly the main content will show, header and footer are ignored
CThe page will show a header with "Welcome", main content, and a footer with "Goodbye"
DThe page will show "Welcome" and "Goodbye" but no main content
Step-by-Step Solution
Solution:
  1. Step 1: Understand what get_header() and get_footer() do

    They insert the contents of header.php and footer.php respectively into the page.
  2. Step 2: Combine the template parts

    The page will display the header content "Welcome", then the main content, then the footer content "Goodbye".
  3. Final Answer:

    The page will show a header with "Welcome", main content, and a footer with "Goodbye" -> Option C
  4. Quick Check:

    Header + main + footer = D [OK]
Quick Trick: get_header() and get_footer() add their files' content around main [OK]
Common Mistakes:
  • Thinking main content is replaced or ignored
  • Assuming parameters are required for these functions
  • Expecting an error without parameters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes