templates – How can I get a single php file that is the equivalent of an existing WordPress page?

Question

When I use my php file as a template and no other content on the page, it works fine but when I run the file directly (via PhpStorm), there are missing elements (such as comment_status) that cause exceptions. I am doing the require of wp-load and calling get_header() within the file, but obviously something is still missing, that a ‘real’ WP page has. So – I’d like to see the Php from the otherwise ‘blank’ page, that WP uses. Viewing source of course only shows the final html.

<?php

/* Template Name: BlankPage */
require_once ‘..wp-load.php’;
get_header();

comments_template();
comment_form();
get_footer();
?>

When used as a template, the ‘require’ line is commented out.
Via the WP editor, I checked the ‘allow comments’ checkbox. Don’t know how to do that yet, via php.

0
selofain 5 months 2021-07-16T23:54:24-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse