Fatal error: Call to undefined function get_header() in index.php on line 1 [closed]

此生再无相见时 提交于 2019-12-03 08:40:26

问题


I have the same issue. I am totally new in PHP. I installed XAMPP and downloaded the hatch theme from WordPress. When I run index.php it gives me the following error

"Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\hatch\index.php on line 1"

How can I fix this?


回答1:


It appears that you're trying to run a WordPress theme outside of an installation of WordPress.

You need to download a copy of WordPress, extract it into your htdocs folder (like you did with the theme), and then navigate to it in your browser.

After setting it up (just follow the instructions), you need to place that theme in wp-content/themes inside the WordPress install.

Then, you can change the theme to your new one in your WordPress administrator panel.




回答2:


You are just accessing the theme file. That's the reason for the error.

First you need to include the theme file you downloaded into the WordPress installation folder: wp-content/themes

Then activate the theme from the administrator dashboard. Now you can use the theme.




回答3:


You are trying to access the theme file directly from XAMPP'S htdocs folder.

Copy the theme file, and add it to htdocs\wordpress\wp-content\themes. Run WordPress and add the theme from the administrator dashboard.



来源:https://stackoverflow.com/questions/10062717/fatal-error-call-to-undefined-function-get-header-in-index-php-on-line-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!