header.php file. What will the visitor see in the browser's header area?<?php
function custom_header_text() {
echo '<h1>Welcome to My Site</h1>';
}
add_action('wp_head', 'custom_header_text');
?>The wp_head action runs inside the HTML <head> tag. Echoing HTML here places content inside the head, which browsers do not display in the page body. So the heading text is not visible on the page.
functions.php to customize the footer. What will the visitor see at the bottom of the page?<?php
function add_custom_footer() {
echo '<p>Ā© 2024 My Company</p>';
}
add_action('wp_footer', 'add_custom_footer');
?>The wp_footer action runs just before the closing </body> tag. Echoing HTML here adds content visible at the bottom of the page.
The function register_nav_menus accepts an array of menu locations. Option D correctly passes an array with the key as the location slug and value as the description.
functions.php. Why does the site show a blank page after adding it?<?php add_action('wp_footer', 'custom_footer'); function custom_footer() { echo '<p>Footer Text</p>'; } ?>
PHP requires a semicolon at the end of each statement. Missing it after the echo causes a parse error, resulting in a blank page.
Editing the parent theme files directly (Option A) risks losing changes on updates. Using a child theme (Option A) is the recommended way to safely customize templates like header and footer.