我是PHP和WordPress的新手,我在创建自定义页面时遇到了一个问题。我在plugin文件夹中有一个自定义的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;
?>