Hiérarchie des Templates WordPress

Publié le 15 novembre 2010 par Capmarketer

The Template Hierarchy In Detail

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)

Single Post display

  1. single-{post_type}.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 fortaxonomy-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.phpvideo.phpaudio.phpapplication.php or any other).
  2. attachment.php
  3. single.php
  4. index.php

Resource & More info:

http://codex.wordpress.org/Template_Hierarchy

Articles similaires