WordPress Creating a custom template Custom template with content


Example

We will further extend our template and include title of the page and a content

<?php
/*
Template Name: Example
*/
get_header();
    
the_title();
the_content();
    
get_footer();

And if you want you can wrap them with HTML elements like this

<?php
/*
Template Name: Example
*/
get_header();

echo '<h1>' . the_title() . '</h1>';
echo '<section> . 'the_content() . '</section>';

get_footer();

Or if you prefer working like normal HTML file, without using echo

<?php
/*
Template Name: Example
*/
get_header();
?>

<h1><?php the_title(); ?></h1>
<section><?php the_content(); ?></section>

<?php get_footer(); ?>