• I see the following error in my logfile:

    [Tue Jan 26 09:58:57 2016] [error] [client 173.245.49.102] PHP Fatal error: Call to undefined function get_header() in /storage/web/public/sites/www.benlinders.com/wp-content/themes/mantra/index.php on line 14

    Is there something missing or incorrectly installed?

Viewing 14 replies - 1 through 14 (of 14 total)
  • Do you have a ‘header.php’ file? have you edited your ‘header.php’ file?

    Thread Starter BenLinders

    (@benlinders)

    Yes, in the Mantra theme directory:

    http://www.benlinders.com/wp-content/themes/mantra/

    And no, I didn’t change the header.php file

    can you use pastebin.com to post your ‘index.php’.

    Thread Starter BenLinders

    (@benlinders)

    Here it is:

    <?php
    /**
    * The main template file.
    *
    * This is the most generic template file in a WordPress theme
    * and one of the two required files for a theme (the other being style.css).
    * It is used to display a page when nothing more specific matches a query.
    * E.g., it puts together the home page when no home.php file exists.
    * Learn more: http://codex.wordpress.org/Template_Hierarchy
    *
    * @package Cryout Creations
    * @subpackage Mantra
    */
    get_header();
    if ($mantra_frontpage==”Enable” && is_front_page() ):
    mantra_frontpage_generator();
    if ($mantra_frontposts==”Enable”): get_template_part(‘content’,’frontpage’); endif;
    else:
    ?>
    <section id=”container”>

    <div id=”content” role=”main”>

    <?php cryout_before_content_hook(); ?><?php if ( have_posts() ) : ?>

    <?php mantra_content_nav( ‘nav-above’ ); ?>

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    <?php get_template_part( ‘content’, get_post_format() ); ?>

    <?php endwhile; ?>

    <?php if($mantra_pagination==”Enable”) mantra_pagination(); else mantra_content_nav( ‘nav-below’ ); ?>

    <?php else : ?>

    <article id=”post-0″ class=”post no-results not-found”>
    <header class=”entry-header”>
    <h1 class=”entry-title”><?php _e( ‘Nothing Found’, ‘mantra’ ); ?></h1>
    </header><!– .entry-header –>

    <div class=”entry-content”>
    <p><?php _e( ‘Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.’, ‘mantra’ ); ?></p>
    <?php get_search_form(); ?>
    </div><!– .entry-content –>
    </article><!– #post-0 –>

    <?php endif; ?><?php cryout_after_content_hook(); ?>

    </div><!– #content –>
    <?php get_sidebar(); ?>
    </section><!– #container –>
    <?php
    endif;
    get_footer(); ?>

    that looks like the index file that should be in your theme directory. outside of your theme directory should be an index file that loads wordpress and your theme.

    that index file you posted is looking for a function that it doesn’t think exists.

    Thread Starter BenLinders

    (@benlinders)

    The errors message comes from this file, line 14 in /storage/web/public/sites/www.benlinders.com/wp-content/themes/mantra/index.php

    Which is a call to get_header();

    Question is where to find get_header(). Normally it should be in header.php, right? I checked, it’s not in there.

    get_header() is a function that gets the ‘header.php’ file of your theme. that function is not in your header file, it is probably in the wp-includes folder. Do you have an ‘index.php’ file outside of your wp-content folder?

    Thread Starter BenLinders

    (@benlinders)

    yes, in the main directory of the site. Guess that’s where it should be?

    Not really. There are several index files in a wordpress install. i was just wondering if you had the proper index file outside your theme that was properly loading wordpress and your theme. im trying to troubleshoot from afar…

    Thread Starter BenLinders

    (@benlinders)

    Really appreciate your help.

    The website loads and looks ok, but I’m trying to get rid of error messages in the log file. That’s why I’m wondering where the get_header() would normally go?

    get_header goes on template pages usually, or if no template pages are being used, ‘papge.php’ and then ‘index.php’ it is a function that gets the ‘header.php’ file.

    Thread Starter BenLinders

    (@benlinders)

    I’m trying to get this. Should there be a header function somewhere? How bad is it when this error occurs?

    I’m not sure where the get_header function is, or even how it works exactly. I imagine it is in the wordpress core somewhere.

    And I’m not sure how bad it is when that error happens. I imagine it would be real bad if it caused your site not to load. I personally have never experienced it before.

    Thread Starter BenLinders

    (@benlinders)

    Yes, the site does load so it doesn’t seem to be a big problem. I’m hoping on people from Cryout creations to react, as it’s their theme Mantra.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Call to undefined function get_header()’ is closed to new replies.