{"id":183,"date":"2025-12-10T09:00:00","date_gmt":"2025-12-10T09:00:00","guid":{"rendered":"https:\/\/developryplugins.com\/?p=183"},"modified":"2025-11-24T11:18:19","modified_gmt":"2025-11-24T11:18:19","slug":"wordpress-theme-template-hierarchy-explained-with-examples","status":"publish","type":"post","link":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/","title":{"rendered":"WordPress Theme Template Hierarchy Explained with Examples"},"content":{"rendered":"<p><!-- @format --><\/p>\n<p>WordPress template hierarchy determines which PHP template file displays content based on requested URL, following predictable fallback pattern from specific to general templates. From single-post-slug.php specificity to index.php fallback, understanding template hierarchy enables precise control over content presentation across post types, taxonomies, and page templates. This comprehensive guide teaches hierarchy visualization, template selection logic, conditional tags, custom template creation, and debugging techniques identifying active templates.<\/p>\n<h2 id=\"how-template-hierarchy-works\">How Template Hierarchy Works<\/h2>\n<p><strong>Request Flow<\/strong>:<\/p>\n<ol type=\"1\">\n<li>User requests URL: <code>example.com\/category\/news\/<\/code><\/li>\n<li>WordPress identifies request type: Category archive<\/li>\n<li>WordPress searches for templates in order:\n<ul>\n<li><code>category-news.php<\/code> (category slug)<\/li>\n<li><code>category-5.php<\/code> (category ID)<\/li>\n<li><code>category.php<\/code> (generic category)<\/li>\n<li><code>archive.php<\/code> (generic archive)<\/li>\n<li><code>index.php<\/code> (fallback)<\/li>\n<\/ul>\n<\/li>\n<li>First matching template renders content<\/li>\n<\/ol>\n<p><strong>Fallback System<\/strong>:<\/p>\n<p>WordPress searches from most specific to least specific until finding template file.<\/p>\n<p><strong>Example Hierarchy<\/strong> (single post):<\/p>\n<pre><code>single-{post-type}-{slug}.php\n\u2192 single-{post-type}.php\n\u2192 single.php\n\u2192 singular.php\n\u2192 index.php<\/code><\/pre>\n<h2 id=\"index.php---the-fallback\">Index.php &#8211; The Fallback<\/h2>\n<p><strong>Ultimate Fallback<\/strong>:<\/p>\n<p><code>index.php<\/code> displays content when no specific template exists.<\/p>\n<p><strong>Required<\/strong>: Every theme must have <code>index.php<\/code>.<\/p>\n<p><strong>Example index.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb2\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb2-1\"><a href=\"#cb2-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb2-2\"><a href=\"#cb2-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb2-3\"><a href=\"#cb2-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;main&quot;<\/span>&gt;<\/span>\n<span id=\"cb2-4\"><a href=\"#cb2-4\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb2-5\"><a href=\"#cb2-5\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb2-6\"><a href=\"#cb2-6\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> :<\/span>\n<span id=\"cb2-7\"><a href=\"#cb2-7\" aria-hidden=\"true\"><\/a>            the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb2-8\"><a href=\"#cb2-8\" aria-hidden=\"true\"><\/a>            get_template_part<span class=\"ot\">(<\/span><span class=\"st\">&#39;template-parts\/content&#39;<\/span><span class=\"ot\">,<\/span> get_post_type<span class=\"ot\">());<\/span><\/span>\n<span id=\"cb2-9\"><a href=\"#cb2-9\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb2-10\"><a href=\"#cb2-10\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb2-11\"><a href=\"#cb2-11\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb2-12\"><a href=\"#cb2-12\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb2-13\"><a href=\"#cb2-13\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb2-14\"><a href=\"#cb2-14\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_sidebar<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb2-15\"><a href=\"#cb2-15\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"single-post-templates\">Single Post Templates<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>single-{post-type}-{slug}.php\nsingle-{post-type}.php\nsingle.php\nsingular.php\nindex.php<\/code><\/pre>\n<p><strong>Examples<\/strong>:<\/p>\n<p>Post slug <code>hello-world<\/code>:<\/p>\n<ul>\n<li><code>single-post-hello-world.php<\/code> (most specific)<\/li>\n<li><code>single-post.php<\/code><\/li>\n<li><code>single.php<\/code><\/li>\n<li><code>singular.php<\/code><\/li>\n<li><code>index.php<\/code><\/li>\n<\/ul>\n<p>Custom post type <code>portfolio<\/code> with slug <code>web-design<\/code>:<\/p>\n<ul>\n<li><code>single-portfolio-web-design.php<\/code><\/li>\n<li><code>single-portfolio.php<\/code><\/li>\n<li><code>single.php<\/code><\/li>\n<li><code>singular.php<\/code><\/li>\n<li><code>index.php<\/code><\/li>\n<\/ul>\n<p><strong>single.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb4\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb4-1\"><a href=\"#cb4-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-2\"><a href=\"#cb4-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb4-3\"><a href=\"#cb4-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span>&gt;<\/span>\n<span id=\"cb4-4\"><a href=\"#cb4-4\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb4-5\"><a href=\"#cb4-5\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb4-6\"><a href=\"#cb4-6\" aria-hidden=\"true\"><\/a>        the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb4-7\"><a href=\"#cb4-7\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-8\"><a href=\"#cb4-8\" aria-hidden=\"true\"><\/a>        &lt;article id=<span class=\"st\">&quot;post-&lt;?php the_ID(); ?&gt;&quot;<\/span> &lt;<span class=\"ot\">?<\/span>php post_class<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&gt;<\/span>\n<span id=\"cb4-9\"><a href=\"#cb4-9\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"fu\">header<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;entry-header&quot;<\/span>&gt;<\/span>\n<span id=\"cb4-10\"><a href=\"#cb4-10\" aria-hidden=\"true\"><\/a>                &lt;<span class=\"ot\">?<\/span>php the_title<span class=\"ot\">(<\/span><span class=\"st\">&#39;&lt;h1&gt;&#39;<\/span><span class=\"ot\">,<\/span> <span class=\"st\">&#39;&lt;\/h1&gt;&#39;<\/span><span class=\"ot\">);<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-11\"><a href=\"#cb4-11\" aria-hidden=\"true\"><\/a>                &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;entry-meta&quot;<\/span>&gt;<\/span>\n<span id=\"cb4-12\"><a href=\"#cb4-12\" aria-hidden=\"true\"><\/a>                    Posted on &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">echo<\/span> get_the_date<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span> by &lt;<span class=\"ot\">?<\/span>php the_author<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-13\"><a href=\"#cb4-13\" aria-hidden=\"true\"><\/a>                &lt;\/div&gt;<\/span>\n<span id=\"cb4-14\"><a href=\"#cb4-14\" aria-hidden=\"true\"><\/a>            &lt;\/<span class=\"fu\">header<\/span>&gt;<\/span>\n<span id=\"cb4-15\"><a href=\"#cb4-15\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb4-16\"><a href=\"#cb4-16\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>has_post_thumbnail<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-17\"><a href=\"#cb4-17\" aria-hidden=\"true\"><\/a>                &lt;<span class=\"ot\">?<\/span>php the_post_thumbnail<span class=\"ot\">(<\/span><span class=\"st\">&#39;large&#39;<\/span><span class=\"ot\">);<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-18\"><a href=\"#cb4-18\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-19\"><a href=\"#cb4-19\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb4-20\"><a href=\"#cb4-20\" aria-hidden=\"true\"><\/a>            &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;entry-content&quot;<\/span>&gt;<\/span>\n<span id=\"cb4-21\"><a href=\"#cb4-21\" aria-hidden=\"true\"><\/a>                &lt;<span class=\"ot\">?<\/span>php the_content<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-22\"><a href=\"#cb4-22\" aria-hidden=\"true\"><\/a>            &lt;\/div&gt;<\/span>\n<span id=\"cb4-23\"><a href=\"#cb4-23\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb4-24\"><a href=\"#cb4-24\" aria-hidden=\"true\"><\/a>            &lt;footer <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;entry-footer&quot;<\/span>&gt;<\/span>\n<span id=\"cb4-25\"><a href=\"#cb4-25\" aria-hidden=\"true\"><\/a>                &lt;<span class=\"ot\">?<\/span>php the_tags<span class=\"ot\">(<\/span><span class=\"st\">&#39;&lt;span class=&quot;tags&quot;&gt;&#39;<\/span><span class=\"ot\">,<\/span> <span class=\"st\">&#39;, &#39;<\/span><span class=\"ot\">,<\/span> <span class=\"st\">&#39;&lt;\/span&gt;&#39;<\/span><span class=\"ot\">);<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-26\"><a href=\"#cb4-26\" aria-hidden=\"true\"><\/a>            &lt;\/footer&gt;<\/span>\n<span id=\"cb4-27\"><a href=\"#cb4-27\" aria-hidden=\"true\"><\/a>        &lt;\/article&gt;<\/span>\n<span id=\"cb4-28\"><a href=\"#cb4-28\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb4-29\"><a href=\"#cb4-29\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb4-30\"><a href=\"#cb4-30\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>comments_open<span class=\"ot\">()<\/span> || get_comments_number<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb4-31\"><a href=\"#cb4-31\" aria-hidden=\"true\"><\/a>            comments_template<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb4-32\"><a href=\"#cb4-32\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb4-33\"><a href=\"#cb4-33\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb4-34\"><a href=\"#cb4-34\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-35\"><a href=\"#cb4-35\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb4-36\"><a href=\"#cb4-36\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb4-37\"><a href=\"#cb4-37\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_sidebar<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb4-38\"><a href=\"#cb4-38\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"page-templates\">Page Templates<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>{custom-template}.php (selected via admin)\npage-{slug}.php\npage-{id}.php\npage.php\nsingular.php\nindex.php<\/code><\/pre>\n<p><strong>Examples<\/strong>:<\/p>\n<p>Page slug <code>about<\/code>:<\/p>\n<ul>\n<li>Custom template (if selected in admin)<\/li>\n<li><code>page-about.php<\/code><\/li>\n<li><code>page-42.php<\/code> (if page ID is 42)<\/li>\n<li><code>page.php<\/code><\/li>\n<li><code>singular.php<\/code><\/li>\n<li><code>index.php<\/code><\/li>\n<\/ul>\n<p><strong>page.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb6\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb6-1\"><a href=\"#cb6-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb6-2\"><a href=\"#cb6-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb6-3\"><a href=\"#cb6-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span>&gt;<\/span>\n<span id=\"cb6-4\"><a href=\"#cb6-4\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb6-5\"><a href=\"#cb6-5\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb6-6\"><a href=\"#cb6-6\" aria-hidden=\"true\"><\/a>        the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb6-7\"><a href=\"#cb6-7\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb6-8\"><a href=\"#cb6-8\" aria-hidden=\"true\"><\/a>        &lt;article id=<span class=\"st\">&quot;page-&lt;?php the_ID(); ?&gt;&quot;<\/span> &lt;<span class=\"ot\">?<\/span>php post_class<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&gt;<\/span>\n<span id=\"cb6-9\"><a href=\"#cb6-9\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"fu\">header<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;entry-header&quot;<\/span>&gt;<\/span>\n<span id=\"cb6-10\"><a href=\"#cb6-10\" aria-hidden=\"true\"><\/a>                &lt;<span class=\"ot\">?<\/span>php the_title<span class=\"ot\">(<\/span><span class=\"st\">&#39;&lt;h1&gt;&#39;<\/span><span class=\"ot\">,<\/span> <span class=\"st\">&#39;&lt;\/h1&gt;&#39;<\/span><span class=\"ot\">);<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb6-11\"><a href=\"#cb6-11\" aria-hidden=\"true\"><\/a>            &lt;\/<span class=\"fu\">header<\/span>&gt;<\/span>\n<span id=\"cb6-12\"><a href=\"#cb6-12\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb6-13\"><a href=\"#cb6-13\" aria-hidden=\"true\"><\/a>            &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;entry-content&quot;<\/span>&gt;<\/span>\n<span id=\"cb6-14\"><a href=\"#cb6-14\" aria-hidden=\"true\"><\/a>                &lt;<span class=\"ot\">?<\/span>php the_content<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb6-15\"><a href=\"#cb6-15\" aria-hidden=\"true\"><\/a>            &lt;\/div&gt;<\/span>\n<span id=\"cb6-16\"><a href=\"#cb6-16\" aria-hidden=\"true\"><\/a>        &lt;\/article&gt;<\/span>\n<span id=\"cb6-17\"><a href=\"#cb6-17\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb6-18\"><a href=\"#cb6-18\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb6-19\"><a href=\"#cb6-19\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb6-20\"><a href=\"#cb6-20\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<p><strong>Custom Page Template<\/strong>:<\/p>\n<p><code>template-fullwidth.php<\/code>:<\/p>\n<div class=\"sourceCode\" id=\"cb7\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb7-1\"><a href=\"#cb7-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span><\/span>\n<span id=\"cb7-2\"><a href=\"#cb7-2\" aria-hidden=\"true\"><\/a><span class=\"co\">\/**<\/span><\/span>\n<span id=\"cb7-3\"><a href=\"#cb7-3\" aria-hidden=\"true\"><\/a><span class=\"co\"> * Template Name: Full Width<\/span><\/span>\n<span id=\"cb7-4\"><a href=\"#cb7-4\" aria-hidden=\"true\"><\/a><span class=\"co\"> * Template Post Type: page, post<\/span><\/span>\n<span id=\"cb7-5\"><a href=\"#cb7-5\" aria-hidden=\"true\"><\/a><span class=\"co\"> *\/<\/span><\/span>\n<span id=\"cb7-6\"><a href=\"#cb7-6\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb7-7\"><a href=\"#cb7-7\" aria-hidden=\"true\"><\/a>get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb7-8\"><a href=\"#cb7-8\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb7-9\"><a href=\"#cb7-9\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;full-width&quot;<\/span>&gt;<\/span>\n<span id=\"cb7-10\"><a href=\"#cb7-10\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb7-11\"><a href=\"#cb7-11\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb7-12\"><a href=\"#cb7-12\" aria-hidden=\"true\"><\/a>        the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb7-13\"><a href=\"#cb7-13\" aria-hidden=\"true\"><\/a>        the_content<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb7-14\"><a href=\"#cb7-14\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb7-15\"><a href=\"#cb7-15\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb7-16\"><a href=\"#cb7-16\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb7-17\"><a href=\"#cb7-17\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb7-18\"><a href=\"#cb7-18\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<p>Selectable via: Page edit screen \u2192 Page Attributes \u2192 Template<\/p>\n<h2 id=\"category-archive-templates\">Category Archive Templates<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>category-{slug}.php\ncategory-{id}.php\ncategory.php\narchive.php\nindex.php<\/code><\/pre>\n<p><strong>Examples<\/strong>:<\/p>\n<p>Category slug <code>news<\/code> (ID 5):<\/p>\n<ul>\n<li><code>category-news.php<\/code><\/li>\n<li><code>category-5.php<\/code><\/li>\n<li><code>category.php<\/code><\/li>\n<li><code>archive.php<\/code><\/li>\n<li><code>index.php<\/code><\/li>\n<\/ul>\n<p><strong>category.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb9\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb9-1\"><a href=\"#cb9-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-2\"><a href=\"#cb9-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb9-3\"><a href=\"#cb9-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span>&gt;<\/span>\n<span id=\"cb9-4\"><a href=\"#cb9-4\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"fu\">header<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;page-header&quot;<\/span>&gt;<\/span>\n<span id=\"cb9-5\"><a href=\"#cb9-5\" aria-hidden=\"true\"><\/a>        &lt;h1&gt;&lt;<span class=\"ot\">?<\/span>php single_cat_title<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&lt;\/h1&gt;<\/span>\n<span id=\"cb9-6\"><a href=\"#cb9-6\" aria-hidden=\"true\"><\/a>        &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;category-description&quot;<\/span>&gt;<\/span>\n<span id=\"cb9-7\"><a href=\"#cb9-7\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">echo<\/span> category_description<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-8\"><a href=\"#cb9-8\" aria-hidden=\"true\"><\/a>        &lt;\/div&gt;<\/span>\n<span id=\"cb9-9\"><a href=\"#cb9-9\" aria-hidden=\"true\"><\/a>    &lt;\/<span class=\"fu\">header<\/span>&gt;<\/span>\n<span id=\"cb9-10\"><a href=\"#cb9-10\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb9-11\"><a href=\"#cb9-11\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-12\"><a href=\"#cb9-12\" aria-hidden=\"true\"><\/a>        &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;posts-list&quot;<\/span>&gt;<\/span>\n<span id=\"cb9-13\"><a href=\"#cb9-13\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb9-14\"><a href=\"#cb9-14\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb9-15\"><a href=\"#cb9-15\" aria-hidden=\"true\"><\/a>                the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb9-16\"><a href=\"#cb9-16\" aria-hidden=\"true\"><\/a>                <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-17\"><a href=\"#cb9-17\" aria-hidden=\"true\"><\/a>                &lt;article id=<span class=\"st\">&quot;post-&lt;?php the_ID(); ?&gt;&quot;<\/span> &lt;<span class=\"ot\">?<\/span>php post_class<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&gt;<\/span>\n<span id=\"cb9-18\"><a href=\"#cb9-18\" aria-hidden=\"true\"><\/a>                    &lt;h2&gt;&lt;a href=<span class=\"st\">&quot;&lt;?php the_permalink(); ?&gt;&quot;<\/span>&gt;&lt;<span class=\"ot\">?<\/span>php the_title<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&lt;\/a&gt;&lt;\/h2&gt;<\/span>\n<span id=\"cb9-19\"><a href=\"#cb9-19\" aria-hidden=\"true\"><\/a>                    &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;entry-summary&quot;<\/span>&gt;<\/span>\n<span id=\"cb9-20\"><a href=\"#cb9-20\" aria-hidden=\"true\"><\/a>                        &lt;<span class=\"ot\">?<\/span>php the_excerpt<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-21\"><a href=\"#cb9-21\" aria-hidden=\"true\"><\/a>                    &lt;\/div&gt;<\/span>\n<span id=\"cb9-22\"><a href=\"#cb9-22\" aria-hidden=\"true\"><\/a>                &lt;\/article&gt;<\/span>\n<span id=\"cb9-23\"><a href=\"#cb9-23\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-24\"><a href=\"#cb9-24\" aria-hidden=\"true\"><\/a>        &lt;\/div&gt;<\/span>\n<span id=\"cb9-25\"><a href=\"#cb9-25\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb9-26\"><a href=\"#cb9-26\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php the_posts_pagination<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-27\"><a href=\"#cb9-27\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">else<\/span> <span class=\"ot\">:<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-28\"><a href=\"#cb9-28\" aria-hidden=\"true\"><\/a>        &lt;p&gt;No posts found in this category.&lt;\/p&gt;<\/span>\n<span id=\"cb9-29\"><a href=\"#cb9-29\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-30\"><a href=\"#cb9-30\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb9-31\"><a href=\"#cb9-31\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb9-32\"><a href=\"#cb9-32\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_sidebar<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb9-33\"><a href=\"#cb9-33\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"tag-archive-templates\">Tag Archive Templates<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>tag-{slug}.php\ntag-{id}.php\ntag.php\narchive.php\nindex.php<\/code><\/pre>\n<p><strong>Examples<\/strong>:<\/p>\n<p>Tag slug <code>wordpress<\/code> (ID 10):<\/p>\n<ul>\n<li><code>tag-wordpress.php<\/code><\/li>\n<li><code>tag-10.php<\/code><\/li>\n<li><code>tag.php<\/code><\/li>\n<li><code>archive.php<\/code><\/li>\n<li><code>index.php<\/code><\/li>\n<\/ul>\n<h2 id=\"custom-post-type-archives\">Custom Post Type Archives<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>archive-{post-type}.php\narchive.php\nindex.php<\/code><\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<p>Portfolio post type:<\/p>\n<ul>\n<li><code>archive-portfolio.php<\/code><\/li>\n<li><code>archive.php<\/code><\/li>\n<li><code>index.php<\/code><\/li>\n<\/ul>\n<p><strong>archive-portfolio.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb12\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb12-1\"><a href=\"#cb12-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb12-2\"><a href=\"#cb12-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb12-3\"><a href=\"#cb12-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span>&gt;<\/span>\n<span id=\"cb12-4\"><a href=\"#cb12-4\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"fu\">header<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;page-header&quot;<\/span>&gt;<\/span>\n<span id=\"cb12-5\"><a href=\"#cb12-5\" aria-hidden=\"true\"><\/a>        &lt;h1&gt;Portfolio&lt;\/h1&gt;<\/span>\n<span id=\"cb12-6\"><a href=\"#cb12-6\" aria-hidden=\"true\"><\/a>    &lt;\/<span class=\"fu\">header<\/span>&gt;<\/span>\n<span id=\"cb12-7\"><a href=\"#cb12-7\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb12-8\"><a href=\"#cb12-8\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb12-9\"><a href=\"#cb12-9\" aria-hidden=\"true\"><\/a>        &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;portfolio-grid&quot;<\/span>&gt;<\/span>\n<span id=\"cb12-10\"><a href=\"#cb12-10\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb12-11\"><a href=\"#cb12-11\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb12-12\"><a href=\"#cb12-12\" aria-hidden=\"true\"><\/a>                the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb12-13\"><a href=\"#cb12-13\" aria-hidden=\"true\"><\/a>                <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb12-14\"><a href=\"#cb12-14\" aria-hidden=\"true\"><\/a>                &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;portfolio-item&quot;<\/span>&gt;<\/span>\n<span id=\"cb12-15\"><a href=\"#cb12-15\" aria-hidden=\"true\"><\/a>                    &lt;a href=<span class=\"st\">&quot;&lt;?php the_permalink(); ?&gt;&quot;<\/span>&gt;<\/span>\n<span id=\"cb12-16\"><a href=\"#cb12-16\" aria-hidden=\"true\"><\/a>                        &lt;<span class=\"ot\">?<\/span>php the_post_thumbnail<span class=\"ot\">(<\/span><span class=\"st\">&#39;medium&#39;<\/span><span class=\"ot\">);<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb12-17\"><a href=\"#cb12-17\" aria-hidden=\"true\"><\/a>                        &lt;h3&gt;&lt;<span class=\"ot\">?<\/span>php the_title<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&lt;\/h3&gt;<\/span>\n<span id=\"cb12-18\"><a href=\"#cb12-18\" aria-hidden=\"true\"><\/a>                    &lt;\/a&gt;<\/span>\n<span id=\"cb12-19\"><a href=\"#cb12-19\" aria-hidden=\"true\"><\/a>                &lt;\/div&gt;<\/span>\n<span id=\"cb12-20\"><a href=\"#cb12-20\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb12-21\"><a href=\"#cb12-21\" aria-hidden=\"true\"><\/a>        &lt;\/div&gt;<\/span>\n<span id=\"cb12-22\"><a href=\"#cb12-22\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb12-23\"><a href=\"#cb12-23\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php the_posts_pagination<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb12-24\"><a href=\"#cb12-24\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb12-25\"><a href=\"#cb12-25\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb12-26\"><a href=\"#cb12-26\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb12-27\"><a href=\"#cb12-27\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"custom-taxonomy-templates\">Custom Taxonomy Templates<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>taxonomy-{taxonomy}-{term}.php\ntaxonomy-{taxonomy}.php\ntaxonomy.php\narchive.php\nindex.php<\/code><\/pre>\n<p><strong>Example<\/strong>:<\/p>\n<p>Taxonomy <code>portfolio_category<\/code>, term <code>web-design<\/code>:<\/p>\n<ul>\n<li><code>taxonomy-portfolio_category-web-design.php<\/code><\/li>\n<li><code>taxonomy-portfolio_category.php<\/code><\/li>\n<li><code>taxonomy.php<\/code><\/li>\n<li><code>archive.php<\/code><\/li>\n<li><code>index.php<\/code><\/li>\n<\/ul>\n<h2 id=\"author-archive-templates\">Author Archive Templates<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>author-{nicename}.php\nauthor-{id}.php\nauthor.php\narchive.php\nindex.php<\/code><\/pre>\n<p><strong>author.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb15\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb15-1\"><a href=\"#cb15-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb15-2\"><a href=\"#cb15-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb15-3\"><a href=\"#cb15-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span>&gt;<\/span>\n<span id=\"cb15-4\"><a href=\"#cb15-4\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"fu\">header<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;author-header&quot;<\/span>&gt;<\/span>\n<span id=\"cb15-5\"><a href=\"#cb15-5\" aria-hidden=\"true\"><\/a>        &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;author-avatar&quot;<\/span>&gt;<\/span>\n<span id=\"cb15-6\"><a href=\"#cb15-6\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">echo<\/span> get_avatar<span class=\"ot\">(<\/span>get_the_author_meta<span class=\"ot\">(<\/span><span class=\"st\">&#39;ID&#39;<\/span><span class=\"ot\">),<\/span> <span class=\"dv\">150<\/span><span class=\"ot\">);<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb15-7\"><a href=\"#cb15-7\" aria-hidden=\"true\"><\/a>        &lt;\/div&gt;<\/span>\n<span id=\"cb15-8\"><a href=\"#cb15-8\" aria-hidden=\"true\"><\/a>        &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;author-info&quot;<\/span>&gt;<\/span>\n<span id=\"cb15-9\"><a href=\"#cb15-9\" aria-hidden=\"true\"><\/a>            &lt;h1&gt;&lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">echo<\/span> get_the_author<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&lt;\/h1&gt;<\/span>\n<span id=\"cb15-10\"><a href=\"#cb15-10\" aria-hidden=\"true\"><\/a>            &lt;p <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;author-bio&quot;<\/span>&gt;&lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">echo<\/span> get_the_author_meta<span class=\"ot\">(<\/span><span class=\"st\">&#39;description&#39;<\/span><span class=\"ot\">);<\/span> <span class=\"kw\">?&gt;<\/span>&lt;\/p&gt;<\/span>\n<span id=\"cb15-11\"><a href=\"#cb15-11\" aria-hidden=\"true\"><\/a>        &lt;\/div&gt;<\/span>\n<span id=\"cb15-12\"><a href=\"#cb15-12\" aria-hidden=\"true\"><\/a>    &lt;\/<span class=\"fu\">header<\/span>&gt;<\/span>\n<span id=\"cb15-13\"><a href=\"#cb15-13\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb15-14\"><a href=\"#cb15-14\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb15-15\"><a href=\"#cb15-15\" aria-hidden=\"true\"><\/a>        &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;author-posts&quot;<\/span>&gt;<\/span>\n<span id=\"cb15-16\"><a href=\"#cb15-16\" aria-hidden=\"true\"><\/a>            &lt;h2&gt;Posts by &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">echo<\/span> get_the_author<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&lt;\/h2&gt;<\/span>\n<span id=\"cb15-17\"><a href=\"#cb15-17\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb15-18\"><a href=\"#cb15-18\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb15-19\"><a href=\"#cb15-19\" aria-hidden=\"true\"><\/a>                the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb15-20\"><a href=\"#cb15-20\" aria-hidden=\"true\"><\/a>                get_template_part<span class=\"ot\">(<\/span><span class=\"st\">&#39;template-parts\/content&#39;<\/span><span class=\"ot\">,<\/span> <span class=\"st\">&#39;excerpt&#39;<\/span><span class=\"ot\">);<\/span><\/span>\n<span id=\"cb15-21\"><a href=\"#cb15-21\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb15-22\"><a href=\"#cb15-22\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb15-23\"><a href=\"#cb15-23\" aria-hidden=\"true\"><\/a>        &lt;\/div&gt;<\/span>\n<span id=\"cb15-24\"><a href=\"#cb15-24\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb15-25\"><a href=\"#cb15-25\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php the_posts_pagination<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb15-26\"><a href=\"#cb15-26\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb15-27\"><a href=\"#cb15-27\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb15-28\"><a href=\"#cb15-28\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb15-29\"><a href=\"#cb15-29\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_sidebar<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb15-30\"><a href=\"#cb15-30\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"date-archive-templates\">Date Archive Templates<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>date.php\narchive.php\nindex.php<\/code><\/pre>\n<p><strong>date.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb17\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb17-1\"><a href=\"#cb17-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb17-2\"><a href=\"#cb17-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb17-3\"><a href=\"#cb17-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span>&gt;<\/span>\n<span id=\"cb17-4\"><a href=\"#cb17-4\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"fu\">header<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;page-header&quot;<\/span>&gt;<\/span>\n<span id=\"cb17-5\"><a href=\"#cb17-5\" aria-hidden=\"true\"><\/a>        &lt;h1&gt;<\/span>\n<span id=\"cb17-6\"><a href=\"#cb17-6\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb17-7\"><a href=\"#cb17-7\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>is_day<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb17-8\"><a href=\"#cb17-8\" aria-hidden=\"true\"><\/a>                <span class=\"fu\">printf<\/span><span class=\"ot\">(<\/span><span class=\"st\">&#39;Archives: %s&#39;<\/span><span class=\"ot\">,<\/span> get_the_date<span class=\"ot\">());<\/span><\/span>\n<span id=\"cb17-9\"><a href=\"#cb17-9\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">elseif<\/span> <span class=\"ot\">(<\/span>is_month<span class=\"ot\">())<\/span> :<\/span>\n<span id=\"cb17-10\"><a href=\"#cb17-10\" aria-hidden=\"true\"><\/a>                <span class=\"fu\">printf<\/span><span class=\"ot\">(<\/span><span class=\"st\">&#39;Archives: %s&#39;<\/span><span class=\"ot\">,<\/span> get_the_date<span class=\"ot\">(<\/span><span class=\"st\">&#39;F Y&#39;<\/span><span class=\"ot\">));<\/span><\/span>\n<span id=\"cb17-11\"><a href=\"#cb17-11\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">elseif<\/span> <span class=\"ot\">(<\/span>is_year<span class=\"ot\">())<\/span> :<\/span>\n<span id=\"cb17-12\"><a href=\"#cb17-12\" aria-hidden=\"true\"><\/a>                <span class=\"fu\">printf<\/span><span class=\"ot\">(<\/span><span class=\"st\">&#39;Archives: %s&#39;<\/span><span class=\"ot\">,<\/span> get_the_date<span class=\"ot\">(<\/span><span class=\"st\">&#39;Y&#39;<\/span><span class=\"ot\">));<\/span><\/span>\n<span id=\"cb17-13\"><a href=\"#cb17-13\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb17-14\"><a href=\"#cb17-14\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb17-15\"><a href=\"#cb17-15\" aria-hidden=\"true\"><\/a>        &lt;\/h1&gt;<\/span>\n<span id=\"cb17-16\"><a href=\"#cb17-16\" aria-hidden=\"true\"><\/a>    &lt;\/<span class=\"fu\">header<\/span>&gt;<\/span>\n<span id=\"cb17-17\"><a href=\"#cb17-17\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb17-18\"><a href=\"#cb17-18\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb17-19\"><a href=\"#cb17-19\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb17-20\"><a href=\"#cb17-20\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb17-21\"><a href=\"#cb17-21\" aria-hidden=\"true\"><\/a>            the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb17-22\"><a href=\"#cb17-22\" aria-hidden=\"true\"><\/a>            get_template_part<span class=\"ot\">(<\/span><span class=\"st\">&#39;template-parts\/content&#39;<\/span><span class=\"ot\">,<\/span> <span class=\"st\">&#39;archive&#39;<\/span><span class=\"ot\">);<\/span><\/span>\n<span id=\"cb17-23\"><a href=\"#cb17-23\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb17-24\"><a href=\"#cb17-24\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb17-25\"><a href=\"#cb17-25\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb17-26\"><a href=\"#cb17-26\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php the_posts_pagination<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb17-27\"><a href=\"#cb17-27\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb17-28\"><a href=\"#cb17-28\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb17-29\"><a href=\"#cb17-29\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb17-30\"><a href=\"#cb17-30\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_sidebar<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb17-31\"><a href=\"#cb17-31\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"search-results-template\">Search Results Template<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>search.php\nindex.php<\/code><\/pre>\n<p><strong>search.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb19\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb19-1\"><a href=\"#cb19-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-2\"><a href=\"#cb19-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb19-3\"><a href=\"#cb19-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span>&gt;<\/span>\n<span id=\"cb19-4\"><a href=\"#cb19-4\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"fu\">header<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;page-header&quot;<\/span>&gt;<\/span>\n<span id=\"cb19-5\"><a href=\"#cb19-5\" aria-hidden=\"true\"><\/a>        &lt;h1&gt;<\/span>\n<span id=\"cb19-6\"><a href=\"#cb19-6\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php <span class=\"fu\">printf<\/span><span class=\"ot\">(<\/span><span class=\"st\">&#39;Search Results for: %s&#39;<\/span><span class=\"ot\">,<\/span> <span class=\"st\">&#39;&lt;span&gt;&#39;<\/span> . get_search_query<span class=\"ot\">()<\/span> . <span class=\"st\">&#39;&lt;\/span&gt;&#39;<\/span><span class=\"ot\">);<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-7\"><a href=\"#cb19-7\" aria-hidden=\"true\"><\/a>        &lt;\/h1&gt;<\/span>\n<span id=\"cb19-8\"><a href=\"#cb19-8\" aria-hidden=\"true\"><\/a>    &lt;\/<span class=\"fu\">header<\/span>&gt;<\/span>\n<span id=\"cb19-9\"><a href=\"#cb19-9\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb19-10\"><a href=\"#cb19-10\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-11\"><a href=\"#cb19-11\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb19-12\"><a href=\"#cb19-12\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span>have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb19-13\"><a href=\"#cb19-13\" aria-hidden=\"true\"><\/a>            the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb19-14\"><a href=\"#cb19-14\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-15\"><a href=\"#cb19-15\" aria-hidden=\"true\"><\/a>            &lt;article&gt;<\/span>\n<span id=\"cb19-16\"><a href=\"#cb19-16\" aria-hidden=\"true\"><\/a>                &lt;h2&gt;&lt;a href=<span class=\"st\">&quot;&lt;?php the_permalink(); ?&gt;&quot;<\/span>&gt;&lt;<span class=\"ot\">?<\/span>php the_title<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span>&lt;\/a&gt;&lt;\/h2&gt;<\/span>\n<span id=\"cb19-17\"><a href=\"#cb19-17\" aria-hidden=\"true\"><\/a>                &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;entry-summary&quot;<\/span>&gt;<\/span>\n<span id=\"cb19-18\"><a href=\"#cb19-18\" aria-hidden=\"true\"><\/a>                    &lt;<span class=\"ot\">?<\/span>php the_excerpt<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-19\"><a href=\"#cb19-19\" aria-hidden=\"true\"><\/a>                &lt;\/div&gt;<\/span>\n<span id=\"cb19-20\"><a href=\"#cb19-20\" aria-hidden=\"true\"><\/a>            &lt;\/article&gt;<\/span>\n<span id=\"cb19-21\"><a href=\"#cb19-21\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-22\"><a href=\"#cb19-22\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb19-23\"><a href=\"#cb19-23\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php the_posts_pagination<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-24\"><a href=\"#cb19-24\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">else<\/span> <span class=\"ot\">:<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-25\"><a href=\"#cb19-25\" aria-hidden=\"true\"><\/a>        &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;no-results&quot;<\/span>&gt;<\/span>\n<span id=\"cb19-26\"><a href=\"#cb19-26\" aria-hidden=\"true\"><\/a>            &lt;p&gt;No results found. Please <span class=\"kw\">try<\/span> different keywords.&lt;\/p&gt;<\/span>\n<span id=\"cb19-27\"><a href=\"#cb19-27\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php get_search_form<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-28\"><a href=\"#cb19-28\" aria-hidden=\"true\"><\/a>        &lt;\/div&gt;<\/span>\n<span id=\"cb19-29\"><a href=\"#cb19-29\" aria-hidden=\"true\"><\/a>    &lt;<span class=\"ot\">?<\/span>php <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-30\"><a href=\"#cb19-30\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb19-31\"><a href=\"#cb19-31\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb19-32\"><a href=\"#cb19-32\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_sidebar<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb19-33\"><a href=\"#cb19-33\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"error-template\">404 Error Template<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>404.php\nindex.php<\/code><\/pre>\n<p><strong>404.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb21\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb21-1\"><a href=\"#cb21-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb21-2\"><a href=\"#cb21-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb21-3\"><a href=\"#cb21-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span>&gt;<\/span>\n<span id=\"cb21-4\"><a href=\"#cb21-4\" aria-hidden=\"true\"><\/a>    &lt;section <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;error-404&quot;<\/span>&gt;<\/span>\n<span id=\"cb21-5\"><a href=\"#cb21-5\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"fu\">header<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;page-header&quot;<\/span>&gt;<\/span>\n<span id=\"cb21-6\"><a href=\"#cb21-6\" aria-hidden=\"true\"><\/a>            &lt;h1&gt;<span class=\"dv\">404<\/span>: Page Not Found&lt;\/h1&gt;<\/span>\n<span id=\"cb21-7\"><a href=\"#cb21-7\" aria-hidden=\"true\"><\/a>        &lt;\/<span class=\"fu\">header<\/span>&gt;<\/span>\n<span id=\"cb21-8\"><a href=\"#cb21-8\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb21-9\"><a href=\"#cb21-9\" aria-hidden=\"true\"><\/a>        &lt;div <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;page-content&quot;<\/span>&gt;<\/span>\n<span id=\"cb21-10\"><a href=\"#cb21-10\" aria-hidden=\"true\"><\/a>            &lt;p&gt;The page you are looking <span class=\"kw\">for<\/span> might have been removed<span class=\"ot\">,<\/span> had its name changed<span class=\"ot\">,<\/span> <span class=\"kw\">or<\/span> is temporarily unavailable.&lt;\/p&gt;<\/span>\n<span id=\"cb21-11\"><a href=\"#cb21-11\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb21-12\"><a href=\"#cb21-12\" aria-hidden=\"true\"><\/a>            &lt;h2&gt;<span class=\"kw\">Try<\/span> searching:&lt;\/h2&gt;<\/span>\n<span id=\"cb21-13\"><a href=\"#cb21-13\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php get_search_form<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb21-14\"><a href=\"#cb21-14\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb21-15\"><a href=\"#cb21-15\" aria-hidden=\"true\"><\/a>            &lt;h2&gt;Popular Posts:&lt;\/h2&gt;<\/span>\n<span id=\"cb21-16\"><a href=\"#cb21-16\" aria-hidden=\"true\"><\/a>            &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb21-17\"><a href=\"#cb21-17\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">$popular<\/span> = <span class=\"kw\">new<\/span> WP_Query<span class=\"ot\">(<\/span><span class=\"kw\">array<\/span><span class=\"ot\">(<\/span><\/span>\n<span id=\"cb21-18\"><a href=\"#cb21-18\" aria-hidden=\"true\"><\/a>                <span class=\"st\">&#39;posts_per_page&#39;<\/span> =&gt; <span class=\"dv\">5<\/span><span class=\"ot\">,<\/span><\/span>\n<span id=\"cb21-19\"><a href=\"#cb21-19\" aria-hidden=\"true\"><\/a>                <span class=\"st\">&#39;orderby&#39;<\/span> =&gt; <span class=\"st\">&#39;comment_count&#39;<\/span><\/span>\n<span id=\"cb21-20\"><a href=\"#cb21-20\" aria-hidden=\"true\"><\/a>            <span class=\"ot\">));<\/span><\/span>\n<span id=\"cb21-21\"><a href=\"#cb21-21\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb21-22\"><a href=\"#cb21-22\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span><span class=\"kw\">$popular<\/span>-&gt;have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb21-23\"><a href=\"#cb21-23\" aria-hidden=\"true\"><\/a>                <span class=\"kw\">echo<\/span> <span class=\"st\">&#39;&lt;ul&gt;&#39;<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb21-24\"><a href=\"#cb21-24\" aria-hidden=\"true\"><\/a>                <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span><span class=\"kw\">$popular<\/span>-&gt;have_posts<span class=\"ot\">())<\/span> :<\/span>\n<span id=\"cb21-25\"><a href=\"#cb21-25\" aria-hidden=\"true\"><\/a>                    <span class=\"kw\">$popular<\/span>-&gt;the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb21-26\"><a href=\"#cb21-26\" aria-hidden=\"true\"><\/a>                    <span class=\"kw\">echo<\/span> <span class=\"st\">&#39;&lt;li&gt;&lt;a href=&quot;&#39;<\/span> . get_permalink<span class=\"ot\">()<\/span> . <span class=\"st\">&#39;&quot;&gt;&#39;<\/span> . get_the_title<span class=\"ot\">()<\/span> . <span class=\"st\">&#39;&lt;\/a&gt;&lt;\/li&gt;&#39;<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb21-27\"><a href=\"#cb21-27\" aria-hidden=\"true\"><\/a>                <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb21-28\"><a href=\"#cb21-28\" aria-hidden=\"true\"><\/a>                <span class=\"kw\">echo<\/span> <span class=\"st\">&#39;&lt;\/ul&gt;&#39;<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb21-29\"><a href=\"#cb21-29\" aria-hidden=\"true\"><\/a>                wp_reset_postdata<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb21-30\"><a href=\"#cb21-30\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb21-31\"><a href=\"#cb21-31\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb21-32\"><a href=\"#cb21-32\" aria-hidden=\"true\"><\/a>        &lt;\/div&gt;<\/span>\n<span id=\"cb21-33\"><a href=\"#cb21-33\" aria-hidden=\"true\"><\/a>    &lt;\/section&gt;<\/span>\n<span id=\"cb21-34\"><a href=\"#cb21-34\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb21-35\"><a href=\"#cb21-35\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb21-36\"><a href=\"#cb21-36\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"attachment-template\">Attachment Template<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>{MIME_type}.php (image.php, video.php, application.php)\nattachment.php\nsingle-attachment-{slug}.php\nsingle-attachment.php\nsingle.php\nsingular.php\nindex.php<\/code><\/pre>\n<h2 id=\"front-page-template\">Front Page Template<\/h2>\n<p><strong>Hierarchy<\/strong>:<\/p>\n<pre><code>front-page.php\nhome.php (if front page displays posts)\npage.php (if static front page set)\nindex.php<\/code><\/pre>\n<p><strong>front-page.php<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb24\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb24-1\"><a href=\"#cb24-1\" aria-hidden=\"true\"><\/a><span class=\"kw\">&lt;?php<\/span> get_header<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb24-2\"><a href=\"#cb24-2\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb24-3\"><a href=\"#cb24-3\" aria-hidden=\"true\"><\/a>&lt;main id=<span class=\"st\">&quot;primary&quot;<\/span> <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;front-page&quot;<\/span>&gt;<\/span>\n<span id=\"cb24-4\"><a href=\"#cb24-4\" aria-hidden=\"true\"><\/a>    &lt;section <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;hero&quot;<\/span>&gt;<\/span>\n<span id=\"cb24-5\"><a href=\"#cb24-5\" aria-hidden=\"true\"><\/a>        &lt;h1&gt;Welcome to Our Website&lt;\/h1&gt;<\/span>\n<span id=\"cb24-6\"><a href=\"#cb24-6\" aria-hidden=\"true\"><\/a>        &lt;p&gt;Featured content here&lt;\/p&gt;<\/span>\n<span id=\"cb24-7\"><a href=\"#cb24-7\" aria-hidden=\"true\"><\/a>    &lt;\/section&gt;<\/span>\n<span id=\"cb24-8\"><a href=\"#cb24-8\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb24-9\"><a href=\"#cb24-9\" aria-hidden=\"true\"><\/a>    &lt;section <span class=\"kw\">class<\/span>=<span class=\"st\">&quot;recent-posts&quot;<\/span>&gt;<\/span>\n<span id=\"cb24-10\"><a href=\"#cb24-10\" aria-hidden=\"true\"><\/a>        &lt;h2&gt;Latest Posts&lt;\/h2&gt;<\/span>\n<span id=\"cb24-11\"><a href=\"#cb24-11\" aria-hidden=\"true\"><\/a>        &lt;<span class=\"ot\">?<\/span>php<\/span>\n<span id=\"cb24-12\"><a href=\"#cb24-12\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">$recent_posts<\/span> = <span class=\"kw\">new<\/span> WP_Query<span class=\"ot\">(<\/span><span class=\"kw\">array<\/span><span class=\"ot\">(<\/span><\/span>\n<span id=\"cb24-13\"><a href=\"#cb24-13\" aria-hidden=\"true\"><\/a>            <span class=\"st\">&#39;posts_per_page&#39;<\/span> =&gt; <span class=\"dv\">3<\/span><span class=\"ot\">,<\/span><\/span>\n<span id=\"cb24-14\"><a href=\"#cb24-14\" aria-hidden=\"true\"><\/a>        <span class=\"ot\">));<\/span><\/span>\n<span id=\"cb24-15\"><a href=\"#cb24-15\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb24-16\"><a href=\"#cb24-16\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span><span class=\"kw\">$recent_posts<\/span>-&gt;have_posts<span class=\"ot\">())<\/span> <span class=\"ot\">:<\/span><\/span>\n<span id=\"cb24-17\"><a href=\"#cb24-17\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">while<\/span> <span class=\"ot\">(<\/span><span class=\"kw\">$recent_posts<\/span>-&gt;have_posts<span class=\"ot\">())<\/span> :<\/span>\n<span id=\"cb24-18\"><a href=\"#cb24-18\" aria-hidden=\"true\"><\/a>                <span class=\"kw\">$recent_posts<\/span>-&gt;the_post<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb24-19\"><a href=\"#cb24-19\" aria-hidden=\"true\"><\/a>                get_template_part<span class=\"ot\">(<\/span><span class=\"st\">&#39;template-parts\/content&#39;<\/span><span class=\"ot\">,<\/span> <span class=\"st\">&#39;excerpt&#39;<\/span><span class=\"ot\">);<\/span><\/span>\n<span id=\"cb24-20\"><a href=\"#cb24-20\" aria-hidden=\"true\"><\/a>            <span class=\"kw\">endwhile<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb24-21\"><a href=\"#cb24-21\" aria-hidden=\"true\"><\/a>            wp_reset_postdata<span class=\"ot\">();<\/span><\/span>\n<span id=\"cb24-22\"><a href=\"#cb24-22\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">endif<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb24-23\"><a href=\"#cb24-23\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">?&gt;<\/span><\/span>\n<span id=\"cb24-24\"><a href=\"#cb24-24\" aria-hidden=\"true\"><\/a>    &lt;\/section&gt;<\/span>\n<span id=\"cb24-25\"><a href=\"#cb24-25\" aria-hidden=\"true\"><\/a>&lt;\/main&gt;<\/span>\n<span id=\"cb24-26\"><a href=\"#cb24-26\" aria-hidden=\"true\"><\/a><\/span>\n<span id=\"cb24-27\"><a href=\"#cb24-27\" aria-hidden=\"true\"><\/a>&lt;<span class=\"ot\">?<\/span>php get_footer<span class=\"ot\">();<\/span> <span class=\"kw\">?&gt;<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"debugging-template-hierarchy\">Debugging Template Hierarchy<\/h2>\n<p><strong>Show Active Template<\/strong>:<\/p>\n<div class=\"sourceCode\" id=\"cb25\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb25-1\"><a href=\"#cb25-1\" aria-hidden=\"true\"><\/a><span class=\"co\">\/\/ Add to functions.php<\/span><\/span>\n<span id=\"cb25-2\"><a href=\"#cb25-2\" aria-hidden=\"true\"><\/a>add_filter<span class=\"ot\">(<\/span><span class=\"st\">&#39;template_include&#39;<\/span><span class=\"ot\">,<\/span> <span class=\"kw\">function<\/span><span class=\"ot\">(<\/span><span class=\"kw\">$template<\/span><span class=\"ot\">)<\/span> {<\/span>\n<span id=\"cb25-3\"><a href=\"#cb25-3\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">if<\/span> <span class=\"ot\">(<\/span>current_user_can<span class=\"ot\">(<\/span><span class=\"st\">&#39;manage_options&#39;<\/span><span class=\"ot\">))<\/span> {<\/span>\n<span id=\"cb25-4\"><a href=\"#cb25-4\" aria-hidden=\"true\"><\/a>        <span class=\"kw\">echo<\/span> <span class=\"st\">&#39;&lt;!-- Template: &#39;<\/span> . <span class=\"fu\">basename<\/span><span class=\"ot\">(<\/span><span class=\"kw\">$template<\/span><span class=\"ot\">)<\/span> . <span class=\"st\">&#39; --&gt;&#39;<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb25-5\"><a href=\"#cb25-5\" aria-hidden=\"true\"><\/a>    }<\/span>\n<span id=\"cb25-6\"><a href=\"#cb25-6\" aria-hidden=\"true\"><\/a>    <span class=\"kw\">return<\/span> <span class=\"kw\">$template<\/span><span class=\"ot\">;<\/span><\/span>\n<span id=\"cb25-7\"><a href=\"#cb25-7\" aria-hidden=\"true\"><\/a>}<span class=\"ot\">);<\/span><\/span><\/code><\/pre>\n<\/div>\n<p><strong>Query Monitor Plugin<\/strong>:<\/p>\n<p>Install Query Monitor plugin to see:<\/p>\n<ul>\n<li>Active template file<\/li>\n<li>Template hierarchy checked<\/li>\n<li>Conditional tags active<\/li>\n<\/ul>\n<p><strong>Conditional Tags<\/strong>:<\/p>\n<p>Determine current page type:<\/p>\n<div class=\"sourceCode\" id=\"cb26\">\n<pre class=\"sourceCode php\"><code class=\"sourceCode php\"><span id=\"cb26-1\"><a href=\"#cb26-1\" aria-hidden=\"true\"><\/a>is_home<span class=\"ot\">()<\/span>           <span class=\"co\">\/\/ Blog posts index<\/span><\/span>\n<span id=\"cb26-2\"><a href=\"#cb26-2\" aria-hidden=\"true\"><\/a>is_front_page<span class=\"ot\">()<\/span>     <span class=\"co\">\/\/ Front page (static or posts)<\/span><\/span>\n<span id=\"cb26-3\"><a href=\"#cb26-3\" aria-hidden=\"true\"><\/a>is_single<span class=\"ot\">()<\/span>         <span class=\"co\">\/\/ Single post<\/span><\/span>\n<span id=\"cb26-4\"><a href=\"#cb26-4\" aria-hidden=\"true\"><\/a>is_page<span class=\"ot\">()<\/span>           <span class=\"co\">\/\/ Single page<\/span><\/span>\n<span id=\"cb26-5\"><a href=\"#cb26-5\" aria-hidden=\"true\"><\/a>is_category<span class=\"ot\">()<\/span>       <span class=\"co\">\/\/ Category archive<\/span><\/span>\n<span id=\"cb26-6\"><a href=\"#cb26-6\" aria-hidden=\"true\"><\/a>is_tag<span class=\"ot\">()<\/span>            <span class=\"co\">\/\/ Tag archive<\/span><\/span>\n<span id=\"cb26-7\"><a href=\"#cb26-7\" aria-hidden=\"true\"><\/a>is_tax<span class=\"ot\">()<\/span>            <span class=\"co\">\/\/ Custom taxonomy archive<\/span><\/span>\n<span id=\"cb26-8\"><a href=\"#cb26-8\" aria-hidden=\"true\"><\/a>is_author<span class=\"ot\">()<\/span>         <span class=\"co\">\/\/ Author archive<\/span><\/span>\n<span id=\"cb26-9\"><a href=\"#cb26-9\" aria-hidden=\"true\"><\/a>is_date<span class=\"ot\">()<\/span>           <span class=\"co\">\/\/ Date archive<\/span><\/span>\n<span id=\"cb26-10\"><a href=\"#cb26-10\" aria-hidden=\"true\"><\/a>is_search<span class=\"ot\">()<\/span>         <span class=\"co\">\/\/ Search results<\/span><\/span>\n<span id=\"cb26-11\"><a href=\"#cb26-11\" aria-hidden=\"true\"><\/a>is_404<span class=\"ot\">()<\/span>            <span class=\"co\">\/\/ 404 error<\/span><\/span>\n<span id=\"cb26-12\"><a href=\"#cb26-12\" aria-hidden=\"true\"><\/a>is_archive<span class=\"ot\">()<\/span>        <span class=\"co\">\/\/ Any archive<\/span><\/span>\n<span id=\"cb26-13\"><a href=\"#cb26-13\" aria-hidden=\"true\"><\/a>is_singular<span class=\"ot\">()<\/span>       <span class=\"co\">\/\/ Single post or page<\/span><\/span><\/code><\/pre>\n<\/div>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>WordPress template hierarchy determines content display through systematic fallback from specific to general template files. Master single post hierarchy flowing from post-slug specificity to index.php fallback, understand archive template selection for categories, tags, and custom taxonomies, create custom page templates with Template Name headers, and utilize conditional tags identifying page types. Template hierarchy provides predictable template selection enabling precise control over WordPress content presentation across all post types and request types.<\/p>\n<h2 id=\"external-links\">External Links<\/h2>\n<ol type=\"1\">\n<li><a href=\"https:\/\/developer.wordpress.org\/themes\/basics\/template-hierarchy\/\">Template Hierarchy Documentation<\/a><\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/themes\/basics\/conditional-tags\/\">Conditional Tags Reference<\/a><\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/themes\/basics\/template-files\/\">Template Files List<\/a><\/li>\n<li><a href=\"https:\/\/wordpress.org\/plugins\/query-monitor\/\">Query Monitor Plugin<\/a><\/li>\n<li><a href=\"https:\/\/developer.wordpress.org\/files\/2014\/10\/Screenshot-2019-01-23.00.20.04.png\">Interactive Template Hierarchy<\/a><\/li>\n<\/ol>\n<h2 id=\"call-to-action\">Call to Action<\/h2>\n<p>Theme customizations need reliable backups. <a href=\"https:\/\/backupcopilotplugin.com\/\">Backup Copilot Pro<\/a> protects your WordPress theme files automatically. Safeguard your template modifications\u2014start your free 30-day trial today!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress template hierarchy determines which PHP template file displays content based on requested URL, following predictable fallback pattern from specific to general templates. From single-post-slug.php specificity to index.php fallback, understanding&#8230;<\/p>\n","protected":false},"author":1,"featured_media":362,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63],"tags":[692,691,690,686,588],"class_list":["post-183","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress-theme-development","tag-conditional-tags","tag-template-files","tag-template-hierarchy","tag-theme-structure","tag-wordpress-templates"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>WordPress Template Hierarchy: Complete Guide 2025<\/title>\n<meta name=\"description\" content=\"Master WordPress template hierarchy with complete visual guide. Learn template file selection, fallback system, and custom template creation with examples.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"WordPress Template Hierarchy: Complete Guide 2025\" \/>\n<meta property=\"og:description\" content=\"Master WordPress template hierarchy with complete visual guide. Learn template file selection, fallback system, and custom template creation with examples.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/\" \/>\n<meta property=\"og:site_name\" content=\"Developry Plugins\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-10T09:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"675\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Krasen Slavov\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Krasen Slavov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/\"},\"author\":{\"name\":\"Krasen Slavov\",\"@id\":\"https:\/\/developryplugins.com\/#\/schema\/person\/0530536578f952020ae227beb06a8daa\"},\"headline\":\"WordPress Theme Template Hierarchy Explained with Examples\",\"datePublished\":\"2025-12-10T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/\"},\"wordCount\":408,\"publisher\":{\"@id\":\"https:\/\/developryplugins.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png\",\"keywords\":[\"conditional tags\",\"template files\",\"template hierarchy\",\"theme structure\",\"wordpress templates\"],\"articleSection\":[\"WordPress Theme Development\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/\",\"url\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/\",\"name\":\"WordPress Template Hierarchy: Complete Guide 2025\",\"isPartOf\":{\"@id\":\"https:\/\/developryplugins.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png\",\"datePublished\":\"2025-12-10T09:00:00+00:00\",\"description\":\"Master WordPress template hierarchy with complete visual guide. Learn template file selection, fallback system, and custom template creation with examples.\",\"breadcrumb\":{\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#primaryimage\",\"url\":\"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png\",\"contentUrl\":\"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png\",\"width\":1200,\"height\":675},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/developryplugins.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"WordPress Theme Template Hierarchy Explained with Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/developryplugins.com\/#website\",\"url\":\"https:\/\/developryplugins.com\/\",\"name\":\"Developry Plugins\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/developryplugins.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/developryplugins.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/developryplugins.com\/#organization\",\"name\":\"Developry Plugins\",\"url\":\"https:\/\/developryplugins.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/developryplugins.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/logo-black.png\",\"contentUrl\":\"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/logo-black.png\",\"width\":481,\"height\":107,\"caption\":\"Developry Plugins\"},\"image\":{\"@id\":\"https:\/\/developryplugins.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/developryplugins.com\/#\/schema\/person\/0530536578f952020ae227beb06a8daa\",\"name\":\"Krasen Slavov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/developryplugins.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7f554a5fc7eb1b702429addccdcc3fca841a0ce02bd76b04d2725098fbf925b9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7f554a5fc7eb1b702429addccdcc3fca841a0ce02bd76b04d2725098fbf925b9?s=96&d=mm&r=g\",\"caption\":\"Krasen Slavov\"},\"sameAs\":[\"https:\/\/developryplugins.com\"],\"url\":\"https:\/\/developryplugins.com\/author\/slavovkrasen\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"WordPress Template Hierarchy: Complete Guide 2025","description":"Master WordPress template hierarchy with complete visual guide. Learn template file selection, fallback system, and custom template creation with examples.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/","og_locale":"en_US","og_type":"article","og_title":"WordPress Template Hierarchy: Complete Guide 2025","og_description":"Master WordPress template hierarchy with complete visual guide. Learn template file selection, fallback system, and custom template creation with examples.","og_url":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/","og_site_name":"Developry Plugins","article_published_time":"2025-12-10T09:00:00+00:00","og_image":[{"width":1200,"height":675,"url":"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png","type":"image\/png"}],"author":"Krasen Slavov","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Krasen Slavov","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#article","isPartOf":{"@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/"},"author":{"name":"Krasen Slavov","@id":"https:\/\/developryplugins.com\/#\/schema\/person\/0530536578f952020ae227beb06a8daa"},"headline":"WordPress Theme Template Hierarchy Explained with Examples","datePublished":"2025-12-10T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/"},"wordCount":408,"publisher":{"@id":"https:\/\/developryplugins.com\/#organization"},"image":{"@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png","keywords":["conditional tags","template files","template hierarchy","theme structure","wordpress templates"],"articleSection":["WordPress Theme Development"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/","url":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/","name":"WordPress Template Hierarchy: Complete Guide 2025","isPartOf":{"@id":"https:\/\/developryplugins.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#primaryimage"},"image":{"@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#primaryimage"},"thumbnailUrl":"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png","datePublished":"2025-12-10T09:00:00+00:00","description":"Master WordPress template hierarchy with complete visual guide. Learn template file selection, fallback system, and custom template creation with examples.","breadcrumb":{"@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#primaryimage","url":"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png","contentUrl":"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/featured-183-1763983099.png","width":1200,"height":675},{"@type":"BreadcrumbList","@id":"https:\/\/developryplugins.com\/wordpress-theme-template-hierarchy-explained-with-examples\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/developryplugins.com\/"},{"@type":"ListItem","position":2,"name":"WordPress Theme Template Hierarchy Explained with Examples"}]},{"@type":"WebSite","@id":"https:\/\/developryplugins.com\/#website","url":"https:\/\/developryplugins.com\/","name":"Developry Plugins","description":"","publisher":{"@id":"https:\/\/developryplugins.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/developryplugins.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/developryplugins.com\/#organization","name":"Developry Plugins","url":"https:\/\/developryplugins.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/developryplugins.com\/#\/schema\/logo\/image\/","url":"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/logo-black.png","contentUrl":"https:\/\/developryplugins.com\/wp-content\/uploads\/2025\/11\/logo-black.png","width":481,"height":107,"caption":"Developry Plugins"},"image":{"@id":"https:\/\/developryplugins.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/developryplugins.com\/#\/schema\/person\/0530536578f952020ae227beb06a8daa","name":"Krasen Slavov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/developryplugins.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7f554a5fc7eb1b702429addccdcc3fca841a0ce02bd76b04d2725098fbf925b9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7f554a5fc7eb1b702429addccdcc3fca841a0ce02bd76b04d2725098fbf925b9?s=96&d=mm&r=g","caption":"Krasen Slavov"},"sameAs":["https:\/\/developryplugins.com"],"url":"https:\/\/developryplugins.com\/author\/slavovkrasen\/"}]}},"_links":{"self":[{"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/posts\/183","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/comments?post=183"}],"version-history":[{"count":1,"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/posts\/183\/revisions"}],"predecessor-version":[{"id":199,"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/posts\/183\/revisions\/199"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/media\/362"}],"wp:attachment":[{"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/media?parent=183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/categories?post=183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developryplugins.com\/wp-json\/wp\/v2\/tags?post=183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}