Bird
0
0

What will be the output of this code snippet in a WordPress theme?

medium📝 component behavior Q4 of 15
Wordpress - Themes and Appearance
What will be the output of this code snippet in a WordPress theme?
wp_nav_menu(array('theme_location' => 'header-menu'));

Assuming 'header-menu' is registered and assigned a menu with two items: Home and About.
AA plain text list of menu item names
BAn HTML list with links to Home and About pages
CAn error message saying menu not found
DNothing will display because the function is incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Understand wp_nav_menu output

    This function outputs an HTML unordered list with menu items as links.
  2. Step 2: Confirm menu registration and assignment

    Since 'header-menu' is registered and assigned, the menu items Home and About will appear as links.
  3. Final Answer:

    An HTML list with links to Home and About pages -> Option B
  4. Quick Check:

    wp_nav_menu outputs HTML list = An HTML list with links to Home and About pages [OK]
Quick Trick: wp_nav_menu outputs HTML lists of menu links [OK]
Common Mistakes:
MISTAKES
  • Expecting plain text instead of HTML
  • Assuming error if menu exists
  • Thinking function name is incorrect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Wordpress Quizzes