我刚刚购买了一个WordPress模板,我试图在本地运行这个主题(XAMPP),然后当站点加载时,它会给我以下错误:
致命错误:在第13行的get_header中调用未定义函数C:\xampp\htdocs\hypershot\index.php ()
我该怎么做?
PS:我现在真的很难过,因为我认为它会很容易处理这个模板/主题!我只是不能管理这个网站(当地的)。
发布于 2014-09-22 17:30:52
错误是:
Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\hypershot\index.php根据WordPress文件夹结构,项目根目录中的index.php文件应该如下所示(Version - 4.0):
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );但是错误说,您有一个index.php文件,其中包含get_header()函数(WordPress函数),因此该index.php文件属于您的theme文件夹的根目录,而不是您的项目文件夹的根。
因为get_header()是一个WordPress函数,WordPress还没有加载,所以它抛出了这个错误,因为它不识别get_header()函数。因此,检查项目根目录中的index.php文件,并确保正确的index.php文件在那里。
解决此问题的最佳方法是重新安装WordPress的新副本,然后将主题放在您的C:\xampp\htdocs\hypershot\wp-content\themes文件夹中。
https://stackoverflow.com/questions/25979528
复制相似问题