Complete the code to declare a custom page template in WordPress.
<?php
/*
Template Name: [1]
*/
?>The Template Name comment defines the name of the custom page template shown in WordPress admin.
Complete the code to load the header in a custom page template.
<?php
get_[1]();
?>The get_header() function loads the header.php template part.
Fix the error in the loop to display page content in a custom template.
<?php if ( have_posts() ) : while ( [1]() ) : the_post(); the_content(); endwhile; endif; ?>
The have_posts() function checks if there are posts to loop through.
Fill both blanks to correctly enqueue a stylesheet in a custom page template.
<?php
function custom_template_styles() {
wp_enqueue_style( '[1]', get_template_directory_uri() . '/css/[2].css' );
}
add_action( 'wp_enqueue_scripts', 'custom_template_styles' );The first blank is the handle name for the stylesheet, and the second is the CSS file name without extension.
Fill all three blanks to create a custom page template that loads header, footer, and displays the page title.
<?php /* Template Name: Custom Page */ get_[1](); if ( have_posts() ) : while ( have_posts() ) : the_post(); echo '<h1>' . get_[2]() . '</h1>'; endwhile; endif; get_[3](); ?>
This template loads the header, shows the page title, and then loads the footer.