I'm working on a theme that doesn't seem to be reading the header and/or stylesheet. All of the code seems to check out correctly, so I'm a little confused as to why this is happening. Perhaps I've overlooked something. If you look at the live site, you can see that the loop/index.php is showing, but no header.


<!DOCTYPE html>
<html <?php language_attributes(); ?>>
        <meta charset="<?php bloginfo( 'charset' ); ?>" />
        <title><?php wp_title(); ?></title>
        <meta name="description" content="<?php bloginfo( 'description' ); ?>">
        <link rel="profile" href="http://gmpg.org/xfn/11" />
        <link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
        <?php if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' ); ?>
        <?php wp_head(); ?>

<div id="container">
    <div id="header">
        <div class="logo">
            <h1><img src="<?php bloginfo('template_directory'); ?>/img/logo.png" alt="logo" /></h1>
        </div><!-- end logo -->
                <li><a href="#">SITE</a></li>
                <li><a href="#">ABOUT</a></li>
                <li><a href="#">CONTACT</a></li>
                <li><a href="#">SEARCH</a></li>
        </nav><!-- end nav -->
    </div><!-- end header -->


<?php get_header(); ?> 
<?php get_sidebar(); ?> 

<div id="blog">
    <?php if (have_posts()) : ?>  
        <?php while (have_posts()) : the_post(); ?>  
        <div class="post" id="post-<!--?php the_ID(); ?-->">
    <div class="post_meta">
        <h2><a href="<!--?php the_permalink() ?-->" rel="bookmark" title="Permanent Link to 
            <?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <p class="post_date"><?php the_time('F jS, Y') ?></p>
    </div><!-- end blog_meta -->
    <div class="post">
        <?php the_content('Read the rest of this entry »'); ?>
        <img src="<?php bloginfo('template_directory'); ?>/img/dots_small.png" class="divider" alt="post divider">
        <?php endwhile; ?>
    </div><!-- end post -->
    <div class="pagination">
        <div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>  
        <div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>

     <?php else : ?>  
        <h2 class="center">Not Found</h2>  
        <p class="center">Sorry, but you are looking for something that isn't here.</p>  
        <?php include (TEMPLATEPATH . "/searchform.php"); ?>  
    <?php endif; ?>
</div><!-- end blog -->

 <?php get_footer(); ?> 
  • live site URL broken – GhostToast May 31 '13 at 21:36
  • @GhostToast Sorry about that, should be fixed now. – user1255049 May 31 '13 at 21:44
  • 1
    Something is badly broken. Disable your plugins. Use the Twenty Twelve. Do you still have the problem? Are you sure that index.php is the file being used? Those functions need to be in most of your theme templates-- single.php, archive.php, etc. – s_ha_dum May 31 '13 at 21:52
  • @s_ha_dum I assumed index.php was being used, but it appears home.php was being used instead. Copy/pasted all index.php content to home.php- everything works perfectly now. Thank you. – user1255049 May 31 '13 at 21:55
  • @user1255049 : My answer is correct, then? You were not using get_header where you needed to be? – s_ha_dum May 31 '13 at 22:07

It sounds like your theme template file(s) are not using get_header, which is the function that loads your header.php. If so, you will need to add get_header(); to the top of each of your template files.

My guess is that your theme template files are missing get_footer also as nothing that would normally be in that file, such as </body> or </html>, is printing either.

  • It is definitely there, I've edited the original post to show index.php – user1255049 May 31 '13 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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