WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] "Fatal error: Call to undefined function get_header()..." (4 posts)

  1. christian_d
    Member
    Posted 4 years ago #

    I'm working on a site (http://jennifer.coffeeismagic.com/) and, when I was initially formatting WordPress I didn't want that many features so I stripped out all the <?php get_sidebar() ?> stuff. I realized after the fact that I actually wanted the sidebar on the front page so I stuck that bit of code back in on the archive.php and archives.php files, right where it was before, above get_footer -- to no effect. So I decided to stick <?php get_sidebar() ?> back into the index.php file and when I did that it totally crashed the site, saying "Fatal error: Call to undefined function get_header() in /home/christian_d/jennifer.coffeeismagic.com/index.php on line 1". I didn't change anything other than adding get_sidebar and when I took it back out it still gives me that error. The header.php file is still intact in the same place it was on the server so i don't know what's going on. Any ideas are much appreciated!

    Here is the code of index.php:

    <?php get_header() ?>
    
    	<div id="container">
    		<div id="content">
    
    			<div id="nav-above" class="navigation">
    				<div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&laquo;</span> Older posts', 'sandbox' )) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'sandbox' )) ?></div>
    			</div>
    
    <?php while ( have_posts() ) : the_post() ?>
    
    			<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
    				<h2 class="entry-title"><a href="<?php the_permalink() ?>" title="<?php printf( __('Permalink to %s', 'sandbox'), the_title_attribute('echo=0') ) ?>" rel="bookmark"><?php the_title() ?></a></h2>
    				<div class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php unset($previousday); printf( __( '%1$s – %2$s', 'sandbox' ), the_date( '', '', '', false ), get_the_time() ) ?></abbr></div>
    				<div class="entry-content">
    <?php the_content( __( 'Read More <span class="meta-nav">&raquo;</span>', 'sandbox' ) ) ?>
    
    				<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'sandbox' ) . '&after=</div>') ?>
    				</div>
    
    			</div><!-- .post -->
    
    <?php comments_template() ?>
    
    <?php endwhile; ?>
    
    			<div id="nav-below" class="navigation">
    				<div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&laquo;</span> Older posts', 'sandbox' )) ?></div>
    				<div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'sandbox' )) ?></div>
    			</div>
    
    		</div><!-- #content -->
    	</div><!-- #container -->
    
    <?php get_footer() ?>
  2. whooami
    Member
    Posted 4 years ago #

    "Fatal error: Call to undefined function get_header() in /home/christian_d/jennifer.coffeeismagic.com/index.php on line 1

    I'm working on a site

    someone else 'working on a site" that doesnt get wordpress. (surprise surprise)

    you edited the wrong file.

    the index.php that lives in the root directory (thats the directory with the wp-config.php in it) is NOT a theme file.

    I suggest you do some reading of the docs before taking on wordpress gigs, be they paid or unpaid (no offense, just honest)

  3. christian_d
    Member
    Posted 4 years ago #

    Oh man, what a dumb mistake. The last time I worked on this site was last week and I logged into my FTP and today I just edited the first index.php file I saw without thinking.

    No need to be so snooty, people make mistakes....

  4. ovib
    Member
    Posted 4 years ago #

    same to me... we work too much! :D

Topic Closed

This topic has been closed to new replies.

About this Topic