Consider this WordPress custom page template code snippet. What will be the visible output on the page when this template is assigned?
<?php
/* Template Name: Simple Greeting */
get_header();
?>
<h1>Hello, welcome to my site!</h1>
<?php get_footer(); ?>Remember that get_header() and get_footer() include the site's header and footer sections.
This template includes the header and footer using WordPress functions, so the page will display the header, the heading text, and the footer.
Which option correctly fixes the syntax error in this WordPress custom page template header comment?
<?php
/* Template Name: My Custom Page
get_header();
?>The template name comment must be properly closed with */.
The opening comment /* must be closed with */ for WordPress to recognize the template name and for PHP syntax to be valid.
Given this WordPress custom page template code, what will be the output if the page has a custom field 'show_message' set to 'yes'?
<?php /* Template Name: Conditional Message */ get_header(); if (get_post_meta(get_the_ID(), 'show_message', true) === 'yes') { echo '<p>Special message is shown!</p>'; } else { echo '<p>No special message.</p>'; } get_footer(); ?>
Check the condition that compares the custom field value to 'yes'.
If the custom field 'show_message' equals 'yes', the template echoes the special message between header and footer.
This custom page template is assigned to a page, but the page content does not appear. What is the most likely cause?
<?php
/* Template Name: Missing Content */
get_header();
// Missing the_content() function call
get_footer();
?>Think about how WordPress outputs the main page content inside templates.
Without calling the_content(), the main content of the page will not be shown in the template.
Which statement best describes how WordPress selects a custom page template for a page?
Think about how WordPress admin lets you pick a template for a page.
WordPress uses the template assigned to the page in the admin, matching it to a file with the correct template name comment.