admin管理员组

文章数量:1289525

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 page editor, I checked the 'allow comments' checkbox. Don't know how to do that yet, via the code.

本文标签: templatesHow can I get a single php file that is the equivalent of an existing WordPress page