WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to create a theme.

I created a header.php file and call this file in index.php using

<?php get_header();?>

When I try to run my index.php file it shows this error:

Call to undefined function get_header()

What could be wrong?

share|improve this question
    
Show here your header.php code and index.php code – Piyush Dhanotiya Feb 25 at 13:31
    
How you tried to "run" that index.php file ....... ?? Did you made a style.css in the theme folder and tried to activate the theme from dashboard ?? – Anoop D Feb 25 at 14:18
    
Did you created an index.php inside the theme folder ? If not then please see the answer by Rarst ...... – Anoop D Feb 25 at 14:28

Generally this happens when someone has mistakenly put index.php from a theme in the WP install folder, where it overwrites the index.php that is the main WordPress file. Download WordPress again, and take the one file, index.php from its root folder, replacing the file you now have as index.php

source

share|improve this answer

WordPress theme templates are not meant to be executed directly. They are loaded by WordPress core (after appropriate environment had been set up) according to Template Hierarchy.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.