Correct process for a new Page Template?

A page template defines the full rendered content displayed: header, footer, content – everything. So, at the very least, you’ll need to call get_header() and get_footer(), or manually add the header and footer code to the template.

Also, I would recommend using a callback to enqueue your custom stylesheet. You can use the is_page_template() conditional to check for your specific page. For example:

<?php
function wpse60383_enqueue_custom_style() {
    if ( is_page_template( 'salespagetemplate.php' ) ) {
        wp_enqueue_style( 'my-page-template', get_template_directory_uri() . '/css/page-template.css' ); 
    }
}
add_action( 'wp_enqueue_scripts', 'wpse60383_enqueue_custom_style' );

Note: this callback and hook goes in your functions.php file.

Leave a Comment