Reputation: 1
I have just purchased a WordPress template and I am trying to run this theme locally (XAMPP), and then when the site loads, it gives me the following error:
Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\hypershot\index.php on line 13
How can I proceed?
PS: I'm really sad about it now, as I thought it was going to be easy to deal with this template/theme! I just can't run the site (local).
Upvotes: 0
Views: 15801
Reputation: 146191
The error is:
Fatal error: Call to undefined function get_header() in C:\xampp\htdocs\hypershot\index.php
According to the WordPress folder structure, the index.php
file in the root of your project should be something like this (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' );
But the error says that, you have an index.php
file which has the get_header()
function (WordPress function) inside it, so this index.php
file belongs in the root of your theme
folder, not inside the root of your project folder.
Since the get_header()
is a WordPress function and WordPress is not loaded yet, PHP is throwing this error, because it doesn't recognize the get_header()
function. So check the index.php
file in your project's root and make sure that the right index.php
file is there.
The best way to solve this problem is just reinstall a fresh copy of WordPress and then put the theme in your C:\xampp\htdocs\hypershot\wp-content\themes
folder.
Upvotes: 4