New Template — copy existing template and change code? [duplicate]

For custom templates, I tend to use the default page.php, make any changes to the HTML (if need be), and enqueue an overriding stylesheet before get_header():

/**
 * Template Name: My Page Template
 */

wp_enqueue_style( 'my-page-template', get_template_directory_uri() . '/css/page-template.css' );
get_header();

Everything’ll function like a normal page, except now you have a stylesheet for declaring any unique rules for this particular template.

Leave a Comment