Skip to content

Instantly share code, notes, and snippets.

@johnbillion
Last active June 22, 2023 23:05
Show Gist options
  • Star 46 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save johnbillion/e5b2f106c920276500d4 to your computer and use it in GitHub Desktop.
Save johnbillion/e5b2f106c920276500d4 to your computer and use it in GitHub Desktop.
ASCII WordPress Template Hierarchy
<?php
/*
WordPress Theme Template Hierarchy Last updated for WordPress 5.4
==================================
This diagram is partially simplified for legibility. To view the complete template hierarchy in use on your site see the
Template panel in the Query Monitor plugin.
is_404() -----------------------------------------------------------------------------------------------> 404.php
is_search() --------------------------------------------------------------------------------------------> search.php
is_front_page() ----------------------------------------------------------------------------------------> front-page.php
is_home() ----------------------------------------------------------------------------------------------> home.php
is_post_type_archive() -> archive-{post_type}.php ---------------------------------------------------\
is_tax() ---------------> taxonomy-{tax}-{slug}.php ------> taxonomy-{tax}.php -----> taxonomy.php ---\
is_category() ----------> category-{slug}.php ------------> category-{id}.php ------> category.php ----\
is_tag() ---------------> tag-{slug}.php -----------------> tag-{id}.php -----------> tag.php ----------> archive.php
is_author() ------------> author-{nicename}.php ----------> author-{id}.php --------> author.php ------/
is_date() --------------> date.php -------------------------------------------------------------------/
is_attachment() --------> {type-subtype}.php ---> {subtype}.php ---> {type}.php ----> attachment.php -\
is_single() ------------> single-{post_type}-{slug}.php --> single-{post_type}.php -> single.php ------\
is_page() --------------> page-{slug}.php ----------------> page-{id}.php ----------> page.php ---------> singular.php
is_embed() -------------> embed-{post_type}-{format}.php -> embed-{post_type}.php --> embed.php
is_privacy_policy() ----> privacy-policy.php
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment