Complete the code to include the header template in a WordPress theme.
<?php [1]('header'); ?>
In WordPress themes, get_header() is used to include the header template.
Complete the code to include the footer template in a WordPress theme.
<?php [1]('footer'); ?>
The correct function to include the footer template in WordPress is get_footer().
Fix the error in the code to properly enqueue a custom stylesheet for the header.
function theme_styles() {
wp_enqueue_style('custom-header', get_template_directory_uri() . '/css/[1]');
}
add_action('wp_enqueue_scripts', 'theme_styles');The correct filename must include the extension .css and match the actual file name, here header-style.css.
Fill both blanks to register and enqueue a custom footer script in WordPress.
function add_footer_script() {
wp_register_script('footer-script', get_template_directory_uri() . '/js/[1]', array(), null, [2]);
wp_enqueue_script('footer-script');
}
add_action('wp_enqueue_scripts', 'add_footer_script');The script file is usually named footer.js and the last parameter true loads the script in the footer.
Fill all three blanks to create a custom header template part and include it in the theme.
<?php
// In functions.php
function register_custom_header() {
register_nav_menus(array(
'[1]' => __('[2]', 'theme-textdomain'),
));
}
add_action('init', 'register_custom_header');
// In header.php
wp_nav_menu(array('theme_location' => '[3]'));
?>The menu location slug and the theme_location parameter must match. The display name is a readable string.