Php 如何在WordPress的自定义页面中添加主题模板?

Php 如何在WordPress的自定义页面中添加主题模板?,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我对PHP和WordPress非常陌生,我在创建自定义页面时遇到了一个问题。我在插件文件夹中有一个自定义php页面,它正在调用另一个插件。问题是,自定义页面也在调用和获取数据,但WordPress主题模板和样式并没有加载。获取对未定义函数()的调用时出错。如何在自定义php页面中获得主题功能?我的代码如下所示 <?php /** * The template for displaying all pages * * This is the template tha

我对PHP和WordPress非常陌生,我在创建自定义页面时遇到了一个问题。我在插件文件夹中有一个自定义php页面,它正在调用另一个插件。问题是,自定义页面也在调用和获取数据,但WordPress主题模板和样式并没有加载。获取对未定义函数()的调用时出错。如何在自定义php页面中获得主题功能?我的代码如下所示

 <?php
   /**
   * The template for displaying all pages
   *
   * This is the template that displays all pages by default.
   * Please note that this is the WordPress construct of pages
   * and that other 'pages' on your WordPress site will use a
   * different template.
   *
   * @package Sydney
   * @subpackage Sydney
     @since Sydney
   */

get_header(); ?>

<?php
$modelId=$_POST['modelId'];
$reallyPoints=1161;
$modelCost=10;
echo "Model iD : ".$modelId;
echo "Really Points : ".$reallyPoints;
echo "Model cost  : ".$modelCost;
?>


您没有在文件结尾之前包含
get\u footer()
函数的具体原因是什么?很多脚本和样式都依赖于该函数。不,没有任何特定的原因,在添加getfooter()函数后,错误也会保持不变。如果您在主题中创建模板,并将此代码添加到模板中,然后从特定页面的管理员处选择该页面的模板。但是,我的要求不是这个,我必须通过非管理区添加它。