Title: Page.php vs. Index.php
Last modified: August 18, 2016

---

# Page.php vs. Index.php

 *  [thebindlestick](https://wordpress.org/support/users/thebindlestick/)
 * (@thebindlestick)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/)
 * In the Dark Ritual theme I have both pages of code, but they are identical as
   far as I can tell… are they both needed and if so, why? These are both in themes/
   DarkRitual, not at my root.

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

 *  [rudolf45](https://wordpress.org/support/users/rudolf45/)
 * (@rudolf45)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552624)
 * 1. Every theme should have an index.php!
    2. page.php is used to display Pages.
 * Read: [http://codex.wordpress.org/Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy)
 *  Thread Starter [thebindlestick](https://wordpress.org/support/users/thebindlestick/)
 * (@thebindlestick)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552848)
 * yes but what is the difference? Which one do I edit to see changes, both? Mine
   are both the exact same code, why is this?
 *  [shovi](https://wordpress.org/support/users/shovi/)
 * (@shovi)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552900)
 * all I’ve noticed so far is that the two templates are there so you can alter 
   the way the posts versus pages display in wordpress. for example, you may want
   to pull out the comments section of a page because you want it to be static content.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552901)
 * > _yes but what is the difference? Which one do I edit to see changes, both? 
   > Mine are both the exact same code, why is this?_
 * thebindlestick: The fact that you’re asking these questions suggests that you
   did not actually read the link that rudolf45 gave you.
 * Read this. Really, go read it. It answers all the questions you have asked. all
   you have to do is to *READ*.
    [http://codex.wordpress.org/Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy)
 * Answering the same questions over and over is annoying. This is why we have documentation.
 *  Thread Starter [thebindlestick](https://wordpress.org/support/users/thebindlestick/)
 * (@thebindlestick)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552915)
 * I did read it, asking the same question gets annoying too.
 * What I read tells me that as long as I have my page.php Template in place, and
   all my other Templates, and home.php or index.php is in the root WP directory,
   I can delete theme/index.php because it is just there for redundancy, correct?
 *  [rudolf45](https://wordpress.org/support/users/rudolf45/)
 * (@rudolf45)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552918)
 * **No, not correct.** And you don’t put template files in the WP root. All the
   template files live in the theme directory.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552923)
 * > _What I read tells me that as long as I have my page.php Template in place,
   > and all my other Templates, and home.php or index.php is in the root WP directory,
   > I can delete theme/index.php because it is just there for redundancy, correct?_
 * No, you can’t do that. The index.php is the main file. It’s the fallback position
   for everything in the Template Hierarchy.
 * WordPress uses the Query String — information contained within each link on your
   web site — to decide which template or set of templates will be used to display
   the page.
 * First, WordPress matches every Query String to query types — i.e. it decides 
   what type of page (a search page, a category page, the home page etc.) is being
   requested.
 * Templates are then chosen — and web page content is generated — in the order 
   suggested by the WordPress Template hierarchy, depending upon what templates 
   are available in a particular WordPress Theme.
 * WordPress looks for template files with specific names in the current Theme’s
   directory and uses the first matching template file it finds that matches the
   Template Hierarchy.
 * With the exception of the basic index.php template file, Theme developers can
   choose whether they want to implement a particular template file or not. If WordPress
   cannot find a template file with a matching name, it skips down to the next file
   name in the hierarchy. If WordPress cannot find any matching template file, index.
   php (the Theme’s home page template file) will be used.
 *  Thread Starter [thebindlestick](https://wordpress.org/support/users/thebindlestick/)
 * (@thebindlestick)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552940)
 * So should I be editing page.php or index.php in my Theme folder, to effect my
   pages?
 *  [rudolf45](https://wordpress.org/support/users/rudolf45/)
 * (@rudolf45)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552943)
 * [Pages](http://codex.wordpress.org/Pages) (with capital P) or just (web)pages?
 * (and if you have to ask it – you still didn’t read the Codex, so I’ll be giving
   up on you, as a hopeless case…)
 *  [t0v3](https://wordpress.org/support/users/t0v3/)
 * (@t0v3)
 * [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552944)
 * You modify the index.php theme files to change the layout of your index page (
   surprise surprise) index page being the very first page people see when typing
   in the url to your domain.
 * Pages are used when you create a page in the wordpress admin. They are static
   pages containing whatever you want. You go to them using yourdomain.com/?page_id
   =1
 * So if you don’t plan on using pages, don’t modify the page.php file. You will
   however be using the index, so modify that

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

The topic ‘Page.php vs. Index.php’ is closed to new replies.

## Tags

 * [index.php](https://wordpress.org/support/topic-tag/index-php/)
 * [page.php](https://wordpress.org/support/topic-tag/page-php/)

 * 10 replies
 * 5 participants
 * Last reply from: [t0v3](https://wordpress.org/support/users/t0v3/)
 * Last activity: [19 years, 2 months ago](https://wordpress.org/support/topic/pagephp-vs-indexphp/#post-552944)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
