Skip to content

Instantly share code, notes, and snippets.

@westonruter
Created January 13, 2018 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save westonruter/3f2666899307e0be4a9bfb18dec589ac to your computer and use it in GitHub Desktop.
Save westonruter/3f2666899307e0be4a9bfb18dec589ac to your computer and use it in GitHub Desktop.
<?php
// The following is copied from <https://github.com/WordPress/wordpress-develop/blob/1258d1d9d2c7bef7c18b4e3420219cfa716d0aca/src/wp-includes/template-loader.php#L49-L76>.
// @codingStandardsIgnoreStart
if ( is_embed() && $template = get_embed_template() ) :
elseif ( is_404() && $template = get_404_template() ) :
elseif ( is_search() && $template = get_search_template() ) :
elseif ( is_front_page() && $template = get_front_page_template() ) :
elseif ( is_home() && $template = get_home_template() ) :
elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) :
elseif ( is_tax() && $template = get_taxonomy_template() ) :
elseif ( is_attachment() && $template = get_attachment_template() ) :
elseif ( is_single() && $template = get_single_template() ) :
elseif ( is_page() && $template = get_page_template() ) :
elseif ( is_singular() && $template = get_singular_template() ) :
elseif ( is_category() && $template = get_category_template() ) :
elseif ( is_tag() && $template = get_tag_template() ) :
elseif ( is_author() && $template = get_author_template() ) :
elseif ( is_date() && $template = get_date_template() ) :
elseif ( is_archive() && $template = get_archive_template() ) :
else :
$template = get_index_template();
endif;
/** This filter is documented in wp-includes/template-loader.php */
$template = apply_filters( 'template_include', $template );
// @codingStandardsIgnoreEnd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment