Title: Whose on First?
Last modified: August 18, 2016

---

# Whose on First?

 *  Resolved [jayjerome](https://wordpress.org/support/users/jayjerome/)
 * (@jayjerome)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/)
 * I’m trying to understand the order in which WordPress assembles information to
   display theme pages, and having difficulty understanding the process.
 * First: the Codex informs that the index.php template file can be subdivided into
   the following basic files:
 * * header.php
    * sidebar.php * footer.php * comments.php *comments-popup.php
 * Most of the WP Themes designers divide it that way: but the Codex doesn’t say
   why it’s an advantage to modularize them like that, instead of including them
   all in index.php. Anyone know the reason?
 * Also, are those subdivided files part of the WordPress Template Hierarchy? Does
   WP consider the m to be part of index.php, and look at them the same time it 
   looks at index.php?
 * And finally, when does WP look for style.css?
 * Any feedback would be appreciated…

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

 *  [DianeV](https://wordpress.org/support/users/dianev/)
 * (@dianev)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-463701)
 * Sure. In the WP1.2x days, we had only index.php to do everything; otherwise, 
   we had to make our own pages for other functions (such as search), which could
   be done with a bit (understatement) of work.
 * As of WP1.5, we don’t have to make our own, as the themes (at least, the ones
   with more than the default “pages”) are broken into pages such as search.php,
   page.php, single.php, etc. That means that we can design/configre pages (such
   as category pages) differently than others and *still* use the header, footer,
   and sidebar includes for all.
 * It can be a bit difficult to look at templates in “pieces”, as it were — but 
   once you get used to it, it’s quite wonderful.
 *  [DianeV](https://wordpress.org/support/users/dianev/)
 * (@dianev)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-463702)
 * Ah, I forgot style.css, which is what the stylesheet for any theme is called.
   As I recall, it’s called by header.php and, I would suppose, that is when the
   browser uses it, although it could be otherwise.
 *  Thread Starter [jayjerome](https://wordpress.org/support/users/jayjerome/)
 * (@jayjerome)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-463789)
 * Thanks for the reply DianeV–
 * I still would like to know the following–
    When WordPress assembles the information
   it needs to display the theme, is this the hierarchy it follows?
 * First this —
    1. home.php 2. index.php
 * Then this —
    * header.php * sidebar.php * footer.php * comments.php * comments-
   popup.php
 * And then on to the other pages (Single Post, Static Page, Catagory Page, etc.)…
   Or does it skip the header, sidebar, footer, etc– and come back to them later?
 *  [estjohn](https://wordpress.org/support/users/estjohn/)
 * (@estjohn)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-463824)
 * depends on the theme and how the html is written for it. Some gather different
   elements at different stages. View the source of a page from a browser and you
   can see the order that theme uses
 *  Thread Starter [jayjerome](https://wordpress.org/support/users/jayjerome/)
 * (@jayjerome)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-463838)
 * Thanks for the tip, estjohn–
    I just took a quick look at the page source, and
   I’m guessing it will take about three martinis, two aspirins, and about a dozen
   or so follow up questions to figure it all out.
 * 🙂
 *  [estjohn](https://wordpress.org/support/users/estjohn/)
 * (@estjohn)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-464033)
 * LOL Jayjerome ahhh well.. I like how you learn it from the inside out 😉
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-464034)
 * I am not a coder but basically this is how I understand it:
 * First of all in the root of your WP install you have a (short and sweet) index.
   php that calls the wp-blog-header.php file. That’s how the whole “engine” is 
   put in motion…
    … and the different functions will start doing their job 🙂
 * When it gets to the display > based on the setting stored in the DB (read: active
   theme) and retrieved by the above-mentioned engine – the files are put together
   in some way “illustrated” here:
    [http://www.transycan.net/blogtest/2005/03/31/visual-anatomy-of-a-wp-15-theme/](http://www.transycan.net/blogtest/2005/03/31/visual-anatomy-of-a-wp-15-theme/)
 *  [sadish](https://wordpress.org/support/users/sadish/)
 * (@sadish)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-464042)
 * Let me tell you what my understanding is.
 * The first file that is loaded is the index.php on the root folder of your blog.
 * it makes a call to wp-blog-header.php
 * wp-blog-header knows what is the current theme for this blog, and loads the index.
   php within the theme.
 * if you do not want to separate the header/sidebar/footer’s content in different
   files, you can keep all of them in index.php
 * suppose someone does a search for “keyword” on the site, the URL becomes “your
   site url” + “?s=keyword”
    wp-blog-header acts upon this, and when it sees an “
   s=keyword” in the URL, it tries to load the search.php within the theme folder.
   if it does not find one, it loads the index.php within the theme folder.
 * similarly it looks for date.php or archive.php when it sees “m=200610” in the
   URL, and if it does not find one, it loads index.php within the theme folder.
 * if you want a simple blog, you can very well live with 1.index.php and
    2.style.
   css
 * but as your requirements grow, as you want to differentiate and tell the visitor
   that they are seeing an archive / or they are seeing a search results page, you
   need to create more files like archive.php or search.php etc.
 * In most cases, the only change you are going to make is going to be in the main
   content area and the header, sidebar and the footer remains the same.
    Thats 
   why you keep them in separate files and include them from index.php or search.
   php or archive.php at appropriate places.
 * Hope this makes sense. feel free to ask any further questions.
 * Thanks
    Sadish

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

The topic ‘Whose on First?’ is closed to new replies.

 * 8 replies
 * 5 participants
 * Last reply from: [sadish](https://wordpress.org/support/users/sadish/)
 * Last activity: [19 years, 7 months ago](https://wordpress.org/support/topic/whose-on-first/#post-464042)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
