Title: How does single.php work?
Last modified: August 19, 2016

---

# How does single.php work?

 *  Resolved [totalnoob](https://wordpress.org/support/users/totalnoob/)
 * (@totalnoob)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/how-does-singlephp-work/)
 * Hello,
    What are the functionalities of single.php? Will everything inside the
   index.php’s loop become deactivated if I create a single.php file? Thanks in 
   advance.

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 1 month ago](https://wordpress.org/support/topic/how-does-singlephp-work/#post-734835)
 * No, the index.php will still be used, but the single.php will take its place 
   for single post pages.
 * Read more on this subject here:
    [http://codex.wordpress.org/Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy)
 *  Thread Starter [totalnoob](https://wordpress.org/support/users/totalnoob/)
 * (@totalnoob)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/how-does-singlephp-work/#post-734849)
 * > WordPress looks for template files with specific names in the current Theme’s
   > directory and uses the first matching template file listed under the appropriate
   > query section below.
 * Doesn’t this mean that the ‘first matching template’ replaces all the other ones?
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [18 years, 1 month ago](https://wordpress.org/support/topic/how-does-singlephp-work/#post-734852)
 * Yes, but only for that specific case.
 * Look at the hierarchy. A single.php file is only used for single-post pages. 
   Not for root pages, or archive pages, or category pages…
 * See here for graphical example:
    [http://codex.wordpress.org/images/1/1d/wp_Template_Hierarchy.png](http://codex.wordpress.org/images/1/1d/wp_Template_Hierarchy.png)
 *  Thread Starter [totalnoob](https://wordpress.org/support/users/totalnoob/)
 * (@totalnoob)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/how-does-singlephp-work/#post-734863)
 * Ok, so single.php will be used(inplace of index.php) when the page contains only
   a single post. Otherwise, index.php will be used. Am I getting it now?
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/how-does-singlephp-work/#post-734864)
 * _Ok, so single.php will be used(inplace of index.php) when the page contains 
   only a single post. Otherwise, index.php will be used._
 * If you don’t have a single.php file in your theme folder – WP will use index.
   php to display the single post view, too.
 * For all the other views (monthly or category archives, Pages, search etc.) WP
   looks for the template files exactly as it is described in the Codex article 
   for each case.
 * Index.php is the general “fall back” in case there is no specific template for
   the case.
 *  Thread Starter [totalnoob](https://wordpress.org/support/users/totalnoob/)
 * (@totalnoob)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/how-does-singlephp-work/#post-734866)
 * Thanks. I think I understand now
 *  [earphinteractive](https://wordpress.org/support/users/earphinteractive/)
 * (@earphinteractive)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/how-does-singlephp-work/#post-735355)
 * Ah.. I’m glad I found this post. Makes sense now.
 * My problem is that I have multiple posts showing up on my single.php. What am
   I missing?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘How does single.php work?’ is closed to new replies.

 * 7 replies
 * 4 participants
 * Last reply from: [earphinteractive](https://wordpress.org/support/users/earphinteractive/)
 * Last activity: [17 years, 2 months ago](https://wordpress.org/support/topic/how-does-singlephp-work/#post-735355)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
