WordPress Template Hierarchy

Home Page display

  1. home.php
  2. index.php

Front Page display

  1. front-page.php – Used for both Your latest posts or A static page as set in the Front page displays section of Administration > Settings > Reading
  2. Page display rules – When Front page is set in the Front page displays section of Administration > Settings > Reading
  3. Home Page display rules – When Posts page is set in the Front page displays section of Administration > Settings > Reading

Single Post display

  1. single-{post_type}.php – If the post_type were videos, WordPress would look for single-videos.php.
  2. single.php
  3. index.php

Page display

Page Templates:

  1. custom template – Where custom template is the Page Template assigned to the Page.
  2. page-{slug}.php – If the page slug is recent-news, WordPress will look to use page-recent-news.php
  3. page-{id}.php – If the page ID is 6, WordPress will look to use page-6.php
  4. page.php
  5. index.php

Category display

Category Templates:

  1. category-{slug}.php – If the category’s slug were news, WordPress would look for category-news.php
  2. category-{id}.php – If the category’s ID were 6, WordPress would look for category-6.php
  3. category.php
  4. archive.php
  5. index.php

Tag display

Tag Templates:

  1. tag-{slug}.php – If the tag’s slug were sometag, WordPress would look for tag-sometag.php
  2. tag-{id}.php – If the tag’s ID were 6, WordPress would look for tag-6.php
  3. tag.php
  4. archive.php
  5. index.php

Custom Taxonomies display

  1. taxonomy-{taxonomy}-{term}.php – If the taxonomy were sometax, and taxonomy’s slug were someterm WordPress would look for taxonomy-sometax-someterm.php
  2. taxonomy-{taxonomy}.php – If the taxonomy were sometax, WordPress would look for taxonomy-sometax.php
  3. taxonomy.php
  4. archive.php
  5. index.php

Author display

Author Templates:

  1. author-{nicename}.php – If the author’s nice name were rami, WordPress would look for author-rami.php.
  2. author-{id}.php – If the author’s ID were 6, WordPress would look for author-6.php.
  3. author.php
  4. archive.php
  5. index.php

Date display

Archive (Date) Templates:

  1. date.php
  2. archive.php
  3. index.php

Search Result display

Search Templates:

  1. search.php
  2. index.php

404 (Not Found) display

404 Templates:

  1. 404.php
  2. index.php

Attachment display

Attachment Templates:

  1. MIME_type.php – it can be any MIME type (image.php, video.php, audio.php, application.php or any other).
  2. attachment.php
  3. single.php
  4. index.php
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: