<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>theme structure Archives - Developry Plugins</title>
	<atom:link href="https://developryplugins.com/tag/theme-structure/feed/" rel="self" type="application/rss+xml" />
	<link>https://developryplugins.com/tag/theme-structure/</link>
	<description></description>
	<lastBuildDate>Mon, 24 Nov 2025 11:18:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://developryplugins.com/wp-content/uploads/2025/11/cropped-favicon-32x32.png</url>
	<title>theme structure Archives - Developry Plugins</title>
	<link>https://developryplugins.com/tag/theme-structure/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>WordPress Theme Development from Scratch: Complete Tutorial 2025</title>
		<link>https://developryplugins.com/wordpress-theme-development-from-scratch-complete-tutorial-2025/</link>
		
		<dc:creator><![CDATA[Krasen Slavov]]></dc:creator>
		<pubDate>Mon, 15 Dec 2025 09:00:00 +0000</pubDate>
				<category><![CDATA[WordPress Theme Development]]></category>
		<category><![CDATA[custom theme]]></category>
		<category><![CDATA[theme coding]]></category>
		<category><![CDATA[theme development]]></category>
		<category><![CDATA[theme structure]]></category>
		<category><![CDATA[wordpress themes]]></category>
		<guid isPermaLink="false">https://developryplugins.com/?p=181</guid>

					<description><![CDATA[<p>WordPress theme development transforms design concepts into functional WordPress interfaces through template files, functions.php, style.css, and template hierarchy. From basic index.php and style.css requirements to advanced custom templates, post types...</p>
<p>The post <a href="https://developryplugins.com/wordpress-theme-development-from-scratch-complete-tutorial-2025/">WordPress Theme Development from Scratch: Complete Tutorial 2025</a> appeared first on <a href="https://developryplugins.com">Developry Plugins</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><!-- @format --></p>
<p>WordPress theme development transforms design concepts into functional WordPress interfaces through template files, functions.php, style.css, and template hierarchy. From basic index.php and style.css requirements to advanced custom templates, post types integration, and theme customization APIs, custom themes provide complete design control beyond pre-built options. This comprehensive guide teaches theme file structure, template hierarchy, WordPress loops, navigation menus, widget areas, and modern theme development workflows.</p>
<h2 id="theme-file-structure">Theme File Structure</h2>
<p><strong>Minimum Required Files</strong>:</p>
<pre><code>mytheme/
├── style.css       (required)
├── index.php       (required)
├── screenshot.png  (recommended)</code></pre>
<p><strong>Complete Theme Structure</strong>:</p>
<pre><code>mytheme/
├── style.css
├── index.php
├── functions.php
├── header.php
├── footer.php
├── sidebar.php
├── single.php
├── page.php
├── archive.php
├── search.php
├── 404.php
├── comments.php
├── screenshot.png
├── template-parts/
│   ├── content.php
│   └── content-none.php
├── inc/
│   ├── custom-header.php
│   └── template-tags.php
├── js/
│   └── custom.js
├── css/
│   └── custom.css
└── languages/
    └── mytheme.pot</code></pre>
<h2 id="style.css-header">Style.css Header</h2>
<p><strong>Required Theme Metadata</strong>:</p>
<div class="sourceCode" id="cb3">
<pre class="sourceCode css"><code class="sourceCode css"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true"></a><span class="co">/*</span></span>
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true"></a><span class="co">Theme Name: My Custom Theme</span></span>
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true"></a><span class="co">Theme URI: https://example.com/my-theme</span></span>
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true"></a><span class="co">Author: Your Name</span></span>
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true"></a><span class="co">Author URI: https://example.com</span></span>
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true"></a><span class="co">Description: A custom WordPress theme built from scratch</span></span>
<span id="cb3-7"><a href="#cb3-7" aria-hidden="true"></a><span class="co">Version: 1.0.0</span></span>
<span id="cb3-8"><a href="#cb3-8" aria-hidden="true"></a><span class="co">Requires at least: 6.0</span></span>
<span id="cb3-9"><a href="#cb3-9" aria-hidden="true"></a><span class="co">Tested up to: 6.4</span></span>
<span id="cb3-10"><a href="#cb3-10" aria-hidden="true"></a><span class="co">Requires PHP: 7.4</span></span>
<span id="cb3-11"><a href="#cb3-11" aria-hidden="true"></a><span class="co">License: GNU General Public License v2 or later</span></span>
<span id="cb3-12"><a href="#cb3-12" aria-hidden="true"></a><span class="co">License URI: http://www.gnu.org/licenses/gpl-2.0.html</span></span>
<span id="cb3-13"><a href="#cb3-13" aria-hidden="true"></a><span class="co">Text Domain: mytheme</span></span>
<span id="cb3-14"><a href="#cb3-14" aria-hidden="true"></a><span class="co">Tags: custom-background, custom-logo, custom-menu, featured-images, threaded-comments</span></span>
<span id="cb3-15"><a href="#cb3-15" aria-hidden="true"></a><span class="co">*/</span></span></code></pre>
</div>
<p>Only Theme Name required, but all recommended.</p>
<h2 id="index.php-template">Index.php Template</h2>
<p><strong>Basic index.php Structure</strong>:</p>
<div class="sourceCode" id="cb4">
<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>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true"></a>&lt;div id=<span class="st">&quot;primary&quot;</span> <span class="kw">class</span>=<span class="st">&quot;content-area&quot;</span>&gt;</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true"></a>    &lt;main id=<span class="st">&quot;main&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site-main&quot;</span>&gt;</span>
<span id="cb4-5"><a href="#cb4-5" aria-hidden="true"></a></span>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php</span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true"></a>        <span class="kw">if</span> <span class="ot">(</span>have_posts<span class="ot">())</span> <span class="ot">:</span></span>
<span id="cb4-8"><a href="#cb4-8" aria-hidden="true"></a>            <span class="kw">while</span> <span class="ot">(</span>have_posts<span class="ot">())</span> :</span>
<span id="cb4-9"><a href="#cb4-9" aria-hidden="true"></a>                the_post<span class="ot">();</span></span>
<span id="cb4-10"><a href="#cb4-10" aria-hidden="true"></a>                <span class="kw">?&gt;</span></span>
<span id="cb4-11"><a href="#cb4-11" 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>
<span id="cb4-12"><a href="#cb4-12" 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>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true"></a>                        &lt;h2 <span class="kw">class</span>=<span class="st">&quot;entry-title&quot;</span>&gt;</span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true"></a>                            &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;</span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true"></a>                        &lt;/h2&gt;</span>
<span id="cb4-16"><a href="#cb4-16" aria-hidden="true"></a>                    &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb4-17"><a href="#cb4-17" aria-hidden="true"></a></span>
<span id="cb4-18"><a href="#cb4-18" aria-hidden="true"></a>                    &lt;div <span class="kw">class</span>=<span class="st">&quot;entry-content&quot;</span>&gt;</span>
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true"></a>                        &lt;<span class="ot">?</span>php the_excerpt<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb4-20"><a href="#cb4-20" aria-hidden="true"></a>                    &lt;/div&gt;</span>
<span id="cb4-21"><a href="#cb4-21" aria-hidden="true"></a></span>
<span id="cb4-22"><a href="#cb4-22" aria-hidden="true"></a>                    &lt;footer <span class="kw">class</span>=<span class="st">&quot;entry-footer&quot;</span>&gt;</span>
<span id="cb4-23"><a href="#cb4-23" aria-hidden="true"></a>                        &lt;span <span class="kw">class</span>=<span class="st">&quot;posted-on&quot;</span>&gt;&lt;<span class="ot">?</span>php <span class="kw">echo</span> get_the_date<span class="ot">();</span> <span class="kw">?&gt;</span>&lt;/span&gt;</span>
<span id="cb4-24"><a href="#cb4-24" aria-hidden="true"></a>                        &lt;span <span class="kw">class</span>=<span class="st">&quot;byline&quot;</span>&gt; by &lt;<span class="ot">?</span>php the_author<span class="ot">();</span> <span class="kw">?&gt;</span>&lt;/span&gt;</span>
<span id="cb4-25"><a href="#cb4-25" aria-hidden="true"></a>                    &lt;/footer&gt;</span>
<span id="cb4-26"><a href="#cb4-26" aria-hidden="true"></a>                &lt;/article&gt;</span>
<span id="cb4-27"><a href="#cb4-27" aria-hidden="true"></a>                &lt;<span class="ot">?</span>php</span>
<span id="cb4-28"><a href="#cb4-28" aria-hidden="true"></a>            <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb4-29"><a href="#cb4-29" aria-hidden="true"></a></span>
<span id="cb4-30"><a href="#cb4-30" aria-hidden="true"></a>            the_posts_navigation<span class="ot">();</span></span>
<span id="cb4-31"><a href="#cb4-31" aria-hidden="true"></a>        <span class="kw">else</span> <span class="ot">:</span></span>
<span id="cb4-32"><a href="#cb4-32" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb4-33"><a href="#cb4-33" aria-hidden="true"></a>            &lt;p&gt;&lt;<span class="ot">?</span>php esc_html_e<span class="ot">(</span><span class="st">&#39;No posts found&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/p&gt;</span>
<span id="cb4-34"><a href="#cb4-34" 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>
<span id="cb4-35"><a href="#cb4-35" aria-hidden="true"></a></span>
<span id="cb4-36"><a href="#cb4-36" aria-hidden="true"></a>    &lt;/main&gt;</span>
<span id="cb4-37"><a href="#cb4-37" aria-hidden="true"></a>&lt;/div&gt;</span>
<span id="cb4-38"><a href="#cb4-38" aria-hidden="true"></a></span>
<span id="cb4-39"><a href="#cb4-39" aria-hidden="true"></a>&lt;<span class="ot">?</span>php get_sidebar<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb4-40"><a href="#cb4-40" aria-hidden="true"></a><span class="kw">&lt;?php</span> get_footer<span class="ot">();</span> <span class="kw">?&gt;</span></span></code></pre>
</div>
<h2 id="header.php-template">Header.php Template</h2>
<p><strong>Standard Header Structure</strong>:</p>
<div class="sourceCode" id="cb5">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true"></a>&lt;!<span class="kw">DOCTYPE</span> html&gt;</span>
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true"></a>&lt;html &lt;<span class="ot">?</span>php language_attributes<span class="ot">();</span> <span class="kw">?&gt;</span>&gt;</span>
<span id="cb5-3"><a href="#cb5-3" aria-hidden="true"></a>&lt;head&gt;</span>
<span id="cb5-4"><a href="#cb5-4" aria-hidden="true"></a>    &lt;meta charset=<span class="st">&quot;&lt;?php bloginfo(&#39;charset&#39;); ?&gt;&quot;</span>&gt;</span>
<span id="cb5-5"><a href="#cb5-5" aria-hidden="true"></a>    &lt;meta name=<span class="st">&quot;viewport&quot;</span> content=<span class="st">&quot;width=device-width, initial-scale=1&quot;</span>&gt;</span>
<span id="cb5-6"><a href="#cb5-6" aria-hidden="true"></a>    &lt;<span class="fu">link</span> rel=<span class="st">&quot;profile&quot;</span> href=<span class="st">&quot;https://gmpg.org/xfn/11&quot;</span>&gt;</span>
<span id="cb5-7"><a href="#cb5-7" aria-hidden="true"></a>    &lt;<span class="ot">?</span>php wp_head<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb5-8"><a href="#cb5-8" aria-hidden="true"></a>&lt;/head&gt;</span>
<span id="cb5-9"><a href="#cb5-9" aria-hidden="true"></a></span>
<span id="cb5-10"><a href="#cb5-10" aria-hidden="true"></a>&lt;body &lt;<span class="ot">?</span>php body_class<span class="ot">();</span> <span class="kw">?&gt;</span>&gt;</span>
<span id="cb5-11"><a href="#cb5-11" aria-hidden="true"></a>&lt;<span class="ot">?</span>php wp_body_open<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb5-12"><a href="#cb5-12" aria-hidden="true"></a></span>
<span id="cb5-13"><a href="#cb5-13" aria-hidden="true"></a>&lt;div id=<span class="st">&quot;page&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site&quot;</span>&gt;</span>
<span id="cb5-14"><a href="#cb5-14" aria-hidden="true"></a>    &lt;a <span class="kw">class</span>=<span class="st">&quot;skip-link screen-reader-text&quot;</span> href=<span class="st">&quot;#primary&quot;</span>&gt;&lt;<span class="ot">?</span>php esc_html_e<span class="ot">(</span><span class="st">&#39;Skip to content&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/a&gt;</span>
<span id="cb5-15"><a href="#cb5-15" aria-hidden="true"></a></span>
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true"></a>    &lt;<span class="fu">header</span> id=<span class="st">&quot;masthead&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site-header&quot;</span>&gt;</span>
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true"></a>        &lt;div <span class="kw">class</span>=<span class="st">&quot;site-branding&quot;</span>&gt;</span>
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<span id="cb5-19"><a href="#cb5-19" aria-hidden="true"></a>            <span class="kw">if</span> <span class="ot">(</span>has_custom_logo<span class="ot">())</span> <span class="ot">:</span></span>
<span id="cb5-20"><a href="#cb5-20" aria-hidden="true"></a>                the_custom_logo<span class="ot">();</span></span>
<span id="cb5-21"><a href="#cb5-21" aria-hidden="true"></a>            <span class="kw">else</span> :</span>
<span id="cb5-22"><a href="#cb5-22" aria-hidden="true"></a>                <span class="kw">?&gt;</span></span>
<span id="cb5-23"><a href="#cb5-23" aria-hidden="true"></a>                &lt;h1 <span class="kw">class</span>=<span class="st">&quot;site-title&quot;</span>&gt;</span>
<span id="cb5-24"><a href="#cb5-24" aria-hidden="true"></a>                    &lt;a href=<span class="st">&quot;&lt;?php echo esc_url(home_url(&#39;/&#39;)); ?&gt;&quot;</span>&gt;&lt;<span class="ot">?</span>php bloginfo<span class="ot">(</span><span class="st">&#39;name&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/a&gt;</span>
<span id="cb5-25"><a href="#cb5-25" aria-hidden="true"></a>                &lt;/h1&gt;</span>
<span id="cb5-26"><a href="#cb5-26" aria-hidden="true"></a>                &lt;p <span class="kw">class</span>=<span class="st">&quot;site-description&quot;</span>&gt;&lt;<span class="ot">?</span>php bloginfo<span class="ot">(</span><span class="st">&#39;description&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/p&gt;</span>
<span id="cb5-27"><a href="#cb5-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>
<span id="cb5-28"><a href="#cb5-28" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb5-29"><a href="#cb5-29" aria-hidden="true"></a></span>
<span id="cb5-30"><a href="#cb5-30" aria-hidden="true"></a>        &lt;nav id=<span class="st">&quot;site-navigation&quot;</span> <span class="kw">class</span>=<span class="st">&quot;main-navigation&quot;</span>&gt;</span>
<span id="cb5-31"><a href="#cb5-31" aria-hidden="true"></a>            &lt;button <span class="kw">class</span>=<span class="st">&quot;menu-toggle&quot;</span> aria-controls=<span class="st">&quot;primary-menu&quot;</span> aria-expanded=<span class="st">&quot;false&quot;</span>&gt;</span>
<span id="cb5-32"><a href="#cb5-32" aria-hidden="true"></a>                &lt;<span class="ot">?</span>php esc_html_e<span class="ot">(</span><span class="st">&#39;Menu&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb5-33"><a href="#cb5-33" aria-hidden="true"></a>            &lt;/button&gt;</span>
<span id="cb5-34"><a href="#cb5-34" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<span id="cb5-35"><a href="#cb5-35" aria-hidden="true"></a>            wp_nav_menu<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb5-36"><a href="#cb5-36" aria-hidden="true"></a>                <span class="st">&#39;theme_location&#39;</span> =&gt; <span class="st">&#39;primary&#39;</span><span class="ot">,</span></span>
<span id="cb5-37"><a href="#cb5-37" aria-hidden="true"></a>                <span class="st">&#39;menu_id&#39;</span>        =&gt; <span class="st">&#39;primary-menu&#39;</span><span class="ot">,</span></span>
<span id="cb5-38"><a href="#cb5-38" aria-hidden="true"></a>            <span class="ot">));</span></span>
<span id="cb5-39"><a href="#cb5-39" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb5-40"><a href="#cb5-40" aria-hidden="true"></a>        &lt;/nav&gt;</span>
<span id="cb5-41"><a href="#cb5-41" aria-hidden="true"></a>    &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb5-42"><a href="#cb5-42" aria-hidden="true"></a></span>
<span id="cb5-43"><a href="#cb5-43" aria-hidden="true"></a>    &lt;div id=<span class="st">&quot;content&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site-content&quot;</span>&gt;</span></code></pre>
</div>
<h2 id="footer.php-template">Footer.php Template</h2>
<p><strong>Standard Footer Structure</strong>:</p>
<div class="sourceCode" id="cb6">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true"></a>    &lt;/div&gt;&lt;!-- <span class="co">#content --&gt;</span></span>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true"></a></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true"></a>    &lt;footer id=<span class="st">&quot;colophon&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site-footer&quot;</span>&gt;</span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true"></a>        &lt;div <span class="kw">class</span>=<span class="st">&quot;site-info&quot;</span>&gt;</span>
<span id="cb6-5"><a href="#cb6-5" aria-hidden="true"></a>            &lt;a href=<span class="st">&quot;&lt;?php echo esc_url(__(&#39;https://wordpress.org/&#39;, &#39;mytheme&#39;)); ?&gt;&quot;</span>&gt;</span>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true"></a>                &lt;<span class="ot">?</span>php <span class="fu">printf</span><span class="ot">(</span>esc_html__<span class="ot">(</span><span class="st">&#39;Proudly powered by %s&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span> <span class="st">&#39;WordPress&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true"></a>            &lt;/a&gt;</span>
<span id="cb6-8"><a href="#cb6-8" aria-hidden="true"></a>            &lt;span <span class="kw">class</span>=<span class="st">&quot;sep&quot;</span>&gt; | &lt;/span&gt;</span>
<span id="cb6-9"><a href="#cb6-9" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php <span class="fu">printf</span><span class="ot">(</span>esc_html__<span class="ot">(</span><span class="st">&#39;Theme: %1$s by %2$s.&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span> <span class="st">&#39;My Custom Theme&#39;</span><span class="ot">,</span> <span class="st">&#39;&lt;a href=&quot;https://example.com&quot;&gt;Your Name&lt;/a&gt;&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb6-10"><a href="#cb6-10" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true"></a>    &lt;/footer&gt;</span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true"></a>&lt;/div&gt;&lt;!-- <span class="co">#page --&gt;</span></span>
<span id="cb6-13"><a href="#cb6-13" aria-hidden="true"></a></span>
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true"></a>&lt;<span class="ot">?</span>php wp_footer<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true"></a></span>
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true"></a>&lt;/body&gt;</span>
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true"></a>&lt;/html&gt;</span></code></pre>
</div>
<h2 id="functions.php-setup">Functions.php Setup</h2>
<p><strong>Essential Functions</strong>:</p>
<div class="sourceCode" id="cb7">
<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>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true"></a><span class="co">/**</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true"></a><span class="co"> * Theme Functions</span></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true"></a><span class="co"> */</span></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true"></a></span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true"></a><span class="kw">if</span> <span class="ot">(</span>!<span class="fu">defined</span><span class="ot">(</span><span class="st">&#39;ABSPATH&#39;</span><span class="ot">))</span> {</span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true"></a>    <span class="kw">exit</span><span class="ot">;</span> <span class="co">// Exit if accessed directly</span></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true"></a>}</span>
<span id="cb7-9"><a href="#cb7-9" aria-hidden="true"></a></span>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true"></a><span class="co">/**</span></span>
<span id="cb7-11"><a href="#cb7-11" aria-hidden="true"></a><span class="co"> * Theme Setup</span></span>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true"></a><span class="co"> */</span></span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true"></a><span class="kw">function</span> mytheme_setup<span class="ot">()</span> {</span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true"></a>    <span class="co">// Add default posts and comments RSS feed links to head</span></span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;automatic-feed-links&#39;</span><span class="ot">);</span></span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true"></a></span>
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true"></a>    <span class="co">// Let WordPress manage the document title</span></span>
<span id="cb7-18"><a href="#cb7-18" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;title-tag&#39;</span><span class="ot">);</span></span>
<span id="cb7-19"><a href="#cb7-19" aria-hidden="true"></a></span>
<span id="cb7-20"><a href="#cb7-20" aria-hidden="true"></a>    <span class="co">// Enable support for Post Thumbnails</span></span>
<span id="cb7-21"><a href="#cb7-21" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;post-thumbnails&#39;</span><span class="ot">);</span></span>
<span id="cb7-22"><a href="#cb7-22" aria-hidden="true"></a></span>
<span id="cb7-23"><a href="#cb7-23" aria-hidden="true"></a>    <span class="co">// Register navigation menus</span></span>
<span id="cb7-24"><a href="#cb7-24" aria-hidden="true"></a>    register_nav_menus<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb7-25"><a href="#cb7-25" aria-hidden="true"></a>        <span class="st">&#39;primary&#39;</span> =&gt; esc_html__<span class="ot">(</span><span class="st">&#39;Primary Menu&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb7-26"><a href="#cb7-26" aria-hidden="true"></a>        <span class="st">&#39;footer&#39;</span>  =&gt; esc_html__<span class="ot">(</span><span class="st">&#39;Footer Menu&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb7-27"><a href="#cb7-27" aria-hidden="true"></a>    <span class="ot">));</span></span>
<span id="cb7-28"><a href="#cb7-28" aria-hidden="true"></a></span>
<span id="cb7-29"><a href="#cb7-29" aria-hidden="true"></a>    <span class="co">// Switch default core markup to HTML5</span></span>
<span id="cb7-30"><a href="#cb7-30" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;html5&#39;</span><span class="ot">,</span> <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb7-31"><a href="#cb7-31" aria-hidden="true"></a>        <span class="st">&#39;search-form&#39;</span><span class="ot">,</span></span>
<span id="cb7-32"><a href="#cb7-32" aria-hidden="true"></a>        <span class="st">&#39;comment-form&#39;</span><span class="ot">,</span></span>
<span id="cb7-33"><a href="#cb7-33" aria-hidden="true"></a>        <span class="st">&#39;comment-list&#39;</span><span class="ot">,</span></span>
<span id="cb7-34"><a href="#cb7-34" aria-hidden="true"></a>        <span class="st">&#39;gallery&#39;</span><span class="ot">,</span></span>
<span id="cb7-35"><a href="#cb7-35" aria-hidden="true"></a>        <span class="st">&#39;caption&#39;</span><span class="ot">,</span></span>
<span id="cb7-36"><a href="#cb7-36" aria-hidden="true"></a>        <span class="st">&#39;style&#39;</span><span class="ot">,</span></span>
<span id="cb7-37"><a href="#cb7-37" aria-hidden="true"></a>        <span class="st">&#39;script&#39;</span><span class="ot">,</span></span>
<span id="cb7-38"><a href="#cb7-38" aria-hidden="true"></a>    <span class="ot">));</span></span>
<span id="cb7-39"><a href="#cb7-39" aria-hidden="true"></a></span>
<span id="cb7-40"><a href="#cb7-40" aria-hidden="true"></a>    <span class="co">// Add theme support for selective refresh for widgets</span></span>
<span id="cb7-41"><a href="#cb7-41" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;customize-selective-refresh-widgets&#39;</span><span class="ot">);</span></span>
<span id="cb7-42"><a href="#cb7-42" aria-hidden="true"></a></span>
<span id="cb7-43"><a href="#cb7-43" aria-hidden="true"></a>    <span class="co">// Add support for custom logo</span></span>
<span id="cb7-44"><a href="#cb7-44" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;custom-logo&#39;</span><span class="ot">,</span> <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb7-45"><a href="#cb7-45" aria-hidden="true"></a>        <span class="st">&#39;height&#39;</span>      =&gt; <span class="dv">100</span><span class="ot">,</span></span>
<span id="cb7-46"><a href="#cb7-46" aria-hidden="true"></a>        <span class="st">&#39;width&#39;</span>       =&gt; <span class="dv">400</span><span class="ot">,</span></span>
<span id="cb7-47"><a href="#cb7-47" aria-hidden="true"></a>        <span class="st">&#39;flex-height&#39;</span> =&gt; <span class="kw">true</span><span class="ot">,</span></span>
<span id="cb7-48"><a href="#cb7-48" aria-hidden="true"></a>        <span class="st">&#39;flex-width&#39;</span>  =&gt; <span class="kw">true</span><span class="ot">,</span></span>
<span id="cb7-49"><a href="#cb7-49" aria-hidden="true"></a>    <span class="ot">));</span></span>
<span id="cb7-50"><a href="#cb7-50" aria-hidden="true"></a></span>
<span id="cb7-51"><a href="#cb7-51" aria-hidden="true"></a>    <span class="co">// Add support for custom background</span></span>
<span id="cb7-52"><a href="#cb7-52" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;custom-background&#39;</span><span class="ot">,</span> <span class="kw">array</span><span class="ot">(</span></span>
<span id="cb7-53"><a href="#cb7-53" aria-hidden="true"></a>        <span class="st">&#39;default-color&#39;</span> =&gt; <span class="st">&#39;ffffff&#39;</span><span class="ot">,</span></span>
<span id="cb7-54"><a href="#cb7-54" aria-hidden="true"></a>    <span class="ot">));</span></span>
<span id="cb7-55"><a href="#cb7-55" aria-hidden="true"></a></span>
<span id="cb7-56"><a href="#cb7-56" aria-hidden="true"></a>    <span class="co">// Add support for Block Editor styles</span></span>
<span id="cb7-57"><a href="#cb7-57" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;wp-block-styles&#39;</span><span class="ot">);</span></span>
<span id="cb7-58"><a href="#cb7-58" aria-hidden="true"></a></span>
<span id="cb7-59"><a href="#cb7-59" aria-hidden="true"></a>    <span class="co">// Add support for full and wide align images</span></span>
<span id="cb7-60"><a href="#cb7-60" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;align-wide&#39;</span><span class="ot">);</span></span>
<span id="cb7-61"><a href="#cb7-61" aria-hidden="true"></a></span>
<span id="cb7-62"><a href="#cb7-62" aria-hidden="true"></a>    <span class="co">// Add support for editor styles</span></span>
<span id="cb7-63"><a href="#cb7-63" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;editor-styles&#39;</span><span class="ot">);</span></span>
<span id="cb7-64"><a href="#cb7-64" aria-hidden="true"></a></span>
<span id="cb7-65"><a href="#cb7-65" aria-hidden="true"></a>    <span class="co">// Enqueue editor styles</span></span>
<span id="cb7-66"><a href="#cb7-66" aria-hidden="true"></a>    add_editor_style<span class="ot">(</span><span class="st">&#39;style-editor.css&#39;</span><span class="ot">);</span></span>
<span id="cb7-67"><a href="#cb7-67" aria-hidden="true"></a></span>
<span id="cb7-68"><a href="#cb7-68" aria-hidden="true"></a>    <span class="co">// Add support for responsive embeds</span></span>
<span id="cb7-69"><a href="#cb7-69" aria-hidden="true"></a>    add_theme_support<span class="ot">(</span><span class="st">&#39;responsive-embeds&#39;</span><span class="ot">);</span></span>
<span id="cb7-70"><a href="#cb7-70" aria-hidden="true"></a>}</span>
<span id="cb7-71"><a href="#cb7-71" aria-hidden="true"></a>add_action<span class="ot">(</span><span class="st">&#39;after_setup_theme&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme_setup&#39;</span><span class="ot">);</span></span>
<span id="cb7-72"><a href="#cb7-72" aria-hidden="true"></a></span>
<span id="cb7-73"><a href="#cb7-73" aria-hidden="true"></a><span class="co">/**</span></span>
<span id="cb7-74"><a href="#cb7-74" aria-hidden="true"></a><span class="co"> * Set content width</span></span>
<span id="cb7-75"><a href="#cb7-75" aria-hidden="true"></a><span class="co"> */</span></span>
<span id="cb7-76"><a href="#cb7-76" aria-hidden="true"></a><span class="kw">function</span> mytheme_content_width<span class="ot">()</span> {</span>
<span id="cb7-77"><a href="#cb7-77" aria-hidden="true"></a>    <span class="kw">$GLOBALS</span><span class="ot">[</span><span class="st">&#39;content_width&#39;</span><span class="ot">]</span> = apply_filters<span class="ot">(</span><span class="st">&#39;mytheme_content_width&#39;</span><span class="ot">,</span> <span class="dv">800</span><span class="ot">);</span></span>
<span id="cb7-78"><a href="#cb7-78" aria-hidden="true"></a>}</span>
<span id="cb7-79"><a href="#cb7-79" aria-hidden="true"></a>add_action<span class="ot">(</span><span class="st">&#39;after_setup_theme&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme_content_width&#39;</span><span class="ot">,</span> <span class="dv">0</span><span class="ot">);</span></span>
<span id="cb7-80"><a href="#cb7-80" aria-hidden="true"></a></span>
<span id="cb7-81"><a href="#cb7-81" aria-hidden="true"></a><span class="co">/**</span></span>
<span id="cb7-82"><a href="#cb7-82" aria-hidden="true"></a><span class="co"> * Enqueue scripts and styles</span></span>
<span id="cb7-83"><a href="#cb7-83" aria-hidden="true"></a><span class="co"> */</span></span>
<span id="cb7-84"><a href="#cb7-84" aria-hidden="true"></a><span class="kw">function</span> mytheme_scripts<span class="ot">()</span> {</span>
<span id="cb7-85"><a href="#cb7-85" aria-hidden="true"></a>    <span class="co">// Main stylesheet</span></span>
<span id="cb7-86"><a href="#cb7-86" aria-hidden="true"></a>    wp_enqueue_style<span class="ot">(</span><span class="st">&#39;mytheme-style&#39;</span><span class="ot">,</span> get_stylesheet_uri<span class="ot">(),</span> <span class="kw">array</span><span class="ot">(),</span> <span class="st">&#39;1.0.0&#39;</span><span class="ot">);</span></span>
<span id="cb7-87"><a href="#cb7-87" aria-hidden="true"></a></span>
<span id="cb7-88"><a href="#cb7-88" aria-hidden="true"></a>    <span class="co">// Custom stylesheet</span></span>
<span id="cb7-89"><a href="#cb7-89" aria-hidden="true"></a>    wp_enqueue_style<span class="ot">(</span><span class="st">&#39;mytheme-custom&#39;</span><span class="ot">,</span> get_template_directory_uri<span class="ot">()</span> . <span class="st">&#39;/css/custom.css&#39;</span><span class="ot">,</span> <span class="kw">array</span><span class="ot">(),</span> <span class="st">&#39;1.0.0&#39;</span><span class="ot">);</span></span>
<span id="cb7-90"><a href="#cb7-90" aria-hidden="true"></a></span>
<span id="cb7-91"><a href="#cb7-91" aria-hidden="true"></a>    <span class="co">// Custom JavaScript</span></span>
<span id="cb7-92"><a href="#cb7-92" aria-hidden="true"></a>    wp_enqueue_script<span class="ot">(</span><span class="st">&#39;mytheme-navigation&#39;</span><span class="ot">,</span> get_template_directory_uri<span class="ot">()</span> . <span class="st">&#39;/js/navigation.js&#39;</span><span class="ot">,</span> <span class="kw">array</span><span class="ot">(),</span> <span class="st">&#39;1.0.0&#39;</span><span class="ot">,</span> <span class="kw">true</span><span class="ot">);</span></span>
<span id="cb7-93"><a href="#cb7-93" aria-hidden="true"></a></span>
<span id="cb7-94"><a href="#cb7-94" aria-hidden="true"></a>    <span class="co">// Comment reply script</span></span>
<span id="cb7-95"><a href="#cb7-95" aria-hidden="true"></a>    <span class="kw">if</span> <span class="ot">(</span>is_singular<span class="ot">()</span> &amp;&amp; comments_open<span class="ot">()</span> &amp;&amp; get_option<span class="ot">(</span><span class="st">&#39;thread_comments&#39;</span><span class="ot">))</span> {</span>
<span id="cb7-96"><a href="#cb7-96" aria-hidden="true"></a>        wp_enqueue_script<span class="ot">(</span><span class="st">&#39;comment-reply&#39;</span><span class="ot">);</span></span>
<span id="cb7-97"><a href="#cb7-97" aria-hidden="true"></a>    }</span>
<span id="cb7-98"><a href="#cb7-98" aria-hidden="true"></a>}</span>
<span id="cb7-99"><a href="#cb7-99" aria-hidden="true"></a>add_action<span class="ot">(</span><span class="st">&#39;wp_enqueue_scripts&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme_scripts&#39;</span><span class="ot">);</span></span>
<span id="cb7-100"><a href="#cb7-100" aria-hidden="true"></a></span>
<span id="cb7-101"><a href="#cb7-101" aria-hidden="true"></a><span class="co">/**</span></span>
<span id="cb7-102"><a href="#cb7-102" aria-hidden="true"></a><span class="co"> * Register widget areas</span></span>
<span id="cb7-103"><a href="#cb7-103" aria-hidden="true"></a><span class="co"> */</span></span>
<span id="cb7-104"><a href="#cb7-104" aria-hidden="true"></a><span class="kw">function</span> mytheme_widgets_init<span class="ot">()</span> {</span>
<span id="cb7-105"><a href="#cb7-105" aria-hidden="true"></a>    register_sidebar<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb7-106"><a href="#cb7-106" aria-hidden="true"></a>        <span class="st">&#39;name&#39;</span>          =&gt; esc_html__<span class="ot">(</span><span class="st">&#39;Sidebar&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb7-107"><a href="#cb7-107" aria-hidden="true"></a>        <span class="st">&#39;id&#39;</span>            =&gt; <span class="st">&#39;sidebar-1&#39;</span><span class="ot">,</span></span>
<span id="cb7-108"><a href="#cb7-108" aria-hidden="true"></a>        <span class="st">&#39;description&#39;</span>   =&gt; esc_html__<span class="ot">(</span><span class="st">&#39;Add widgets here.&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb7-109"><a href="#cb7-109" aria-hidden="true"></a>        <span class="st">&#39;before_widget&#39;</span> =&gt; <span class="st">&#39;&lt;section id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb7-110"><a href="#cb7-110" aria-hidden="true"></a>        <span class="st">&#39;after_widget&#39;</span>  =&gt; <span class="st">&#39;&lt;/section&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb7-111"><a href="#cb7-111" aria-hidden="true"></a>        <span class="st">&#39;before_title&#39;</span>  =&gt; <span class="st">&#39;&lt;h2 class=&quot;widget-title&quot;&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb7-112"><a href="#cb7-112" aria-hidden="true"></a>        <span class="st">&#39;after_title&#39;</span>   =&gt; <span class="st">&#39;&lt;/h2&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb7-113"><a href="#cb7-113" aria-hidden="true"></a>    <span class="ot">));</span></span>
<span id="cb7-114"><a href="#cb7-114" aria-hidden="true"></a></span>
<span id="cb7-115"><a href="#cb7-115" aria-hidden="true"></a>    register_sidebar<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb7-116"><a href="#cb7-116" aria-hidden="true"></a>        <span class="st">&#39;name&#39;</span>          =&gt; esc_html__<span class="ot">(</span><span class="st">&#39;Footer&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb7-117"><a href="#cb7-117" aria-hidden="true"></a>        <span class="st">&#39;id&#39;</span>            =&gt; <span class="st">&#39;footer-1&#39;</span><span class="ot">,</span></span>
<span id="cb7-118"><a href="#cb7-118" aria-hidden="true"></a>        <span class="st">&#39;description&#39;</span>   =&gt; esc_html__<span class="ot">(</span><span class="st">&#39;Add footer widgets here.&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb7-119"><a href="#cb7-119" aria-hidden="true"></a>        <span class="st">&#39;before_widget&#39;</span> =&gt; <span class="st">&#39;&lt;div id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb7-120"><a href="#cb7-120" aria-hidden="true"></a>        <span class="st">&#39;after_widget&#39;</span>  =&gt; <span class="st">&#39;&lt;/div&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb7-121"><a href="#cb7-121" aria-hidden="true"></a>        <span class="st">&#39;before_title&#39;</span>  =&gt; <span class="st">&#39;&lt;h3 class=&quot;widget-title&quot;&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb7-122"><a href="#cb7-122" aria-hidden="true"></a>        <span class="st">&#39;after_title&#39;</span>   =&gt; <span class="st">&#39;&lt;/h3&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb7-123"><a href="#cb7-123" aria-hidden="true"></a>    <span class="ot">));</span></span>
<span id="cb7-124"><a href="#cb7-124" aria-hidden="true"></a>}</span>
<span id="cb7-125"><a href="#cb7-125" aria-hidden="true"></a>add_action<span class="ot">(</span><span class="st">&#39;widgets_init&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme_widgets_init&#39;</span><span class="ot">);</span></span></code></pre>
</div>
<h2 id="single.php-template">Single.php Template</h2>
<p><strong>Single Post Template</strong>:</p>
<div class="sourceCode" id="cb8">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true"></a><span class="kw">&lt;?php</span> get_header<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb8-2"><a href="#cb8-2" aria-hidden="true"></a></span>
<span id="cb8-3"><a href="#cb8-3" aria-hidden="true"></a>&lt;div id=<span class="st">&quot;primary&quot;</span> <span class="kw">class</span>=<span class="st">&quot;content-area&quot;</span>&gt;</span>
<span id="cb8-4"><a href="#cb8-4" aria-hidden="true"></a>    &lt;main id=<span class="st">&quot;main&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site-main&quot;</span>&gt;</span>
<span id="cb8-5"><a href="#cb8-5" aria-hidden="true"></a></span>
<span id="cb8-6"><a href="#cb8-6" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php</span>
<span id="cb8-7"><a href="#cb8-7" aria-hidden="true"></a>        <span class="kw">while</span> <span class="ot">(</span>have_posts<span class="ot">())</span> <span class="ot">:</span></span>
<span id="cb8-8"><a href="#cb8-8" aria-hidden="true"></a>            the_post<span class="ot">();</span></span>
<span id="cb8-9"><a href="#cb8-9" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb8-10"><a href="#cb8-10" aria-hidden="true"></a></span>
<span id="cb8-11"><a href="#cb8-11" 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>
<span id="cb8-12"><a href="#cb8-12" 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>
<span id="cb8-13"><a href="#cb8-13" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php the_title<span class="ot">(</span><span class="st">&#39;&lt;h1 class=&quot;entry-title&quot;&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>
<span id="cb8-14"><a href="#cb8-14" aria-hidden="true"></a></span>
<span id="cb8-15"><a href="#cb8-15" aria-hidden="true"></a>                    &lt;div <span class="kw">class</span>=<span class="st">&quot;entry-meta&quot;</span>&gt;</span>
<span id="cb8-16"><a href="#cb8-16" aria-hidden="true"></a>                        &lt;span <span class="kw">class</span>=<span class="st">&quot;posted-on&quot;</span>&gt;</span>
<span id="cb8-17"><a href="#cb8-17" aria-hidden="true"></a>                            &lt;<span class="ot">?</span>php <span class="kw">echo</span> get_the_date<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb8-18"><a href="#cb8-18" aria-hidden="true"></a>                        &lt;/span&gt;</span>
<span id="cb8-19"><a href="#cb8-19" aria-hidden="true"></a>                        &lt;span <span class="kw">class</span>=<span class="st">&quot;byline&quot;</span>&gt;</span>
<span id="cb8-20"><a href="#cb8-20" aria-hidden="true"></a>                            by &lt;<span class="ot">?</span>php the_author_posts_link<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb8-21"><a href="#cb8-21" aria-hidden="true"></a>                        &lt;/span&gt;</span>
<span id="cb8-22"><a href="#cb8-22" aria-hidden="true"></a>                        &lt;span <span class="kw">class</span>=<span class="st">&quot;cat-links&quot;</span>&gt;</span>
<span id="cb8-23"><a href="#cb8-23" aria-hidden="true"></a>                            &lt;<span class="ot">?</span>php the_category<span class="ot">(</span><span class="st">&#39;, &#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb8-24"><a href="#cb8-24" aria-hidden="true"></a>                        &lt;/span&gt;</span>
<span id="cb8-25"><a href="#cb8-25" aria-hidden="true"></a>                    &lt;/div&gt;</span>
<span id="cb8-26"><a href="#cb8-26" aria-hidden="true"></a>                &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb8-27"><a href="#cb8-27" aria-hidden="true"></a></span>
<span id="cb8-28"><a href="#cb8-28" 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>
<span id="cb8-29"><a href="#cb8-29" aria-hidden="true"></a>                    &lt;div <span class="kw">class</span>=<span class="st">&quot;post-thumbnail&quot;</span>&gt;</span>
<span id="cb8-30"><a href="#cb8-30" 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>
<span id="cb8-31"><a href="#cb8-31" aria-hidden="true"></a>                    &lt;/div&gt;</span>
<span id="cb8-32"><a href="#cb8-32" 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>
<span id="cb8-33"><a href="#cb8-33" aria-hidden="true"></a></span>
<span id="cb8-34"><a href="#cb8-34" aria-hidden="true"></a>                &lt;div <span class="kw">class</span>=<span class="st">&quot;entry-content&quot;</span>&gt;</span>
<span id="cb8-35"><a href="#cb8-35" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php</span>
<span id="cb8-36"><a href="#cb8-36" aria-hidden="true"></a>                    the_content<span class="ot">();</span></span>
<span id="cb8-37"><a href="#cb8-37" aria-hidden="true"></a></span>
<span id="cb8-38"><a href="#cb8-38" aria-hidden="true"></a>                    wp_link_pages<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb8-39"><a href="#cb8-39" aria-hidden="true"></a>                        <span class="st">&#39;before&#39;</span> =&gt; <span class="st">&#39;&lt;div class=&quot;page-links&quot;&gt;&#39;</span> . esc_html__<span class="ot">(</span><span class="st">&#39;Pages:&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb8-40"><a href="#cb8-40" aria-hidden="true"></a>                        <span class="st">&#39;after&#39;</span>  =&gt; <span class="st">&#39;&lt;/div&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb8-41"><a href="#cb8-41" aria-hidden="true"></a>                    <span class="ot">));</span></span>
<span id="cb8-42"><a href="#cb8-42" aria-hidden="true"></a>                    <span class="kw">?&gt;</span></span>
<span id="cb8-43"><a href="#cb8-43" aria-hidden="true"></a>                &lt;/div&gt;</span>
<span id="cb8-44"><a href="#cb8-44" aria-hidden="true"></a></span>
<span id="cb8-45"><a href="#cb8-45" aria-hidden="true"></a>                &lt;footer <span class="kw">class</span>=<span class="st">&quot;entry-footer&quot;</span>&gt;</span>
<span id="cb8-46"><a href="#cb8-46" 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-links&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>
<span id="cb8-47"><a href="#cb8-47" aria-hidden="true"></a>                &lt;/footer&gt;</span>
<span id="cb8-48"><a href="#cb8-48" aria-hidden="true"></a>            &lt;/article&gt;</span>
<span id="cb8-49"><a href="#cb8-49" aria-hidden="true"></a></span>
<span id="cb8-50"><a href="#cb8-50" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<span id="cb8-51"><a href="#cb8-51" aria-hidden="true"></a>            <span class="co">// Previous/next post navigation</span></span>
<span id="cb8-52"><a href="#cb8-52" aria-hidden="true"></a>            the_post_navigation<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb8-53"><a href="#cb8-53" aria-hidden="true"></a>                <span class="st">&#39;prev_text&#39;</span> =&gt; <span class="st">&#39;&lt;span class=&quot;nav-subtitle&quot;&gt;&#39;</span> . esc_html__<span class="ot">(</span><span class="st">&#39;Previous:&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">)</span> . <span class="st">&#39;&lt;/span&gt; &lt;span class=&quot;nav-title&quot;&gt;%title&lt;/span&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb8-54"><a href="#cb8-54" aria-hidden="true"></a>                <span class="st">&#39;next_text&#39;</span> =&gt; <span class="st">&#39;&lt;span class=&quot;nav-subtitle&quot;&gt;&#39;</span> . esc_html__<span class="ot">(</span><span class="st">&#39;Next:&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">)</span> . <span class="st">&#39;&lt;/span&gt; &lt;span class=&quot;nav-title&quot;&gt;%title&lt;/span&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb8-55"><a href="#cb8-55" aria-hidden="true"></a>            <span class="ot">));</span></span>
<span id="cb8-56"><a href="#cb8-56" aria-hidden="true"></a></span>
<span id="cb8-57"><a href="#cb8-57" aria-hidden="true"></a>            <span class="co">// Comments</span></span>
<span id="cb8-58"><a href="#cb8-58" 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>
<span id="cb8-59"><a href="#cb8-59" aria-hidden="true"></a>                comments_template<span class="ot">();</span></span>
<span id="cb8-60"><a href="#cb8-60" aria-hidden="true"></a>            <span class="kw">endif</span><span class="ot">;</span></span>
<span id="cb8-61"><a href="#cb8-61" aria-hidden="true"></a></span>
<span id="cb8-62"><a href="#cb8-62" aria-hidden="true"></a>        <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb8-63"><a href="#cb8-63" aria-hidden="true"></a>        <span class="kw">?&gt;</span></span>
<span id="cb8-64"><a href="#cb8-64" aria-hidden="true"></a></span>
<span id="cb8-65"><a href="#cb8-65" aria-hidden="true"></a>    &lt;/main&gt;</span>
<span id="cb8-66"><a href="#cb8-66" aria-hidden="true"></a>&lt;/div&gt;</span>
<span id="cb8-67"><a href="#cb8-67" aria-hidden="true"></a></span>
<span id="cb8-68"><a href="#cb8-68" aria-hidden="true"></a>&lt;<span class="ot">?</span>php get_sidebar<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb8-69"><a href="#cb8-69" aria-hidden="true"></a><span class="kw">&lt;?php</span> get_footer<span class="ot">();</span> <span class="kw">?&gt;</span></span></code></pre>
</div>
<h2 id="page.php-template">Page.php Template</h2>
<p><strong>Static Page Template</strong>:</p>
<div class="sourceCode" id="cb9">
<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>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true"></a></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true"></a>&lt;div id=<span class="st">&quot;primary&quot;</span> <span class="kw">class</span>=<span class="st">&quot;content-area&quot;</span>&gt;</span>
<span id="cb9-4"><a href="#cb9-4" aria-hidden="true"></a>    &lt;main id=<span class="st">&quot;main&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site-main&quot;</span>&gt;</span>
<span id="cb9-5"><a href="#cb9-5" aria-hidden="true"></a></span>
<span id="cb9-6"><a href="#cb9-6" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php</span>
<span id="cb9-7"><a href="#cb9-7" aria-hidden="true"></a>        <span class="kw">while</span> <span class="ot">(</span>have_posts<span class="ot">())</span> <span class="ot">:</span></span>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true"></a>            the_post<span class="ot">();</span></span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true"></a></span>
<span id="cb9-11"><a href="#cb9-11" 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>
<span id="cb9-12"><a href="#cb9-12" 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>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php the_title<span class="ot">(</span><span class="st">&#39;&lt;h1 class=&quot;entry-title&quot;&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>
<span id="cb9-14"><a href="#cb9-14" aria-hidden="true"></a>                &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true"></a></span>
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true"></a>                &lt;div <span class="kw">class</span>=<span class="st">&quot;entry-content&quot;</span>&gt;</span>
<span id="cb9-17"><a href="#cb9-17" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php</span>
<span id="cb9-18"><a href="#cb9-18" aria-hidden="true"></a>                    the_content<span class="ot">();</span></span>
<span id="cb9-19"><a href="#cb9-19" aria-hidden="true"></a></span>
<span id="cb9-20"><a href="#cb9-20" aria-hidden="true"></a>                    wp_link_pages<span class="ot">(</span><span class="kw">array</span><span class="ot">(</span></span>
<span id="cb9-21"><a href="#cb9-21" aria-hidden="true"></a>                        <span class="st">&#39;before&#39;</span> =&gt; <span class="st">&#39;&lt;div class=&quot;page-links&quot;&gt;&#39;</span> . esc_html__<span class="ot">(</span><span class="st">&#39;Pages:&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">),</span></span>
<span id="cb9-22"><a href="#cb9-22" aria-hidden="true"></a>                        <span class="st">&#39;after&#39;</span>  =&gt; <span class="st">&#39;&lt;/div&gt;&#39;</span><span class="ot">,</span></span>
<span id="cb9-23"><a href="#cb9-23" aria-hidden="true"></a>                    <span class="ot">));</span></span>
<span id="cb9-24"><a href="#cb9-24" aria-hidden="true"></a>                    <span class="kw">?&gt;</span></span>
<span id="cb9-25"><a href="#cb9-25" aria-hidden="true"></a>                &lt;/div&gt;</span>
<span id="cb9-26"><a href="#cb9-26" aria-hidden="true"></a></span>
<span id="cb9-27"><a href="#cb9-27" aria-hidden="true"></a>                &lt;<span class="ot">?</span>php <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 class="kw">?&gt;</span></span>
<span id="cb9-28"><a href="#cb9-28" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php comments_template<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<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>
<span id="cb9-30"><a href="#cb9-30" aria-hidden="true"></a>            &lt;/article&gt;</span>
<span id="cb9-31"><a href="#cb9-31" aria-hidden="true"></a></span>
<span id="cb9-32"><a href="#cb9-32" 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>
<span id="cb9-33"><a href="#cb9-33" aria-hidden="true"></a></span>
<span id="cb9-34"><a href="#cb9-34" aria-hidden="true"></a>    &lt;/main&gt;</span>
<span id="cb9-35"><a href="#cb9-35" aria-hidden="true"></a>&lt;/div&gt;</span>
<span id="cb9-36"><a href="#cb9-36" aria-hidden="true"></a></span>
<span id="cb9-37"><a href="#cb9-37" aria-hidden="true"></a>&lt;<span class="ot">?</span>php get_footer<span class="ot">();</span> <span class="kw">?&gt;</span></span></code></pre>
</div>
<h2 id="archive.php-template">Archive.php Template</h2>
<p><strong>Archive Listing Template</strong>:</p>
<div class="sourceCode" id="cb10">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb10-1"><a href="#cb10-1" aria-hidden="true"></a><span class="kw">&lt;?php</span> get_header<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb10-2"><a href="#cb10-2" aria-hidden="true"></a></span>
<span id="cb10-3"><a href="#cb10-3" aria-hidden="true"></a>&lt;div id=<span class="st">&quot;primary&quot;</span> <span class="kw">class</span>=<span class="st">&quot;content-area&quot;</span>&gt;</span>
<span id="cb10-4"><a href="#cb10-4" aria-hidden="true"></a>    &lt;main id=<span class="st">&quot;main&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site-main&quot;</span>&gt;</span>
<span id="cb10-5"><a href="#cb10-5" aria-hidden="true"></a></span>
<span id="cb10-6"><a href="#cb10-6" 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>
<span id="cb10-7"><a href="#cb10-7" aria-hidden="true"></a></span>
<span id="cb10-8"><a href="#cb10-8" 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>
<span id="cb10-9"><a href="#cb10-9" aria-hidden="true"></a>                &lt;<span class="ot">?</span>php</span>
<span id="cb10-10"><a href="#cb10-10" aria-hidden="true"></a>                the_archive_title<span class="ot">(</span><span class="st">&#39;&lt;h1 class=&quot;page-title&quot;&gt;&#39;</span><span class="ot">,</span> <span class="st">&#39;&lt;/h1&gt;&#39;</span><span class="ot">);</span></span>
<span id="cb10-11"><a href="#cb10-11" aria-hidden="true"></a>                the_archive_description<span class="ot">(</span><span class="st">&#39;&lt;div class=&quot;archive-description&quot;&gt;&#39;</span><span class="ot">,</span> <span class="st">&#39;&lt;/div&gt;&#39;</span><span class="ot">);</span></span>
<span id="cb10-12"><a href="#cb10-12" aria-hidden="true"></a>                <span class="kw">?&gt;</span></span>
<span id="cb10-13"><a href="#cb10-13" aria-hidden="true"></a>            &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb10-14"><a href="#cb10-14" aria-hidden="true"></a></span>
<span id="cb10-15"><a href="#cb10-15" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<span id="cb10-16"><a href="#cb10-16" aria-hidden="true"></a>            <span class="kw">while</span> <span class="ot">(</span>have_posts<span class="ot">())</span> <span class="ot">:</span></span>
<span id="cb10-17"><a href="#cb10-17" aria-hidden="true"></a>                the_post<span class="ot">();</span></span>
<span id="cb10-18"><a href="#cb10-18" 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>
<span id="cb10-19"><a href="#cb10-19" aria-hidden="true"></a>            <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb10-20"><a href="#cb10-20" aria-hidden="true"></a></span>
<span id="cb10-21"><a href="#cb10-21" aria-hidden="true"></a>            the_posts_navigation<span class="ot">();</span></span>
<span id="cb10-22"><a href="#cb10-22" aria-hidden="true"></a></span>
<span id="cb10-23"><a href="#cb10-23" aria-hidden="true"></a>        <span class="kw">else</span> :</span>
<span id="cb10-24"><a href="#cb10-24" 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;none&#39;</span><span class="ot">);</span></span>
<span id="cb10-25"><a href="#cb10-25" aria-hidden="true"></a>        <span class="kw">endif</span><span class="ot">;</span></span>
<span id="cb10-26"><a href="#cb10-26" aria-hidden="true"></a>        <span class="kw">?&gt;</span></span>
<span id="cb10-27"><a href="#cb10-27" aria-hidden="true"></a></span>
<span id="cb10-28"><a href="#cb10-28" aria-hidden="true"></a>    &lt;/main&gt;</span>
<span id="cb10-29"><a href="#cb10-29" aria-hidden="true"></a>&lt;/div&gt;</span>
<span id="cb10-30"><a href="#cb10-30" aria-hidden="true"></a></span>
<span id="cb10-31"><a href="#cb10-31" aria-hidden="true"></a>&lt;<span class="ot">?</span>php get_sidebar<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb10-32"><a href="#cb10-32" aria-hidden="true"></a><span class="kw">&lt;?php</span> get_footer<span class="ot">();</span> <span class="kw">?&gt;</span></span></code></pre>
</div>
<h2 id="template-parts">Template Parts</h2>
<p><strong>template-parts/content-excerpt.php</strong>:</p>
<div class="sourceCode" id="cb11">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb11-1"><a href="#cb11-1" 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>
<span id="cb11-2"><a href="#cb11-2" 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>
<span id="cb11-3"><a href="#cb11-3" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php the_title<span class="ot">(</span><span class="fu">sprintf</span><span class="ot">(</span><span class="st">&#39;&lt;h2 class=&quot;entry-title&quot;&gt;&lt;a href=&quot;%s&quot;&gt;&#39;</span><span class="ot">,</span> esc_url<span class="ot">(</span>get_permalink<span class="ot">())),</span> <span class="st">&#39;&lt;/a&gt;&lt;/h2&gt;&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb11-4"><a href="#cb11-4" aria-hidden="true"></a></span>
<span id="cb11-5"><a href="#cb11-5" aria-hidden="true"></a>        &lt;div <span class="kw">class</span>=<span class="st">&quot;entry-meta&quot;</span>&gt;</span>
<span id="cb11-6"><a href="#cb11-6" aria-hidden="true"></a>            &lt;span <span class="kw">class</span>=<span class="st">&quot;posted-on&quot;</span>&gt;&lt;<span class="ot">?</span>php <span class="kw">echo</span> get_the_date<span class="ot">();</span> <span class="kw">?&gt;</span>&lt;/span&gt;</span>
<span id="cb11-7"><a href="#cb11-7" aria-hidden="true"></a>            &lt;span <span class="kw">class</span>=<span class="st">&quot;byline&quot;</span>&gt; by &lt;<span class="ot">?</span>php the_author<span class="ot">();</span> <span class="kw">?&gt;</span>&lt;/span&gt;</span>
<span id="cb11-8"><a href="#cb11-8" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb11-9"><a href="#cb11-9" aria-hidden="true"></a>    &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb11-10"><a href="#cb11-10" aria-hidden="true"></a></span>
<span id="cb11-11"><a href="#cb11-11" 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>
<span id="cb11-12"><a href="#cb11-12" aria-hidden="true"></a>        &lt;div <span class="kw">class</span>=<span class="st">&quot;post-thumbnail&quot;</span>&gt;</span>
<span id="cb11-13"><a href="#cb11-13" aria-hidden="true"></a>            &lt;a href=<span class="st">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span>&gt;</span>
<span id="cb11-14"><a href="#cb11-14" 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>
<span id="cb11-15"><a href="#cb11-15" aria-hidden="true"></a>            &lt;/a&gt;</span>
<span id="cb11-16"><a href="#cb11-16" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb11-17"><a href="#cb11-17" 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>
<span id="cb11-18"><a href="#cb11-18" aria-hidden="true"></a></span>
<span id="cb11-19"><a href="#cb11-19" aria-hidden="true"></a>    &lt;div <span class="kw">class</span>=<span class="st">&quot;entry-summary&quot;</span>&gt;</span>
<span id="cb11-20"><a href="#cb11-20" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php the_excerpt<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb11-21"><a href="#cb11-21" aria-hidden="true"></a>    &lt;/div&gt;</span>
<span id="cb11-22"><a href="#cb11-22" aria-hidden="true"></a></span>
<span id="cb11-23"><a href="#cb11-23" aria-hidden="true"></a>    &lt;footer <span class="kw">class</span>=<span class="st">&quot;entry-footer&quot;</span>&gt;</span>
<span id="cb11-24"><a href="#cb11-24" aria-hidden="true"></a>        &lt;a href=<span class="st">&quot;&lt;?php the_permalink(); ?&gt;&quot;</span> <span class="kw">class</span>=<span class="st">&quot;read-more&quot;</span>&gt;</span>
<span id="cb11-25"><a href="#cb11-25" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php esc_html_e<span class="ot">(</span><span class="st">&#39;Read More&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb11-26"><a href="#cb11-26" aria-hidden="true"></a>        &lt;/a&gt;</span>
<span id="cb11-27"><a href="#cb11-27" aria-hidden="true"></a>    &lt;/footer&gt;</span>
<span id="cb11-28"><a href="#cb11-28" aria-hidden="true"></a>&lt;/article&gt;</span></code></pre>
</div>
<h2 id="sidebar.php-template">Sidebar.php Template</h2>
<p><strong>Widget Area Sidebar</strong>:</p>
<div class="sourceCode" id="cb12">
<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></span>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true"></a><span class="kw">if</span> <span class="ot">(</span>!is_active_sidebar<span class="ot">(</span><span class="st">&#39;sidebar-1&#39;</span><span class="ot">))</span> {</span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true"></a>    <span class="kw">return</span><span class="ot">;</span></span>
<span id="cb12-4"><a href="#cb12-4" aria-hidden="true"></a>}</span>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true"></a><span class="kw">?&gt;</span></span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true"></a></span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true"></a>&lt;aside id=<span class="st">&quot;secondary&quot;</span> <span class="kw">class</span>=<span class="st">&quot;widget-area&quot;</span>&gt;</span>
<span id="cb12-8"><a href="#cb12-8" aria-hidden="true"></a>    &lt;<span class="ot">?</span>php dynamic_sidebar<span class="ot">(</span><span class="st">&#39;sidebar-1&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span></span>
<span id="cb12-9"><a href="#cb12-9" aria-hidden="true"></a>&lt;/aside&gt;</span></code></pre>
</div>
<h2 id="search.php-template">Search.php Template</h2>
<p><strong>Search Results Template</strong>:</p>
<div class="sourceCode" id="cb13">
<pre class="sourceCode php"><code class="sourceCode php"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true"></a><span class="kw">&lt;?php</span> get_header<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb13-2"><a href="#cb13-2" aria-hidden="true"></a></span>
<span id="cb13-3"><a href="#cb13-3" aria-hidden="true"></a>&lt;div id=<span class="st">&quot;primary&quot;</span> <span class="kw">class</span>=<span class="st">&quot;content-area&quot;</span>&gt;</span>
<span id="cb13-4"><a href="#cb13-4" aria-hidden="true"></a>    &lt;main id=<span class="st">&quot;main&quot;</span> <span class="kw">class</span>=<span class="st">&quot;site-main&quot;</span>&gt;</span>
<span id="cb13-5"><a href="#cb13-5" aria-hidden="true"></a></span>
<span id="cb13-6"><a href="#cb13-6" 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>
<span id="cb13-7"><a href="#cb13-7" aria-hidden="true"></a></span>
<span id="cb13-8"><a href="#cb13-8" 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>
<span id="cb13-9"><a href="#cb13-9" aria-hidden="true"></a>                &lt;h1 <span class="kw">class</span>=<span class="st">&quot;page-title&quot;</span>&gt;</span>
<span id="cb13-10"><a href="#cb13-10" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php <span class="fu">printf</span><span class="ot">(</span>esc_html__<span class="ot">(</span><span class="st">&#39;Search Results for: %s&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#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>
<span id="cb13-11"><a href="#cb13-11" aria-hidden="true"></a>                &lt;/h1&gt;</span>
<span id="cb13-12"><a href="#cb13-12" aria-hidden="true"></a>            &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb13-13"><a href="#cb13-13" aria-hidden="true"></a></span>
<span id="cb13-14"><a href="#cb13-14" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<span id="cb13-15"><a href="#cb13-15" aria-hidden="true"></a>            <span class="kw">while</span> <span class="ot">(</span>have_posts<span class="ot">())</span> <span class="ot">:</span></span>
<span id="cb13-16"><a href="#cb13-16" aria-hidden="true"></a>                the_post<span class="ot">();</span></span>
<span id="cb13-17"><a href="#cb13-17" 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;search&#39;</span><span class="ot">);</span></span>
<span id="cb13-18"><a href="#cb13-18" aria-hidden="true"></a>            <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb13-19"><a href="#cb13-19" aria-hidden="true"></a></span>
<span id="cb13-20"><a href="#cb13-20" aria-hidden="true"></a>            the_posts_navigation<span class="ot">();</span></span>
<span id="cb13-21"><a href="#cb13-21" aria-hidden="true"></a></span>
<span id="cb13-22"><a href="#cb13-22" aria-hidden="true"></a>        <span class="kw">else</span> :</span>
<span id="cb13-23"><a href="#cb13-23" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb13-24"><a href="#cb13-24" aria-hidden="true"></a>            &lt;section <span class="kw">class</span>=<span class="st">&quot;no-results not-found&quot;</span>&gt;</span>
<span id="cb13-25"><a href="#cb13-25" 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>
<span id="cb13-26"><a href="#cb13-26" aria-hidden="true"></a>                    &lt;h1 <span class="kw">class</span>=<span class="st">&quot;page-title&quot;</span>&gt;&lt;<span class="ot">?</span>php esc_html_e<span class="ot">(</span><span class="st">&#39;Nothing Found&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/h1&gt;</span>
<span id="cb13-27"><a href="#cb13-27" aria-hidden="true"></a>                &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb13-28"><a href="#cb13-28" aria-hidden="true"></a></span>
<span id="cb13-29"><a href="#cb13-29" aria-hidden="true"></a>                &lt;div <span class="kw">class</span>=<span class="st">&quot;page-content&quot;</span>&gt;</span>
<span id="cb13-30"><a href="#cb13-30" aria-hidden="true"></a>                    &lt;p&gt;&lt;<span class="ot">?</span>php esc_html_e<span class="ot">(</span><span class="st">&#39;Sorry, but nothing matched your search terms. Please try again with different keywords.&#39;</span><span class="ot">,</span> <span class="st">&#39;mytheme&#39;</span><span class="ot">);</span> <span class="kw">?&gt;</span>&lt;/p&gt;</span>
<span id="cb13-31"><a href="#cb13-31" aria-hidden="true"></a>                    &lt;<span class="ot">?</span>php get_search_form<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb13-32"><a href="#cb13-32" aria-hidden="true"></a>                &lt;/div&gt;</span>
<span id="cb13-33"><a href="#cb13-33" aria-hidden="true"></a>            &lt;/section&gt;</span>
<span id="cb13-34"><a href="#cb13-34" 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>
<span id="cb13-35"><a href="#cb13-35" aria-hidden="true"></a></span>
<span id="cb13-36"><a href="#cb13-36" aria-hidden="true"></a>    &lt;/main&gt;</span>
<span id="cb13-37"><a href="#cb13-37" aria-hidden="true"></a>&lt;/div&gt;</span>
<span id="cb13-38"><a href="#cb13-38" aria-hidden="true"></a></span>
<span id="cb13-39"><a href="#cb13-39" aria-hidden="true"></a>&lt;<span class="ot">?</span>php get_sidebar<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb13-40"><a href="#cb13-40" aria-hidden="true"></a><span class="kw">&lt;?php</span> get_footer<span class="ot">();</span> <span class="kw">?&gt;</span></span></code></pre>
</div>
<h2 id="conclusion">Conclusion</h2>
<p>WordPress theme development creates custom designs through template hierarchy, functions.php configuration, and modular template parts. Build themes from scratch using required style.css and index.php files, expand functionality through header.php, footer.php, single.php, page.php templates, register navigation menus and widget areas, enqueue stylesheets and scripts properly, and follow WordPress coding standards. Custom themes provide unlimited design flexibility and complete control over WordPress site appearance and functionality.</p>
<h2 id="external-links">External Links</h2>
<ol type="1">
<li><a href="https://developer.wordpress.org/themes/">WordPress Theme Handbook</a></li>
<li><a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">Template Hierarchy</a></li>
<li><a href="https://developer.wordpress.org/themes/release/theme-review-guidelines/">Theme Development Checklist</a></li>
<li><a href="https://developer.wordpress.org/coding-standards/wordpress-coding-standards/">WordPress Coding Standards</a></li>
<li><a href="https://underscores.me/">Underscores Starter Theme</a></li>
</ol>
<h2 id="call-to-action">Call to Action</h2>
<p>Custom themes need reliable backups. <a href="https://backupcopilotplugin.com/">Backup Copilot Pro</a> protects your WordPress theme files and database automatically. Safeguard your development work—start your free 30-day trial today!</p>
<p>The post <a href="https://developryplugins.com/wordpress-theme-development-from-scratch-complete-tutorial-2025/">WordPress Theme Development from Scratch: Complete Tutorial 2025</a> appeared first on <a href="https://developryplugins.com">Developry Plugins</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>WordPress Theme Template Hierarchy Explained with Examples</title>
		<link>https://developryplugins.com/wordpress-theme-template-hierarchy-explained-with-examples/</link>
		
		<dc:creator><![CDATA[Krasen Slavov]]></dc:creator>
		<pubDate>Wed, 10 Dec 2025 09:00:00 +0000</pubDate>
				<category><![CDATA[WordPress Theme Development]]></category>
		<category><![CDATA[conditional tags]]></category>
		<category><![CDATA[template files]]></category>
		<category><![CDATA[template hierarchy]]></category>
		<category><![CDATA[theme structure]]></category>
		<category><![CDATA[wordpress templates]]></category>
		<guid isPermaLink="false">https://developryplugins.com/?p=183</guid>

					<description><![CDATA[<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...</p>
<p>The post <a href="https://developryplugins.com/wordpress-theme-template-hierarchy-explained-with-examples/">WordPress Theme Template Hierarchy Explained with Examples</a> appeared first on <a href="https://developryplugins.com">Developry Plugins</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><!-- @format --></p>
<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>
<h2 id="how-template-hierarchy-works">How Template Hierarchy Works</h2>
<p><strong>Request Flow</strong>:</p>
<ol type="1">
<li>User requests URL: <code>example.com/category/news/</code></li>
<li>WordPress identifies request type: Category archive</li>
<li>WordPress searches for templates in order:
<ul>
<li><code>category-news.php</code> (category slug)</li>
<li><code>category-5.php</code> (category ID)</li>
<li><code>category.php</code> (generic category)</li>
<li><code>archive.php</code> (generic archive)</li>
<li><code>index.php</code> (fallback)</li>
</ul>
</li>
<li>First matching template renders content</li>
</ol>
<p><strong>Fallback System</strong>:</p>
<p>WordPress searches from most specific to least specific until finding template file.</p>
<p><strong>Example Hierarchy</strong> (single post):</p>
<pre><code>single-{post-type}-{slug}.php
→ single-{post-type}.php
→ single.php
→ singular.php
→ index.php</code></pre>
<h2 id="index.php---the-fallback">Index.php &#8211; The Fallback</h2>
<p><strong>Ultimate Fallback</strong>:</p>
<p><code>index.php</code> displays content when no specific template exists.</p>
<p><strong>Required</strong>: Every theme must have <code>index.php</code>.</p>
<p><strong>Example index.php</strong>:</p>
<div class="sourceCode" id="cb2">
<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>
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true"></a></span>
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;main&quot;</span>&gt;</span>
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true"></a>    &lt;<span class="ot">?</span>php</span>
<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>
<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>
<span id="cb2-7"><a href="#cb2-7" aria-hidden="true"></a>            the_post<span class="ot">();</span></span>
<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>
<span id="cb2-9"><a href="#cb2-9" aria-hidden="true"></a>        <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb2-10"><a href="#cb2-10" aria-hidden="true"></a>    <span class="kw">endif</span><span class="ot">;</span></span>
<span id="cb2-11"><a href="#cb2-11" aria-hidden="true"></a>    <span class="kw">?&gt;</span></span>
<span id="cb2-12"><a href="#cb2-12" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb2-13"><a href="#cb2-13" aria-hidden="true"></a></span>
<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>
<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>
</div>
<h2 id="single-post-templates">Single Post Templates</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>single-{post-type}-{slug}.php
single-{post-type}.php
single.php
singular.php
index.php</code></pre>
<p><strong>Examples</strong>:</p>
<p>Post slug <code>hello-world</code>:</p>
<ul>
<li><code>single-post-hello-world.php</code> (most specific)</li>
<li><code>single-post.php</code></li>
<li><code>single.php</code></li>
<li><code>singular.php</code></li>
<li><code>index.php</code></li>
</ul>
<p>Custom post type <code>portfolio</code> with slug <code>web-design</code>:</p>
<ul>
<li><code>single-portfolio-web-design.php</code></li>
<li><code>single-portfolio.php</code></li>
<li><code>single.php</code></li>
<li><code>singular.php</code></li>
<li><code>index.php</code></li>
</ul>
<p><strong>single.php</strong>:</p>
<div class="sourceCode" id="cb4">
<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>
<span id="cb4-2"><a href="#cb4-2" aria-hidden="true"></a></span>
<span id="cb4-3"><a href="#cb4-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;primary&quot;</span>&gt;</span>
<span id="cb4-4"><a href="#cb4-4" aria-hidden="true"></a>    &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb4-6"><a href="#cb4-6" aria-hidden="true"></a>        the_post<span class="ot">();</span></span>
<span id="cb4-7"><a href="#cb4-7" aria-hidden="true"></a>        <span class="kw">?&gt;</span></span>
<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>
<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>
<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>
<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>
<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>
<span id="cb4-13"><a href="#cb4-13" aria-hidden="true"></a>                &lt;/div&gt;</span>
<span id="cb4-14"><a href="#cb4-14" aria-hidden="true"></a>            &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb4-15"><a href="#cb4-15" aria-hidden="true"></a></span>
<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>
<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>
<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>
<span id="cb4-19"><a href="#cb4-19" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb4-22"><a href="#cb4-22" aria-hidden="true"></a>            &lt;/div&gt;</span>
<span id="cb4-23"><a href="#cb4-23" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb4-26"><a href="#cb4-26" aria-hidden="true"></a>            &lt;/footer&gt;</span>
<span id="cb4-27"><a href="#cb4-27" aria-hidden="true"></a>        &lt;/article&gt;</span>
<span id="cb4-28"><a href="#cb4-28" aria-hidden="true"></a></span>
<span id="cb4-29"><a href="#cb4-29" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb4-31"><a href="#cb4-31" aria-hidden="true"></a>            comments_template<span class="ot">();</span></span>
<span id="cb4-32"><a href="#cb4-32" aria-hidden="true"></a>        <span class="kw">endif</span><span class="ot">;</span></span>
<span id="cb4-33"><a href="#cb4-33" aria-hidden="true"></a>    <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb4-34"><a href="#cb4-34" aria-hidden="true"></a>    <span class="kw">?&gt;</span></span>
<span id="cb4-35"><a href="#cb4-35" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb4-36"><a href="#cb4-36" aria-hidden="true"></a></span>
<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>
<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>
</div>
<h2 id="page-templates">Page Templates</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>{custom-template}.php (selected via admin)
page-{slug}.php
page-{id}.php
page.php
singular.php
index.php</code></pre>
<p><strong>Examples</strong>:</p>
<p>Page slug <code>about</code>:</p>
<ul>
<li>Custom template (if selected in admin)</li>
<li><code>page-about.php</code></li>
<li><code>page-42.php</code> (if page ID is 42)</li>
<li><code>page.php</code></li>
<li><code>singular.php</code></li>
<li><code>index.php</code></li>
</ul>
<p><strong>page.php</strong>:</p>
<div class="sourceCode" id="cb6">
<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>
<span id="cb6-2"><a href="#cb6-2" aria-hidden="true"></a></span>
<span id="cb6-3"><a href="#cb6-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;primary&quot;</span>&gt;</span>
<span id="cb6-4"><a href="#cb6-4" aria-hidden="true"></a>    &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb6-6"><a href="#cb6-6" aria-hidden="true"></a>        the_post<span class="ot">();</span></span>
<span id="cb6-7"><a href="#cb6-7" aria-hidden="true"></a>        <span class="kw">?&gt;</span></span>
<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>
<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>
<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>
<span id="cb6-11"><a href="#cb6-11" aria-hidden="true"></a>            &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb6-12"><a href="#cb6-12" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true"></a>            &lt;/div&gt;</span>
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true"></a>        &lt;/article&gt;</span>
<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>
<span id="cb6-18"><a href="#cb6-18" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb6-19"><a href="#cb6-19" aria-hidden="true"></a></span>
<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>
</div>
<p><strong>Custom Page Template</strong>:</p>
<p><code>template-fullwidth.php</code>:</p>
<div class="sourceCode" id="cb7">
<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>
<span id="cb7-2"><a href="#cb7-2" aria-hidden="true"></a><span class="co">/**</span></span>
<span id="cb7-3"><a href="#cb7-3" aria-hidden="true"></a><span class="co"> * Template Name: Full Width</span></span>
<span id="cb7-4"><a href="#cb7-4" aria-hidden="true"></a><span class="co"> * Template Post Type: page, post</span></span>
<span id="cb7-5"><a href="#cb7-5" aria-hidden="true"></a><span class="co"> */</span></span>
<span id="cb7-6"><a href="#cb7-6" aria-hidden="true"></a></span>
<span id="cb7-7"><a href="#cb7-7" aria-hidden="true"></a>get_header<span class="ot">();</span> <span class="kw">?&gt;</span></span>
<span id="cb7-8"><a href="#cb7-8" aria-hidden="true"></a></span>
<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>
<span id="cb7-10"><a href="#cb7-10" aria-hidden="true"></a>    &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb7-12"><a href="#cb7-12" aria-hidden="true"></a>        the_post<span class="ot">();</span></span>
<span id="cb7-13"><a href="#cb7-13" aria-hidden="true"></a>        the_content<span class="ot">();</span></span>
<span id="cb7-14"><a href="#cb7-14" aria-hidden="true"></a>    <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb7-15"><a href="#cb7-15" aria-hidden="true"></a>    <span class="kw">?&gt;</span></span>
<span id="cb7-16"><a href="#cb7-16" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb7-17"><a href="#cb7-17" aria-hidden="true"></a></span>
<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>
</div>
<p>Selectable via: Page edit screen → Page Attributes → Template</p>
<h2 id="category-archive-templates">Category Archive Templates</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>category-{slug}.php
category-{id}.php
category.php
archive.php
index.php</code></pre>
<p><strong>Examples</strong>:</p>
<p>Category slug <code>news</code> (ID 5):</p>
<ul>
<li><code>category-news.php</code></li>
<li><code>category-5.php</code></li>
<li><code>category.php</code></li>
<li><code>archive.php</code></li>
<li><code>index.php</code></li>
</ul>
<p><strong>category.php</strong>:</p>
<div class="sourceCode" id="cb9">
<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>
<span id="cb9-2"><a href="#cb9-2" aria-hidden="true"></a></span>
<span id="cb9-3"><a href="#cb9-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;primary&quot;</span>&gt;</span>
<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>
<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>
<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>
<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>
<span id="cb9-8"><a href="#cb9-8" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb9-9"><a href="#cb9-9" aria-hidden="true"></a>    &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb9-10"><a href="#cb9-10" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb9-13"><a href="#cb9-13" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb9-15"><a href="#cb9-15" aria-hidden="true"></a>                the_post<span class="ot">();</span></span>
<span id="cb9-16"><a href="#cb9-16" aria-hidden="true"></a>                <span class="kw">?&gt;</span></span>
<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>
<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>
<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>
<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>
<span id="cb9-21"><a href="#cb9-21" aria-hidden="true"></a>                    &lt;/div&gt;</span>
<span id="cb9-22"><a href="#cb9-22" aria-hidden="true"></a>                &lt;/article&gt;</span>
<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>
<span id="cb9-24"><a href="#cb9-24" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb9-25"><a href="#cb9-25" aria-hidden="true"></a></span>
<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>
<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>
<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>
<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>
<span id="cb9-30"><a href="#cb9-30" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb9-31"><a href="#cb9-31" aria-hidden="true"></a></span>
<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>
<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>
</div>
<h2 id="tag-archive-templates">Tag Archive Templates</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>tag-{slug}.php
tag-{id}.php
tag.php
archive.php
index.php</code></pre>
<p><strong>Examples</strong>:</p>
<p>Tag slug <code>wordpress</code> (ID 10):</p>
<ul>
<li><code>tag-wordpress.php</code></li>
<li><code>tag-10.php</code></li>
<li><code>tag.php</code></li>
<li><code>archive.php</code></li>
<li><code>index.php</code></li>
</ul>
<h2 id="custom-post-type-archives">Custom Post Type Archives</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>archive-{post-type}.php
archive.php
index.php</code></pre>
<p><strong>Example</strong>:</p>
<p>Portfolio post type:</p>
<ul>
<li><code>archive-portfolio.php</code></li>
<li><code>archive.php</code></li>
<li><code>index.php</code></li>
</ul>
<p><strong>archive-portfolio.php</strong>:</p>
<div class="sourceCode" id="cb12">
<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>
<span id="cb12-2"><a href="#cb12-2" aria-hidden="true"></a></span>
<span id="cb12-3"><a href="#cb12-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;primary&quot;</span>&gt;</span>
<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>
<span id="cb12-5"><a href="#cb12-5" aria-hidden="true"></a>        &lt;h1&gt;Portfolio&lt;/h1&gt;</span>
<span id="cb12-6"><a href="#cb12-6" aria-hidden="true"></a>    &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb12-7"><a href="#cb12-7" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb12-10"><a href="#cb12-10" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb12-12"><a href="#cb12-12" aria-hidden="true"></a>                the_post<span class="ot">();</span></span>
<span id="cb12-13"><a href="#cb12-13" aria-hidden="true"></a>                <span class="kw">?&gt;</span></span>
<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>
<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>
<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>
<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>
<span id="cb12-18"><a href="#cb12-18" aria-hidden="true"></a>                    &lt;/a&gt;</span>
<span id="cb12-19"><a href="#cb12-19" aria-hidden="true"></a>                &lt;/div&gt;</span>
<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>
<span id="cb12-21"><a href="#cb12-21" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb12-22"><a href="#cb12-22" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb12-25"><a href="#cb12-25" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb12-26"><a href="#cb12-26" aria-hidden="true"></a></span>
<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>
</div>
<h2 id="custom-taxonomy-templates">Custom Taxonomy Templates</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>taxonomy-{taxonomy}-{term}.php
taxonomy-{taxonomy}.php
taxonomy.php
archive.php
index.php</code></pre>
<p><strong>Example</strong>:</p>
<p>Taxonomy <code>portfolio_category</code>, term <code>web-design</code>:</p>
<ul>
<li><code>taxonomy-portfolio_category-web-design.php</code></li>
<li><code>taxonomy-portfolio_category.php</code></li>
<li><code>taxonomy.php</code></li>
<li><code>archive.php</code></li>
<li><code>index.php</code></li>
</ul>
<h2 id="author-archive-templates">Author Archive Templates</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>author-{nicename}.php
author-{id}.php
author.php
archive.php
index.php</code></pre>
<p><strong>author.php</strong>:</p>
<div class="sourceCode" id="cb15">
<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>
<span id="cb15-2"><a href="#cb15-2" aria-hidden="true"></a></span>
<span id="cb15-3"><a href="#cb15-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;primary&quot;</span>&gt;</span>
<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>
<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>
<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>
<span id="cb15-7"><a href="#cb15-7" aria-hidden="true"></a>        &lt;/div&gt;</span>
<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>
<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>
<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>
<span id="cb15-11"><a href="#cb15-11" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb15-12"><a href="#cb15-12" aria-hidden="true"></a>    &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb15-13"><a href="#cb15-13" aria-hidden="true"></a></span>
<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>
<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>
<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>
<span id="cb15-17"><a href="#cb15-17" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb15-19"><a href="#cb15-19" aria-hidden="true"></a>                the_post<span class="ot">();</span></span>
<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>
<span id="cb15-21"><a href="#cb15-21" aria-hidden="true"></a>            <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb15-22"><a href="#cb15-22" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb15-23"><a href="#cb15-23" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb15-24"><a href="#cb15-24" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb15-27"><a href="#cb15-27" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb15-28"><a href="#cb15-28" aria-hidden="true"></a></span>
<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>
<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>
</div>
<h2 id="date-archive-templates">Date Archive Templates</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>date.php
archive.php
index.php</code></pre>
<p><strong>date.php</strong>:</p>
<div class="sourceCode" id="cb17">
<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>
<span id="cb17-2"><a href="#cb17-2" aria-hidden="true"></a></span>
<span id="cb17-3"><a href="#cb17-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;primary&quot;</span>&gt;</span>
<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>
<span id="cb17-5"><a href="#cb17-5" aria-hidden="true"></a>        &lt;h1&gt;</span>
<span id="cb17-6"><a href="#cb17-6" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<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>
<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>
<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>
<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>
<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>
<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>
<span id="cb17-13"><a href="#cb17-13" aria-hidden="true"></a>            <span class="kw">endif</span><span class="ot">;</span></span>
<span id="cb17-14"><a href="#cb17-14" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb17-15"><a href="#cb17-15" aria-hidden="true"></a>        &lt;/h1&gt;</span>
<span id="cb17-16"><a href="#cb17-16" aria-hidden="true"></a>    &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb17-17"><a href="#cb17-17" aria-hidden="true"></a></span>
<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>
<span id="cb17-19"><a href="#cb17-19" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb17-21"><a href="#cb17-21" aria-hidden="true"></a>            the_post<span class="ot">();</span></span>
<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>
<span id="cb17-23"><a href="#cb17-23" aria-hidden="true"></a>        <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb17-24"><a href="#cb17-24" aria-hidden="true"></a>        <span class="kw">?&gt;</span></span>
<span id="cb17-25"><a href="#cb17-25" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb17-28"><a href="#cb17-28" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb17-29"><a href="#cb17-29" aria-hidden="true"></a></span>
<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>
<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>
</div>
<h2 id="search-results-template">Search Results Template</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>search.php
index.php</code></pre>
<p><strong>search.php</strong>:</p>
<div class="sourceCode" id="cb19">
<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>
<span id="cb19-2"><a href="#cb19-2" aria-hidden="true"></a></span>
<span id="cb19-3"><a href="#cb19-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;primary&quot;</span>&gt;</span>
<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>
<span id="cb19-5"><a href="#cb19-5" aria-hidden="true"></a>        &lt;h1&gt;</span>
<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>
<span id="cb19-7"><a href="#cb19-7" aria-hidden="true"></a>        &lt;/h1&gt;</span>
<span id="cb19-8"><a href="#cb19-8" aria-hidden="true"></a>    &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb19-9"><a href="#cb19-9" aria-hidden="true"></a></span>
<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>
<span id="cb19-11"><a href="#cb19-11" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php</span>
<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>
<span id="cb19-13"><a href="#cb19-13" aria-hidden="true"></a>            the_post<span class="ot">();</span></span>
<span id="cb19-14"><a href="#cb19-14" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb19-15"><a href="#cb19-15" aria-hidden="true"></a>            &lt;article&gt;</span>
<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>
<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>
<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>
<span id="cb19-19"><a href="#cb19-19" aria-hidden="true"></a>                &lt;/div&gt;</span>
<span id="cb19-20"><a href="#cb19-20" aria-hidden="true"></a>            &lt;/article&gt;</span>
<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>
<span id="cb19-22"><a href="#cb19-22" aria-hidden="true"></a></span>
<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>
<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>
<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>
<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>
<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>
<span id="cb19-28"><a href="#cb19-28" aria-hidden="true"></a>        &lt;/div&gt;</span>
<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>
<span id="cb19-30"><a href="#cb19-30" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb19-31"><a href="#cb19-31" aria-hidden="true"></a></span>
<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>
<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>
</div>
<h2 id="error-template">404 Error Template</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>404.php
index.php</code></pre>
<p><strong>404.php</strong>:</p>
<div class="sourceCode" id="cb21">
<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>
<span id="cb21-2"><a href="#cb21-2" aria-hidden="true"></a></span>
<span id="cb21-3"><a href="#cb21-3" aria-hidden="true"></a>&lt;main id=<span class="st">&quot;primary&quot;</span>&gt;</span>
<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>
<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>
<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>
<span id="cb21-7"><a href="#cb21-7" aria-hidden="true"></a>        &lt;/<span class="fu">header</span>&gt;</span>
<span id="cb21-8"><a href="#cb21-8" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb21-11"><a href="#cb21-11" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb21-14"><a href="#cb21-14" aria-hidden="true"></a></span>
<span id="cb21-15"><a href="#cb21-15" aria-hidden="true"></a>            &lt;h2&gt;Popular Posts:&lt;/h2&gt;</span>
<span id="cb21-16"><a href="#cb21-16" aria-hidden="true"></a>            &lt;<span class="ot">?</span>php</span>
<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>
<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>
<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>
<span id="cb21-20"><a href="#cb21-20" aria-hidden="true"></a>            <span class="ot">));</span></span>
<span id="cb21-21"><a href="#cb21-21" aria-hidden="true"></a></span>
<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>
<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>
<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>
<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>
<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>
<span id="cb21-27"><a href="#cb21-27" aria-hidden="true"></a>                <span class="kw">endwhile</span><span class="ot">;</span></span>
<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>
<span id="cb21-29"><a href="#cb21-29" aria-hidden="true"></a>                wp_reset_postdata<span class="ot">();</span></span>
<span id="cb21-30"><a href="#cb21-30" aria-hidden="true"></a>            <span class="kw">endif</span><span class="ot">;</span></span>
<span id="cb21-31"><a href="#cb21-31" aria-hidden="true"></a>            <span class="kw">?&gt;</span></span>
<span id="cb21-32"><a href="#cb21-32" aria-hidden="true"></a>        &lt;/div&gt;</span>
<span id="cb21-33"><a href="#cb21-33" aria-hidden="true"></a>    &lt;/section&gt;</span>
<span id="cb21-34"><a href="#cb21-34" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb21-35"><a href="#cb21-35" aria-hidden="true"></a></span>
<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>
</div>
<h2 id="attachment-template">Attachment Template</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>{MIME_type}.php (image.php, video.php, application.php)
attachment.php
single-attachment-{slug}.php
single-attachment.php
single.php
singular.php
index.php</code></pre>
<h2 id="front-page-template">Front Page Template</h2>
<p><strong>Hierarchy</strong>:</p>
<pre><code>front-page.php
home.php (if front page displays posts)
page.php (if static front page set)
index.php</code></pre>
<p><strong>front-page.php</strong>:</p>
<div class="sourceCode" id="cb24">
<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>
<span id="cb24-2"><a href="#cb24-2" aria-hidden="true"></a></span>
<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>
<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>
<span id="cb24-5"><a href="#cb24-5" aria-hidden="true"></a>        &lt;h1&gt;Welcome to Our Website&lt;/h1&gt;</span>
<span id="cb24-6"><a href="#cb24-6" aria-hidden="true"></a>        &lt;p&gt;Featured content here&lt;/p&gt;</span>
<span id="cb24-7"><a href="#cb24-7" aria-hidden="true"></a>    &lt;/section&gt;</span>
<span id="cb24-8"><a href="#cb24-8" aria-hidden="true"></a></span>
<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>
<span id="cb24-10"><a href="#cb24-10" aria-hidden="true"></a>        &lt;h2&gt;Latest Posts&lt;/h2&gt;</span>
<span id="cb24-11"><a href="#cb24-11" aria-hidden="true"></a>        &lt;<span class="ot">?</span>php</span>
<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>
<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>
<span id="cb24-14"><a href="#cb24-14" aria-hidden="true"></a>        <span class="ot">));</span></span>
<span id="cb24-15"><a href="#cb24-15" aria-hidden="true"></a></span>
<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>
<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>
<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>
<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>
<span id="cb24-20"><a href="#cb24-20" aria-hidden="true"></a>            <span class="kw">endwhile</span><span class="ot">;</span></span>
<span id="cb24-21"><a href="#cb24-21" aria-hidden="true"></a>            wp_reset_postdata<span class="ot">();</span></span>
<span id="cb24-22"><a href="#cb24-22" aria-hidden="true"></a>        <span class="kw">endif</span><span class="ot">;</span></span>
<span id="cb24-23"><a href="#cb24-23" aria-hidden="true"></a>        <span class="kw">?&gt;</span></span>
<span id="cb24-24"><a href="#cb24-24" aria-hidden="true"></a>    &lt;/section&gt;</span>
<span id="cb24-25"><a href="#cb24-25" aria-hidden="true"></a>&lt;/main&gt;</span>
<span id="cb24-26"><a href="#cb24-26" aria-hidden="true"></a></span>
<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>
</div>
<h2 id="debugging-template-hierarchy">Debugging Template Hierarchy</h2>
<p><strong>Show Active Template</strong>:</p>
<div class="sourceCode" id="cb25">
<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>
<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>
<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>
<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>
<span id="cb25-5"><a href="#cb25-5" aria-hidden="true"></a>    }</span>
<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>
<span id="cb25-7"><a href="#cb25-7" aria-hidden="true"></a>}<span class="ot">);</span></span></code></pre>
</div>
<p><strong>Query Monitor Plugin</strong>:</p>
<p>Install Query Monitor plugin to see:</p>
<ul>
<li>Active template file</li>
<li>Template hierarchy checked</li>
<li>Conditional tags active</li>
</ul>
<p><strong>Conditional Tags</strong>:</p>
<p>Determine current page type:</p>
<div class="sourceCode" id="cb26">
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
<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>
</div>
<h2 id="conclusion">Conclusion</h2>
<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>
<h2 id="external-links">External Links</h2>
<ol type="1">
<li><a href="https://developer.wordpress.org/themes/basics/template-hierarchy/">Template Hierarchy Documentation</a></li>
<li><a href="https://developer.wordpress.org/themes/basics/conditional-tags/">Conditional Tags Reference</a></li>
<li><a href="https://developer.wordpress.org/themes/basics/template-files/">Template Files List</a></li>
<li><a href="https://wordpress.org/plugins/query-monitor/">Query Monitor Plugin</a></li>
<li><a href="https://developer.wordpress.org/files/2014/10/Screenshot-2019-01-23.00.20.04.png">Interactive Template Hierarchy</a></li>
</ol>
<h2 id="call-to-action">Call to Action</h2>
<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—start your free 30-day trial today!</p>
<p>The post <a href="https://developryplugins.com/wordpress-theme-template-hierarchy-explained-with-examples/">WordPress Theme Template Hierarchy Explained with Examples</a> appeared first on <a href="https://developryplugins.com">Developry Plugins</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
