• I receive this error when I try to open my blog which is hosted by HostGator and I have no idea where to go to fix it. Fatal error: Call to undefined function get_header() in /home/wapatu/public_html/index.php on line 1

    Here are the first lines in that file

    index.php
    PHP script text
    ——————————————————————————–

    <?php get_header(); ?>

    <div id=”content”>

    <?php include (TEMPLATEPATH . ‘/menu.php’); ?>
    <?php if (have_posts()) : ?>
    <?php $firstpostquery = new WP_Query(‘showposts=1’); ?>
    <?php while($firstpostquery->have_posts()) : $firstpostquery->the_post(); $firstpost = $post->ID; ?>
    <div class=”entry”>
    <div class=”post” id=”post-<?php the_ID(); ?>”>
    <h2>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”><?php the_title(); ?></h2>
    <small>Written by <?php the_author() ?> on <abbr title=”<?php the_time(‘Y-m-d\TH:i:sO’); ?>”><?php unset($previousday); printf(__(‘%1$s – %2$s’), the_date(”, ”, ”, false), get_the_time()) ?></abbr> – <?php if(function_exists(‘the_views’)) { the_views(); } ?> </small>
    <div class=”line”></div>

    Thank you in advance for your help

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi

    The code you posted is the code from a theme template file named index.php That file is not supposed to be in your root folder. It is supposed to be in /wp-content/themes/{themename}/index.php

    It is a bit confusing – the main WP file is also called index.php. Its content is completely different yet it has the same name. Somehow you have gotten your theme’s index.php file to overwrite the main WP index.php file.

    I assume from the error message that you installed WP in the site’s root folder. I suggest you download the WP 2.7.1 files again, and upload them again. ( Make a Home Directory file backup in cPanel before you do any of this) What you will be doing is overwriting all the existing WP files with a clean copy of the WP code. This will not affect your database configuration file or your themes, unless you are using the default or classic themes and have modified them.

    This way you will have the correct index.php file in place, and it will clean up any other files that may have unintentionally been placed in the wrong place.

    Thread Starter wapatu

    (@wapatu)

    Geez, I’ve had so many problems that I’ve overlooked responding to you and saying thanks. So thank you for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fatal Error’ is closed to new replies.