I'm (locally) building a custom theme.

So far I have:

  • index.php
  • single.php
  • page.php
  • custom page template called about-page.php
  • two different headers: one for default use and one for the single.php

NO functions.php; NO custom taxonomy; Permalink settings > Common settings : default

My index.php has a list of posts (all of those belonging to a specified category), when I click on one of those posts I end to the index.php BUT with the right custom header (header I created for the posts, it's called header-single.php).

So, I'm getting the index.php istead of the single.php

I read around other people had the same problem with the word "year" or some other Reserved Terms. I don't think it's my case.

In my home page I have:

 * Template Name: Front Page Template
get_header(); ?>
<nav id="menu">
        <ul class="postlist">
                $lastposts = get_posts('numberposts=20&orderby=date&cat=9');
                foreach($lastposts as $post) :
                    <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a</li>
                <?php endforeach; ?>
<?php get_footer(); ?>


Here's the structure of my single.php

 Template Name: Single project
get_header(); ?>

<div id="flex-container">   

<div id="read">
<div id="read_slider">
    <div id="read_close">

    <div id="read_text">
        <?php the_content(); ?>

<?php get_footer(); ?>
  • What is the structure in your single.php template? Feb 28, 2014 at 10:16
  • Edited the question with my single.php structure. Thanks!
    – Leonardo
    Feb 28, 2014 at 11:03
  • Try removing the Template Name of your single.php. I'm not sure about this, but I think this could be confusing to the template structure.
    – fischi
    Feb 28, 2014 at 11:18
  • have you disabled all plugins? output the query object in your index.php file to see what the main query vars look like, this is how WordPress decides what template to load. The contents of your single template are completely irrelevant, despite what others suggest here. Add var_dump($wp_query); somewhere in the template, then edit your question and add that output.
    – Milo
    Mar 6, 2014 at 23:50

3 Answers 3


Your structures is completely wrong. Remove the template name from your index.php and single.php templates. You only should use those if you create a custom page.php template to let wordpress know it is a custom page. This should apply to your about-page.php, which is also wrongly named, it should be page-about.php. Your index.php looks about right, but your single.php is bit of a mess, that is why wordpress skip that template completely and uses index.php instead.

There is no loop defined in your single.php. The loop looks something like this:

// Start the Loop.
while ( have_posts() ) { 

    //Content of the loop goes here, in your case 


Go and have a look at the default themes in the Wordpress core and see how their templates are put together and how your structures should look like. Working from those themes will guide you in the right direction


I had the same problem with neither the single-CUSTOM-TYPE.php nor the single.php being rendered after clicking the single-post-link.... only index.php instead of the correct file...

What helped me was a simple change back to Standard Permalinks in "Settings" -> "Permalinks" and a restore back to "Name of the Post" (Beitragsname)....

Maybe this might help someone else as well


I followed the advices but nothing is working.

My single.php is now literally:

<?php get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>

        <?php the_content();
<?php get_footer(); ?>

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.