<?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>Internet Growth Engine &#187; comments .php</title>
	<atom:link href="http://sangkrit.net/tag/comments-php/feed/" rel="self" type="application/rss+xml" />
	<link>http://sangkrit.net</link>
	<description>Linux &#124; Apache &#124; MySQL &#124; PHP</description>
	<lastBuildDate>Wed, 22 May 2013 09:53:02 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Getting Started With WordPress Theme Development</title>
		<link>http://sangkrit.net/2011/05/23/getting-started-with-wordpress-theme-development/</link>
		<comments>http://sangkrit.net/2011/05/23/getting-started-with-wordpress-theme-development/#comments</comments>
		<pubDate>Mon, 23 May 2011 08:18:13 +0000</pubDate>
		<dc:creator>Shardul Pandey</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[404.php]]></category>
		<category><![CDATA[Archive.php]]></category>
		<category><![CDATA[Author.php]]></category>
		<category><![CDATA[beginners guide to wordpress themes]]></category>
		<category><![CDATA[beginning with wordpress themes]]></category>
		<category><![CDATA[Category.php]]></category>
		<category><![CDATA[comments .php]]></category>
		<category><![CDATA[creating wordpress theme]]></category>
		<category><![CDATA[footer.php]]></category>
		<category><![CDATA[function.php]]></category>
		<category><![CDATA[header.php]]></category>
		<category><![CDATA[how to create a wordpress theme]]></category>
		<category><![CDATA[index.php]]></category>
		<category><![CDATA[Page.php]]></category>
		<category><![CDATA[Search.php]]></category>
		<category><![CDATA[siderbar.php]]></category>
		<category><![CDATA[single .php]]></category>
		<category><![CDATA[style.css]]></category>
		<category><![CDATA[Tags.php]]></category>
		<category><![CDATA[wordpress theme design]]></category>
		<category><![CDATA[wordpress theme design tutorial]]></category>
		<category><![CDATA[wordpress theme development]]></category>
		<category><![CDATA[wordpress theme tutorial]]></category>
		<category><![CDATA[wordpress themes development]]></category>

		<guid isPermaLink="false">http://lamp.sangkrit.net/?p=217</guid>
		<description><![CDATA[<p>A wordpress theme’s directory contains:</p> index.php header.php footer.php single.php 404.php Search.php Page.php Comments.php Archive.php Tags.php Category.php Author.php siderbar.php function.php style.css <p>Before getting stared you may use these post links for getting familiar with the coding we are going to do here in the theme development:</p> <p>(For example: Click on Function’s link to know, ‘How to [...]<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href='http://sangkrit.net/2011/09/09/how-to-create-a-search-template-for-wordpress/' rel='bookmark' title='How To Create A Search Template For WordPress'>How To Create A Search Template For WordPress</a> <small>Search result template is used when a search is performed...</small></li>
<li><a href='http://sangkrit.net/2011/09/15/easiest-way-of-creating-post-attachment-for-wordpress/' rel='bookmark' title='Easiest Way Of  Creating Post Attachment For WordPress'>Easiest Way Of  Creating Post Attachment For WordPress</a> <small>Easiest way to created attachment.php is to copy single.php, renaming...</small></li>
<li><a href='http://sangkrit.net/2012/09/01/how-to-add-comment-numbers-in-your-wordpress-theme/' rel='bookmark' title='How To Add Comment Numbers In Your WordPress Theme ?'>How To Add Comment Numbers In Your WordPress Theme ?</a> <small>There are many WordPress themes that don&#8217;t show numbers on...</small></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>A wordpress theme’s directory contains:</p>
<ol>
<li>index.php</li>
<li>header.php</li>
<li>footer.php</li>
<li>single.php</li>
<li>404.php</li>
<li>Search.php</li>
<li>Page.php</li>
<li>Comments.php</li>
<li>Archive.php</li>
<li>Tags.php</li>
<li>Category.php</li>
<li>Author.php</li>
<li>siderbar.php</li>
<li>function.php</li>
<li>style.css</li>
</ol>
<p>Before getting stared you may use these post links for getting familiar with the coding we are going to do here in the theme development:</p>
<p>(For example: Click on Function’s link to know, ‘How to create a function?’)</p>
<ol>
<li><a href="http://lamp.sangkrit.net/2010/12/20/functions/">Functions</a></li>
<li><a href="http://lamp.sangkrit.net/2010/12/20/loops/">Loops</a></li>
<li><a href="http://lamp.sangkrit.net/2010/12/19/ifelse-and-switch-statements/">If/Else Statements</a></li>
<li><a href="http://lamp.sangkrit.net/2010/12/20/arrays/">Arrays</a></li>
</ol>
<p><strong>Header.php</strong></p>
<p><span style="color: #ff0000"><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"</code><code>"</code></span><a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><span style="color: #ff0000">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</span></a><span style="color: #ff0000"><code>"&gt;</code></span></p>
<p><span style="color: #ff6600"><code>&lt;html xmlns="</code></span><a href="http://www.w3.org/1999/xhtml"><span style="color: #ff6600">http://www.w3.org/1999/xhtml</span></a><span style="color: #ff6600"><code>"</code> <code>&lt;?php language_attributes(); ?&gt;&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;head profile="</code></span><a href="http://gmpg.org/xfn/11"><span style="color: #339966">http://gmpg.org/xfn/11</span></a><span style="color: #339966"><code>"&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;title&gt;&lt;?php</code></span></p>
<p><span style="color: #339966"><code>if</code> <code>( is_single() ) { single_post_title(); }</code></span></p>
<p><span style="color: #339966"><code>elseif</code> <code>( is_home() || is_front_page() ) { bloginfo('name'); print</code> <code>' | '; bloginfo('description'); get_page_number(); }</code></span></p>
<p><span style="color: #339966"><code>elseif</code> <code>( is_page() ) { single_post_title(''); }</code></span></p>
<p><span style="color: #339966"><code>elseif</code> <code>( is_search() ) { bloginfo('name'); print</code> <code>' | Search results for '</code> <code>. wp_specialchars($s); get_page_number(); }</code></span></p>
<p><span style="color: #339966"><code>elseif</code> <code>( is_404() ) { bloginfo('name'); print</code> <code>' | Not Found'; }</code></span></p>
<p><span style="color: #339966"><code>else</code> <code>{ bloginfo('name'); wp_title('|'); get_page_number(); }</code></span></p>
<p><span style="color: #339966"><code>?&gt;&lt;/title&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;meta http-equiv="content-type"</code> <code>content="&lt;?php bloginfo('html_type'); ?&gt;; charset=&lt;?php bloginfo('charset'); ?&gt;"</code> <code>/&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;link rel="stylesheet"</code> <code>type="text/css"</code> <code>href="&lt;?php bloginfo('stylesheet_url'); ?&gt;"</code> <code>/&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;?php if</code> <code>( is_singular() ) wp_enqueue_script( 'comment-reply'</code> <code>); ?&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;?php wp_head(); ?&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;link rel="alternate"</code> <code>type="application/rss+xml"</code> <code>href="&lt;?php bloginfo('rss2_url'); ?&gt;"</code><code>title="&lt;?php printf( __( '%s latest posts', 'your-theme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?&gt;"</code> <code>/&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;link rel="alternate"</code> <code>type="application/rss+xml"</code> <code>href="&lt;?php bloginfo('comments_rss2_url') ?&gt;"</code> <code>title="&lt;?php printf( __( '%s latest comments', 'your-theme' ), wp_specialchars( get_bloginfo('name'), 1 ) ); ?&gt;"</code> <code>/&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;link rel="pingback"</code> <code>href="&lt;?php bloginfo('pingback_url'); ?&gt;"</code> <code>/&gt;</code></span></p>
<p><span style="color: #339966"><code>&lt;/head&gt;</code></span></p>
<div><span style="font-family: monospace">&lt;body&gt;</span></div>
<div>
<p>&lt;div id=&#8221;wrapper&#8221;&gt;</p>
<p>&lt;div id=&#8221;header&#8221;&gt;</p>
<p>&lt;div id=&#8221;masthead&#8221;&gt;</p>
<p>&lt;div id=&#8221;branding&#8221;&gt;</p>
</div>
<p><span style="color: #333399">&lt;div id=&#8221;blog-title&#8221;&gt;&lt;span&gt;&lt;a href=&#8221;&lt;?php bloginfo( &#8216;url&#8217; ) ?&gt;/&#8221; title=&#8221;&lt;?php bloginfo( &#8216;name&#8217; ) ?&gt;&#8221; rel=&#8221;home&#8221;&gt;&lt;?php bloginfo( &#8216;name&#8217; ) ?&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;</span></p>
<p><span style="color: #333399">&lt;?php if ( is_home() || is_front_page() ) { ?&gt;</span></p>
<p><span style="color: #333399">&lt;h1 id=&#8221;blog-description&#8221;&gt;&lt;?php bloginfo( &#8216;description&#8217; ) ?&gt;&lt;/h1&gt;</span></p>
<p><span style="color: #333399">&lt;?php } else { ?&gt;</span></p>
<p><span style="color: #333399">&lt;div id=&#8221;blog-description&#8221;&gt;&lt;?php bloginfo( &#8216;description&#8217; ) ?&gt;&lt;/div&gt;</span></p>
<p><span style="color: #333399">&lt;?php } ?&gt;</span></p>
<p><span style="color: #333399">&lt;/div&gt;&lt;!&#8211; #branding &#8211;&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #99cc00">&lt;div id=&#8221;access&#8221;&gt;</span></p>
<p><span style="color: #99cc00">&lt;div&gt;&lt;a href=&#8221;#content&#8221; title=&#8221;&lt;?php _e( &#8216;Skip to content&#8217;, &#8216;your-theme&#8217; ) ?&gt;&#8221;&gt;&lt;?php _e( &#8216;Skip to content&#8217;, &#8216;your-theme&#8217; ) ?&gt;&lt;/a&gt;&lt;/div&gt;</span></p>
<p><span style="color: #99cc00">&lt;?php wp_page_menu( &#8216;sort_column=menu_order&#8217; ); ?&gt;</span></p>
<p>&lt;/div&gt; &lt;!&#8211; #access &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #masthead &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #header &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;main&#8221;&gt;</p>
<p>&nbsp;</p>
<p><strong>Description:</strong></p>
<p><strong>Code block in red</strong><strong> </strong><strong>and orange color</strong> at the top of header.php tells the document type which helps the browser to interpret the HTML seeing. While the orange lines of code add few attributes that makes the page apparent to the web browser.</p>
<p><strong>Code block in green color</strong>, you must be remembering simple &lt;head&gt;&lt;/head&gt; HTML tags. This is a quite similar but here it is looks like a complex block of code because the code in between &lt;title&gt; and &lt;/title&gt; is basically for the search engine result.</p>
<p>The code line starting from <strong>&lt;meta http </strong>gives concise information about your website and the code line starting from <strong>&lt;link rel “stylesheet”</strong> <strong> </strong>is used for linking the stylesheet. Other <strong>&lt;link rel </strong>code lines specify the feeds basically RSS and other pingbacks  <strong>&lt;?php wp_head(); ?&gt;</strong> is a catch for the plugins etc. Other code includes thread for the comments etc which you may easily understand by reading the code carefully and if you face any problem then send me an e-mail.</p>
<p><strong>The code in purple color,</strong><strong> </strong>is a code block of conditional wordpress tags for coding title and blog description, this will be helpful for the branding of your site as it will send your blog title in search engines.</p>
<p><strong>Code block in light green color,</strong><strong> </strong>here we have added a skip link so as to make a screen reader can easily get specific content, helpful for the persons using a screen reader. Other than this we have added our page menu. Just read the code carefully and you will understand everything.</p>
<p>&nbsp;</p>
<p><strong>Footer.php</strong></p>
<p>&lt;/div&gt;&lt;!&#8211; #main &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;footer&#8221;&gt;</p>
<p>&lt;div id=&#8221;colophon&#8221;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;site-info&#8221;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #site-info &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #colophon &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #footer &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #wrapper &#8211;&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
<p>&nbsp;</p>
<p><strong> </strong></p>
<p><strong>Index.php</strong></p>
<p>As you have made header.php and footer.php files earlier, so now you need to call them to index.php. Now we will be calling header.php file by adding the following line of code at the top of your index.php file:</p>
<p>&lt;?php get_header(); ?&gt;</p>
<p>Now at the very bottom of your index.php file, call footer.php file as it follows:</p>
<p>&lt;?php get_footer(); ?&gt;</p>
<p>Before footer.php you also have to call sidebar.ph by following command:</p>
<p>&lt;?php get_sidebar(); ?&gt;</p>
<p><span style="text-decoration: underline">Main Index.php will look like:</span></p>
<p>&lt;?php get_header(); ?&gt;</p>
<p>&lt;div id=&#8221;container&#8221;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;content&#8221;&gt;</p>
<p>&lt;?php <strong>/* </strong><strong>Top post navigation</strong><strong> */</strong> ?&gt;</p>
<p><span style="color: #ff0000">&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;div id=&#8221;nav-above&#8221;&gt;</span></p>
<p><span style="color: #ff0000">&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</span></p>
<p><span style="color: #ff0000">&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</span></p>
<p><span style="color: #ff0000">&lt;/div&gt;&lt;!&#8211; #nav-above &#8211;&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php } ?&gt;</span></p>
<p>&nbsp;</p>
<p>&lt;?php <strong>/* </strong><strong>The Loop — having comments</strong><strong> */</strong> ?&gt;</p>
<p><span style="color: #333399">&lt;?php while ( have_posts() ) : the_post() ?&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #333399">&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221;</span></p>
<p><span style="color: #333399">&lt;?php post_class(); ?&gt;&gt;</span></p>
<p><span style="color: #333399">&lt;?php /* an h2 title */ ?&gt;</span></p>
<p>&nbsp;</p>
<p>&lt;?php <strong>/*Following code between &lt;h2 class to &lt;/h2&gt;  is a template tag to get the title of the post and wrap in  tag that links to permalink which is a permalink to a specific post and we had added another title attribute which will help search engines to get permalink to a post*/</strong><strong> </strong>?&gt;<strong> </strong></p>
<p><span style="color: #333399">&lt;h2 class=&#8221;entry-title&#8221;&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221; title=&#8221;&lt;?php printf( __(&#8216;Permalink to %s&#8217;, &#8216;your-theme&#8217;), the_title_attribute(&#8216;echo=0&#8242;) ); ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="color: #333399">&lt;?php /* Microformatted, translatable post meta */ ?&gt;</span></p>
<p><span style="color: #333399">&lt;div class=&#8221;entry-meta&#8221;&gt;</span></p>
<p><span style="color: #333399">&lt;span class=&#8221;meta-prep meta-prep-author&#8221;&gt;&lt;?php _e(&#8216;By &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</span></p>
<p><span style="color: #333399">&lt;span class=&#8221;author vcard&#8221;&gt;&lt;a href=&#8221;&lt;?php echo get_author_link( false, $authordata-&gt;ID, $authordata-&gt;user_nicename ); ?&gt;&#8221; title=&#8221;&lt;?php printf( __( &#8216;View all posts by %s&#8217;, &#8216;your-theme&#8217; ), $authordata-&gt;display_name ); ?&gt;&#8221;&gt;&lt;?php the_author(); ?&gt;&lt;/a&gt;&lt;/span&gt;</span></p>
<p><span style="color: #333399">&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</span></p>
<p><span style="color: #333399">&lt;span class=&#8221;meta-prep meta-prep-entry-date&#8221;&gt;&lt;?php _e(&#8216;Published &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</span></p>
<p><span style="color: #333399">&lt;span class=&#8221;entry-date&#8221;&gt;&lt;abbr title=&#8221;&lt;?php the_time(&#8216;Y-m-dTH:i:sO&#8217;) ?&gt;&#8221;&gt;&lt;?php the_time( get_option( &#8216;date_format&#8217; ) ); ?&gt;&lt;/abbr&gt;&lt;/span&gt;</span></p>
<p><span style="color: #333399">&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;nttttt&#8221; ) ?&gt;</span></p>
<p><span style="color: #333399">&lt;/div&gt;&lt;!&#8211; .entry-meta &#8211;&gt;</span></p>
<p>&nbsp;</p>
<p>&lt;?php <strong>/* </strong><strong>The entry content, will make machines know that this is blog post content</strong><strong> */</strong> ?&gt;</p>
<p>&nbsp;</p>
<p><span style="color: #333399">&lt;div class=&#8221;entry-content&#8221;&gt;</span></p>
<p><span style="color: #333399">&lt;?php the_content( __( &#8216;Continue reading &lt;span class=&#8221;meta-nav&#8221;&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )  ); ?&gt;</span></p>
<p><span style="color: #333399">&lt;?php wp_link_pages(&#8216;before=&lt;div&gt;&#8217; . __( &#8216;Pages:&#8217;, &#8216;your-theme&#8217; ) . &#8216;&amp;after=&lt;/div&gt;&#8217;) ?&gt;</span></p>
<p><span style="color: #333399">&lt;/div&gt;&lt;!&#8211; .entry-content &#8211;&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #333399">&lt;?php /* Microformatted category and tag links along with a comments link */ ?&gt;</span></p>
<p><span style="color: #333399">&lt;div class=&#8221;entry-utility&#8221;&gt;</span></p>
<p><span style="color: #333399">&lt;span class=&#8221;cat-links&#8221;&gt;&lt;span&gt;&lt;?php _e( &#8216;Posted in &#8216;, &#8216;your-theme&#8217; ); ?&gt;&lt;/span&gt;&lt;?php echo get_the_category_list(&#8216;, &#8216;); ?&gt;&lt;/span&gt;</span></p>
<p><span style="color: #333399">&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</span></p>
<p><span style="color: #333399">&lt;?php the_tags( &#8216;&lt;span&gt;&lt;span class=&#8221;entry-utility-prep entry-utility-prep-tag-links&#8221;&gt;&#8217; . __(&#8216;Tagged &#8216;, &#8216;your-theme&#8217; ) . &#8216;&lt;/span&gt;&#8217;, &#8220;, &#8220;, &#8220;&lt;/span&gt;ntttttt&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;n&#8221; ) ?&gt;</span></p>
<p><span style="color: #333399">&lt;span class=&#8221;comments-link&#8221;&gt;&lt;?php comments_popup_link( __( &#8216;Leave a comment&#8217;, &#8216;your-theme&#8217; ), __( &#8217;1 Comment&#8217;, &#8216;your-theme&#8217; ), __( &#8216;% Comments&#8217;, &#8216;your-theme&#8217; ) ) ?&gt;&lt;/span&gt;</span></p>
<p><span style="color: #333399">&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;ntttttn&#8221; ) ?&gt;</span></p>
<p><span style="color: #333399">&lt;/div&gt;&lt;!&#8211; #entry-utility &#8211;&gt;</span></p>
<p><span style="color: #333399">&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #333399">&lt;?php /* Close up the post div and then end the loop with endwhile */ ?&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #333399">&lt;?php endwhile; ?&gt;</span></p>
<p>&nbsp;</p>
<p>&lt;?php <strong>/* </strong><strong>Bottom post navigation</strong><strong> */</strong> ?&gt;</p>
<p><span style="color: #ff0000">&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;div id=&#8221;nav-below&#8221;&gt;</span></p>
<p><span style="color: #ff0000">&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</span></p>
<p><span style="color: #ff0000">&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</span></p>
<p><span style="color: #ff0000">&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt;</span></p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #content &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #container &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;primary&#8221;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #primary .widget-area &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;secondary&#8221;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #secondary &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php get_sidebar(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php get_footer(); ?&gt;</p>
<p><strong>Code block in dark blue color</strong><strong> </strong>represents the content. Everything is explained by giving black color comments in between coding of index.php file.</p>
<p><strong>Two code blocks in red color</strong><strong> </strong>having comments ‘Top post navigation’ and ‘Bottom post navigation’ just before and after the dark blue color loop code represents the navigation which helps us to navigate away from the posts. Tag: next_posts_link()creates  link to previous posts while the tag: previous_posts_link()creates a link for next post so don’t get confused with their names as they are having opposite meaning.</p>
<p><strong> </strong></p>
<p><strong>Functions.php</strong></p>
<p>&lt;?php</p>
<p>//Function for Theme available for translation</p>
<p>// Translations can be done in /languages/ directory</p>
<p>load_theme_textdomain( &#8216;your-theme&#8217;, TEMPLATEPATH . &#8216;/languages&#8217; );</p>
<p>&nbsp;</p>
<p>$locale = get_locale();</p>
<p>$locale_file = TEMPLATEPATH . &#8220;/languages/$locale.php&#8221;;</p>
<p>if ( is_readable($locale_file) )</p>
<p>require_once($locale_file);</p>
<p>&nbsp;</p>
<p>//Function for getting page number</p>
<p>function get_page_number() {</p>
<p>if ( get_query_var(&#8216;paged&#8217;) ) {</p>
<p>print &#8216; | &#8216; . __( &#8216;Page &#8216; , &#8216;your-theme&#8217;) . get_query_var(&#8216;paged&#8217;);</p>
<p>}</p>
<p>} // end get_page_number</p>
<p>&nbsp;</p>
<p>Read the above given code carefully, the first function is for the getting page’s translation and the second function is for getting page numbers.</p>
<p>&nbsp;</p>
<p>Now create a template for single.php as shown below. Its temple is same as index.php. You have to call header.php, footer.php, sidebar.php same as we have done in index.php.</p>
<p><strong>Single.php</strong></p>
<p>&lt;?php get_header(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;container&#8221;&gt;</p>
<p>&lt;div id=&#8221;content&#8221;&gt;</p>
<p><strong>&lt;?php /*single post navigation*/ ?&gt;</strong></p>
<p><strong> </strong>&lt;div id=&#8221;nav-above&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php previous_post_link( &#8216;%link&#8217;, &#8216;&lt;span&gt;&amp;laquo;&lt;/span&gt; %title&#8217; ) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php next_post_link( &#8216;%link&#8217;, &#8216;%title &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217; ) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-above &#8211;&gt;</p>
<p><strong> </strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p><strong>&lt;?php /*single post titles for the eyes of screen readers, likewise we have done the same in header.php earlier*/ ?&gt;</strong></p>
<p><code> &lt;h1 class="entry-title"&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;</code></p>
<p>&nbsp;</p>
<p><strong>&lt;?php /*</strong><strong>function call followed by</strong><strong> </strong><code><strong>wp_link_pages()</strong></code><strong>.</strong><strong>*/?&gt;</strong></p>
<p>&nbsp;</p>
<p>&lt;?php the_content(); ?&gt;</p>
<p>&lt;?php wp_link_pages(&#8216;before=&lt;div&gt;&#8217; . __( &#8216;Pages:&#8217;, &#8216;your-theme&#8217; ) . &#8216;&amp;after=&lt;/div&gt;&#8217;) ?&gt;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>&lt;?php /*Links for single post entry*/?&gt;</strong></p>
<p><span style="color: #ff0000">&lt;div&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php printf( __( &#8216;This entry was posted in %1$s%2$s. Bookmark the &lt;a href=&#8221;%3$s&#8221; title=&#8221;Permalink to %4$s&#8221; rel=&#8221;bookmark&#8221;&gt;permalink&lt;/a&gt;. Follow any comments here with the &lt;a href=&#8221;%5$s&#8221; title=&#8221;Comments RSS to %4$s&#8221; rel=&#8221;alternate&#8221; type=&#8221;application/rss+xml&#8221;&gt;RSS feed for this post&lt;/a&gt;.&#8217;, &#8216;your-theme&#8217; ),</span></p>
<p><span style="color: #ff0000">get_the_category_list(&#8216;, &#8216;),</span></p>
<p><span style="color: #ff0000">get_the_tag_list( __( &#8216; and tagged &#8216;, &#8216;your-theme&#8217; ), &#8216;, &#8216;, &#8221; ),</span></p>
<p><span style="color: #ff0000">get_permalink(),</span></p>
<p><span style="color: #ff0000">the_title_attribute(&#8216;echo=0&#8242;),</span></p>
<p><span style="color: #ff0000">comments_rss() ) ?&gt;</span></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000">&lt;?php if ( (&#8216;open&#8217; == $post-&gt;comment_status) &amp;&amp; (&#8216;open&#8217; == $post-&gt;ping_status) ) : // Comments and trackbacks open ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php printf( __( &#8216;&lt;a href=&#8221;#respond&#8221; title=&#8221;Post a comment&#8221;&gt;Post a comment&lt;/a&gt; or leave a trackback: &lt;a href=&#8221;%s&#8221; title=&#8221;Trackback URL for your post&#8221; rel=&#8221;trackback&#8221;&gt;Trackback URL&lt;/a&gt;.&#8217;, &#8216;your-theme&#8217; ), get_trackback_url() ) ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php elseif ( !(&#8216;open&#8217; == $post-&gt;comment_status) &amp;&amp; (&#8216;open&#8217; == $post-&gt;ping_status) ) : // Only trackbacks open ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php printf( __( &#8216;Comments are closed, but you can leave a trackback: &lt;a class=&#8221;trackback-link&#8221; href=&#8221;%s&#8221; title=&#8221;Trackback URL for your post&#8221; rel=&#8221;trackback&#8221;&gt;Trackback URL&lt;/a&gt;.&#8217;, &#8216;your-theme&#8217; ), get_trackback_url() ) ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php elseif ( (&#8216;open&#8217; == $post-&gt;comment_status) &amp;&amp; !(&#8216;open&#8217; == $post-&gt;ping_status) ) : // Only comments open ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php _e( &#8216;Trackbacks are closed, but you can &lt;a href=&#8221;#respond&#8221; title=&#8221;Post a comment&#8221;&gt;post a comment&lt;/a&gt;.&#8217;, &#8216;your-theme&#8217; ) ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php elseif ( !(&#8216;open&#8217; == $post-&gt;comment_status) &amp;&amp; !(&#8216;open&#8217; == $post-&gt;ping_status) ) : // Comments and trackbacks closed ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php _e( &#8216;Both comments and trackbacks are currently closed.&#8217;, &#8216;your-theme&#8217; ) ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php endif; ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;nttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;&#8221; ) ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;/div&gt;&lt;!&#8211; .entry-utility &#8211;&gt;</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><span style="color: #ff0000">&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</span></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>&lt;?php /*single post navigation*/ ?&gt;</strong></p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;nav-below&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php previous_post_link( &#8216;%link&#8217;, &#8216;&lt;span&gt;&amp;laquo;&lt;/span&gt; %title&#8217; ) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php next_post_link( &#8216;%link&#8217;, &#8216;%title &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217; ) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php <strong>/*Likewise it is a single post template hence we will need to call           comments_template() we will be coding up comments.php further*/</strong> ?&gt;</p>
<p><code>&lt;?php comments_template('', true); ?&gt;</code></p>
<p><code> </code></p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #content &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #container &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php get_sidebar(); ?&gt;</p>
<p>&lt;?php get_footer(); ?&gt;</p>
<p><strong> </strong></p>
<p><strong>Code block in red color, </strong>under the comment heading ‘links for single post entry’ is a bit complicated code block because of the style of working of wordpress comments likewise for opening comments and trackbacks, for opening only comments and keeping trackbacks closed.</p>
<p><strong>Post Attachment (attachment.php)</strong></p>
<p>Easiest way to created attachment.php is to copy single.php, renaming it to attachment.php and doing the following changes:</p>
<p>First delete the top and bottom navigation, it is not needed anymore. Replace it with a page title that links back to parent post, as shown:</p>
<p><code>&lt;h1&gt;&lt;a href="&lt;?php echo get_permalink($post-&gt;post_parent) ?&gt;"</code> <code>title="&lt;?php printf( __( 'Return to %s', 'your-theme' ), wp_specialchars( get_the_title($post-&gt;post_parent), 1 ) ) ?&gt;"</code> <code>rev="attachment"&gt;&lt;span class="meta-nav"&gt;&amp;laquo; &lt;/span&gt;&lt;?php echo</code> <code>get_the_title($post-&gt;post_parent) ?&gt;&lt;/a&gt;&lt;/h1&gt;</code></p>
<p>Likewise page title is in h1 tag hence we will be wrapping our post title in h2 tag.</p>
<p>&lt;h2&gt;&lt;?php the_title(); ?&gt;&lt;/h2&gt;</p>
<p>&nbsp;</p>
<p>Attachment.php actually shows the attachments hence our content should reflect that.</p>
<p>&lt;div&gt;</p>
<p>&lt;div class=&#8221;entry-attachment&#8221;&gt;</p>
<p>&lt;?php if ( wp_attachment_is_image( $post-&gt;id ) ) : $att_image = wp_get_attachment_image_src( $post-&gt;id, &#8220;medium&#8221;); ?&gt;</p>
<p>&lt;p class=&#8221;attachment&#8221;&gt;&lt;a href=&#8221;&lt;?php echo wp_get_attachment_url($post-&gt;id); ?&gt;&#8221; title=&#8221;&lt;?php the_title(); ?&gt;&#8221; rel=&#8221;attachment&#8221;&gt;&lt;img src=&#8221;&lt;?php echo $att_image[0];?&gt;&#8221; width=&#8221;&lt;?php echo $att_image[1];?&gt;&#8221; height=&#8221;&lt;?php echo $att_image[2];?&gt;&#8221;  alt=&#8221;&lt;?php $post-&gt;post_excerpt; ?&gt;&#8221; /&gt;&lt;/a&gt;</p>
<p>&lt;/p&gt;</p>
<p>&lt;?php else : ?&gt;</p>
<p>&lt;a href=&#8221;&lt;?php echo wp_get_attachment_url($post-&gt;ID) ?&gt;&#8221; title=&#8221;&lt;?php echo wp_specialchars( get_the_title($post-&gt;ID), 1 ) ?&gt;&#8221; rel=&#8221;attachment&#8221;&gt;&lt;?php echo basename($post-&gt;guid) ?&gt;&lt;/a&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;div class=&#8221;entry-caption&#8221;&gt;&lt;?php if ( !empty($post-&gt;post_excerpt) ) the_excerpt() ?&gt;&lt;/div&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php the_content( __( &#8216;Continue reading &lt;span class=&#8221;meta-nav&#8221;&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )  ); ?&gt;</p>
<p>&lt;?php wp_link_pages(&#8216;before=&lt;div&gt;&#8217; . __( &#8216;Pages:&#8217;, &#8216;your-theme&#8217; ) . &#8216;&amp;after=&lt;/div&gt;&#8217;) ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-content &#8211;&gt;</p>
<p>&nbsp;</p>
<p><strong>404 template (404.php)</strong></p>
<p>It will work when someone types the wrong URL of your blog. It is an error server code.</p>
<p>&lt;?php get_header(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;container&#8221;&gt;</p>
<p>&lt;div id=&#8221;content&#8221;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-0&#8243;&gt;</p>
<p>&lt;h1 class=&#8221;entry-title&#8221;&gt;&lt;?php _e( &#8216;Not Found&#8217;, &#8216;your-theme&#8217; ); ?&gt;&lt;/h1&gt;</p>
<p>&lt;div class=&#8221;entry-content&#8221;&gt;</p>
<p>&lt;p&gt;&lt;?php _e( &#8216;Sorry, unable to find particular page.&#8217;, &#8216;your-theme&#8217; ); ?&gt;&lt;/p&gt;</p>
<p>&lt;?php get_search_form(); ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-content &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-0 &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #content &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #container &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php get_sidebar(); ?&gt;</p>
<p>&lt;?php get_footer(); ?&gt;</p>
<p>&nbsp;</p>
<p><strong>Comments Template (comments.php)</strong></p>
<p>Add the following two functions to your functions.php file for callback of your comments and trackbacks:</p>
<p>First function for your function.php file:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="665" valign="top">//Callback   to list comments in theme&nbsp;</p>
<p>function custom_comments($comment, $args, $depth) {</p>
<p>$GLOBALS['comment']   = $comment;</p>
<p>$GLOBALS['comment_depth']   = $depth;</p>
<p>?&gt;</p>
<p>&lt;li   id=&#8221;comment-&lt;?php comment_ID() ?&gt;&#8221; &lt;?php comment_class() ?&gt;&gt;</p>
<p>&lt;div  &gt;&lt;?php commenter_link()   ?&gt;&lt;/div&gt;</p>
<p>&lt;div  &gt;&lt;?php printf(__(&#8216;Posted %1$s at %2$s   &lt;span&gt;|&lt;/span&gt; &lt;a href=&#8221;%3$s&#8221;   title=&#8221;Permalink to this comment&#8221;&gt;Permalink&lt;/a&gt;&#8217;,   &#8216;your-theme&#8217;),</p>
<p>get_comment_date(),</p>
<p>get_comment_time(),</p>
<p>&#8216;#comment-&#8217; . get_comment_ID() );</p>
<p>edit_comment_link(__(&#8216;Edit&#8217;,   &#8216;your-theme&#8217;), &#8216; &lt;span&gt;|&lt;/span&gt;   &lt;span&gt;&#8217;, &#8216;&lt;/span&gt;&#8217;);   ?&gt;&lt;/div&gt;</p>
<p>&lt;?php   if ($comment-&gt;comment_approved == &#8217;0&#8242;)   _e(&#8220;ttttt&lt;span class=&#8217;unapproved&#8217;&gt;Your comment is awaiting   moderation.&lt;/span&gt;n&#8221;, &#8216;your-theme&#8217;) ?&gt;</p>
<p>&lt;div  &gt;</p>
<p>&lt;?php   comment_text() ?&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;?php   // echo the comment reply link</p>
<p>if($args['type']   == &#8216;all&#8217; ||   get_comment_type() == &#8216;comment&#8217;) :</p>
<p>comment_reply_link(array_merge($args,   array(</p>
<p>&#8216;reply_text&#8217; =&gt; __(&#8216;Reply&#8217;,'your-theme&#8217;),</p>
<p>&#8216;login_text&#8217; =&gt; __(&#8216;Log in to reply.&#8217;,'your-theme&#8217;),</p>
<p>&#8216;depth&#8217; =&gt; $depth,</p>
<p>&#8216;before&#8217; =&gt; &#8216;&lt;div  &gt;&#8217;,</p>
<p>&#8216;after&#8217; =&gt; &#8216;&lt;/div&gt;&#8217;</p>
<p>)));</p>
<p>endif;</p>
<p>?&gt;</p>
<p>&lt;?php } // end custom_comments</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Second function for your function.php file:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="665" valign="top">// Callback to list pings&nbsp;</p>
<p>function custom_pings($comment, $args, $depth) {</p>
<p>$GLOBALS['comment'] =   $comment;</p>
<p>?&gt;</p>
<p>&lt;li   id=&#8221;comment-&lt;?php comment_ID() ?&gt;&#8221; &lt;?php comment_class() ?&gt;&gt;</p>
<p>&lt;div  &gt;&lt;?php printf(__(&#8216;By %1$s on %2$s at   %3$s&#8217;, &#8216;your-theme&#8217;),</p>
<p>get_comment_author_link(),</p>
<p>get_comment_date(),</p>
<p>get_comment_time()   );</p>
<p>edit_comment_link(__(&#8216;Edit&#8217;,   &#8216;your-theme&#8217;), &#8216; &lt;span&gt;|&lt;/span&gt;   &lt;span&gt;&#8217;, &#8216;&lt;/span&gt;&#8217;);   ?&gt;&lt;/div&gt;</p>
<p>&lt;?php if ($comment-&gt;comment_approved   == &#8217;0&#8242;) _e(&#8216;ttttt&lt;span&gt;Your trackback   is awaiting moderation.&lt;/span&gt;n&#8217;, &#8216;your-theme&#8217;) ?&gt;</p>
<p>&lt;div  &gt;</p>
<p>&lt;?php   comment_text() ?&gt;</p>
<p>&lt;/div&gt;</p>
<p>&lt;?php } // end custom_pings</p>
<p>&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Also add the following function to your function.php file for showing gravatar in the comments:</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="665" valign="top">// For producing avatar image with the hCard-compliant photo class&nbsp;</p>
<p>function commenter_link() {</p>
<p>$commenter =   get_comment_author_link();</p>
<p>if ( ereg( &#8216;&lt;a[^&gt;]*   class=[^&gt;]+&gt;&#8217;, $commenter ) ) {</p>
<p>$commenter = ereg_replace( &#8216;(&lt;a[^&gt;]* class=['"]?)&#8217;, &#8217;1url &#8216; , $commenter );</p>
<p>} else {</p>
<p>$commenter = ereg_replace( &#8216;(&lt;a )/&#8217;, &#8217;1class=&#8221;url &#8220;&#8216; , $commenter );</p>
<p>}</p>
<p>$avatar_email = get_comment_author_email();</p>
<p>$avatar = str_replace(   &#8220;class=&#8217;avatar&#8221;, &#8220;class=&#8217;photo avatar&#8221;, get_avatar(   $avatar_email, 80 ) );</p>
<p>echo $avatar . &#8216; &lt;span&gt;&#8217; . $commenter . &#8216;&lt;/span&gt;&#8217;;</p>
<p>} // end commenter_link</p>
<p>&nbsp;</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Now we have added all the important functions to functions.php file. Hence this is the time to create comments template i.e. comments.php file:</p>
<p><strong>comments.php</strong></p>
<p>&lt;?php /* The Comments Template — with, er, comments! */ ?&gt;</p>
<p>&lt;div id=&#8221;comments&#8221;&gt;</p>
<p>&lt;?php /* Run some checks for bots and password protected posts */ ?&gt;</p>
<p>&lt;?php</p>
<p>$req = get_option(&#8216;require_name_email&#8217;); // Checks if fields are required.</p>
<p>if ( &#8216;comments.php&#8217; == basename($_SERVER['SCRIPT_FILENAME']) )</p>
<p>die ( &#8216;Please do not load this page directly. Thanks!&#8217; );</p>
<p>if ( ! empty($post-&gt;post_password) ) :</p>
<p>if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post-&gt;post_password ) :</p>
<p>?&gt;</p>
<p>&lt;div class=&#8221;nopassword&#8221;&gt;&lt;?php _e(&#8216;This post is password protected. Enter the password to view any comments.&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .comments &#8211;&gt;</p>
<p>&lt;?php</p>
<p>return;</p>
<p>endif;</p>
<p>endif;</p>
<p>?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* See IF there are comments and do the comments stuff! */ ?&gt;</p>
<p>&lt;?php if ( have_comments() ) : ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* Count the number of comments and trackbacks (or pings) */</p>
<p>$ping_count = $comment_count = 0;</p>
<p>foreach ( $comments as $comment )</p>
<p>get_comment_type() == &#8220;comment&#8221; ? ++$comment_count : ++$ping_count;</p>
<p>?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* IF there are comments, show the comments */ ?&gt;</p>
<p>&lt;?php if ( ! empty($comments_by_type['comment']) ) : ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;comments-list&#8221;&gt;</p>
<p>&lt;h3&gt;&lt;?php printf($comment_count &gt; 1 ? __(&#8216;&lt;span&gt;%d&lt;/span&gt; Comments&#8217;, &#8216;your-theme&#8217;) : __(&#8216;&lt;span&gt;One&lt;/span&gt; Comment&#8217;, &#8216;your-theme&#8217;), $comment_count) ?&gt;&lt;/h3&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* If there are enough comments, build the comment navigation  */ ?&gt;</p>
<p>&lt;?php $total_pages = get_comment_pages_count(); if ( $total_pages &gt; 1 ) : ?&gt;</p>
<p>&lt;div id=&#8221;comments-nav-above&#8221;&gt;</p>
<p>&lt;div class=&#8221;paginated-comments-links&#8221;&gt;&lt;?php paginate_comments_links(); ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #comments-nav-above &#8211;&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* An ordered list of our custom comments callback, custom_comments(), in functions.php   */ ?&gt;</p>
<p>&lt;ol&gt;</p>
<p>&lt;?php wp_list_comments(&#8216;type=comment&amp;callback=custom_comments&#8217;); ?&gt;</p>
<p>&lt;/ol&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* If there are enough comments, build the comment navigation */ ?&gt;</p>
<p>&lt;?php $total_pages = get_comment_pages_count(); if ( $total_pages &gt; 1 ) : ?&gt;</p>
<p>&lt;div id=&#8221;comments-nav-below&#8221;&gt;</p>
<p>&lt;div class=&#8221;paginated-comments-links&#8221;&gt;&lt;?php paginate_comments_links(); ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #comments-nav-below &#8211;&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #comments-list .comments &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endif; /* if ( $comment_count ) */ ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* If there are trackbacks(pings), show the trackbacks  */ ?&gt;</p>
<p>&lt;?php if ( ! empty($comments_by_type['pings']) ) : ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;trackbacks-list&#8221;&gt;</p>
<p>&lt;h3&gt;&lt;?php printf($ping_count &gt; 1 ? __(&#8216;&lt;span&gt;%d&lt;/span&gt; Trackbacks&#8217;, &#8216;your-theme&#8217;) : __(&#8216;&lt;span&gt;One&lt;/span&gt; Trackback&#8217;, &#8216;your-theme&#8217;), $ping_count) ?&gt;&lt;/h3&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* An ordered list of our custom trackbacks callback, custom_pings(), in functions.php   */ ?&gt;</p>
<p>&lt;ol&gt;</p>
<p>&lt;?php wp_list_comments(&#8216;type=pings&amp;callback=custom_pings&#8217;); ?&gt;</p>
<p>&lt;/ol&gt;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #trackbacks-list .comments &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endif /* if ( $ping_count ) */ ?&gt;</p>
<p>&lt;?php endif /* if ( $comments ) */ ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* If comments are open, build the respond form */ ?&gt;</p>
<p>&lt;?php if ( &#8216;open&#8217; == $post-&gt;comment_status ) : ?&gt;</p>
<p>&lt;div id=&#8221;respond&#8221;&gt;</p>
<p>&lt;h3&gt;&lt;?php comment_form_title( __(&#8216;Post a Comment&#8217;, &#8216;your-theme&#8217;), __(&#8216;Post a Reply to %s&#8217;, &#8216;your-theme&#8217;) ); ?&gt;&lt;/h3&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;cancel-comment-reply&#8221;&gt;&lt;?php cancel_comment_reply_link() ?&gt;&lt;/div&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( get_option(&#8216;comment_registration&#8217;) &amp;&amp; !$user_ID ) : ?&gt;</p>
<p>&lt;p id=&#8221;login-req&#8221;&gt;&lt;?php printf(__(&#8216;You must be &lt;a href=&#8221;%s&#8221; title=&#8221;Log in&#8221;&gt;logged in&lt;/a&gt; to post a comment.&#8217;, &#8216;your-theme&#8217;),</p>
<p>get_option(&#8216;siteurl&#8217;) . &#8216;/wp-login.php?redirect_to=&#8217; . get_permalink() ) ?&gt;&lt;/p&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php else : ?&gt;</p>
<p>&lt;div class=&#8221;formcontainer&#8221;&gt;</p>
<p>&nbsp;</p>
<p>&lt;form id=&#8221;commentform&#8221; action=&#8221;&lt;?php echo get_option(&#8216;siteurl&#8217;); ?&gt;/wp-comments-post.php&#8221; method=&#8221;post&#8221;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( $user_ID ) : ?&gt;</p>
<p>&lt;p id=&#8221;login&#8221;&gt;&lt;?php printf(__(&#8216;&lt;span&gt;Logged in as &lt;a href=&#8221;%1$s&#8221; title=&#8221;Logged in as %2$s&#8221;&gt;%2$s&lt;/a&gt;.&lt;/span&gt; &lt;span class=&#8221;logout&#8221;&gt;&lt;a href=&#8221;%3$s&#8221; title=&#8221;Log out of this account&#8221;&gt;Log out?&lt;/a&gt;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217;),</p>
<p>get_option(&#8216;siteurl&#8217;) . &#8216;/wp-admin/profile.php&#8217;,</p>
<p>wp_specialchars($user_identity, true),</p>
<p>wp_logout_url(get_permalink()) ) ?&gt;&lt;/p&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php else : ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;p id=&#8221;comment-notes&#8221;&gt;&lt;?php _e(&#8216;Your email is &lt;em&gt;never&lt;/em&gt; published nor shared.&#8217;, &#8216;your-theme&#8217;) ?&gt; &lt;?php if ($req) _e(&#8216;Required fields are marked &lt;span class=&#8221;required&#8221;&gt;*&lt;/span&gt;&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/p&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;form-section-author&#8221;&gt;</p>
<p>&lt;div class=&#8221;form-label&#8221;&gt;&lt;label for=&#8221;author&#8221;&gt;&lt;?php _e(&#8216;Name&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/label&gt; &lt;?php if ($req) _e(&#8216;&lt;span class=&#8221;required&#8221;&gt;*&lt;/span&gt;&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;form-input&#8221;&gt;&lt;input id=&#8221;author&#8221; name=&#8221;author&#8221; type=&#8221;text&#8221; value=&#8221;&lt;?php echo $comment_author ?&gt;&#8221; size=&#8221;30&#8243; maxlength=&#8221;20&#8243; tabindex=&#8221;3&#8243; /&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #form-section-author .form-section &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;form-section-email&#8221;&gt;</p>
<p>&lt;div class=&#8221;form-label&#8221;&gt;&lt;label for=&#8221;email&#8221;&gt;&lt;?php _e(&#8216;Email&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/label&gt; &lt;?php if ($req) _e(&#8216;&lt;span class=&#8221;required&#8221;&gt;*&lt;/span&gt;&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;form-input&#8221;&gt;&lt;input id=&#8221;email&#8221; name=&#8221;email&#8221; type=&#8221;text&#8221; value=&#8221;&lt;?php echo $comment_author_email ?&gt;&#8221; size=&#8221;30&#8243; maxlength=&#8221;50&#8243; tabindex=&#8221;4&#8243; /&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #form-section-email .form-section &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;form-section-url&#8221;&gt;</p>
<p>&lt;div class=&#8221;form-label&#8221;&gt;&lt;label for=&#8221;url&#8221;&gt;&lt;?php _e(&#8216;Website&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/label&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;form-input&#8221;&gt;&lt;input id=&#8221;url&#8221; name=&#8221;url&#8221; type=&#8221;text&#8221; value=&#8221;&lt;?php echo $comment_author_url ?&gt;&#8221; size=&#8221;30&#8243; maxlength=&#8221;50&#8243; tabindex=&#8221;5&#8243; /&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #form-section-url .form-section &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endif /* if ( $user_ID ) */ ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;form-section-comment&#8221;&gt;</p>
<p>&lt;div class=&#8221;form-label&#8221;&gt;&lt;label for=&#8221;comment&#8221;&gt;&lt;?php _e(&#8216;Comment&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/label&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;form-textarea&#8221;&gt;&lt;textarea id=&#8221;comment&#8221; name=&#8221;comment&#8221; cols=&#8221;45&#8243; rows=&#8221;8&#8243; tabindex=&#8221;6&#8243;&gt;&lt;/textarea&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #form-section-comment .form-section &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;form-allowed-tags&#8221;&gt;</p>
<p>&lt;p&gt;&lt;span&gt;&lt;?php _e(&#8216;You may use these &lt;abbr title=&#8221;HyperText Markup Language&#8221;&gt;HTML&lt;/abbr&gt; tags and attributes:&#8217;, &#8216;your-theme&#8217;) ?&gt;&lt;/span&gt; &lt;code&gt;&lt;?php echo allowed_tags(); ?&gt;&lt;/code&gt;&lt;/p&gt;</p>
<p>&lt;/div&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php do_action(&#8216;comment_form&#8217;, $post-&gt;ID); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;form-submit&#8221;&gt;&lt;input id=&#8221;submit&#8221; name=&#8221;submit&#8221; type=&#8221;submit&#8221; value=&#8221;&lt;?php _e(&#8216;Post Comment&#8217;, &#8216;your-theme&#8217;) ?&gt;&#8221; tabindex=&#8221;7&#8243; /&gt;&lt;input type=&#8221;hidden&#8221; name=&#8221;comment_post_ID&#8221; value=&#8221;&lt;?php echo $id; ?&gt;&#8221; /&gt;&lt;/div&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php comment_id_fields(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php /* Just … end everything. We&#8217;re done here. Close it up. */ ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;/form&gt;&lt;!&#8211; #commentform &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .formcontainer &#8211;&gt;</p>
<p>&lt;?php endif /* if ( get_option(&#8216;comment_registration&#8217;) &amp;&amp; !$user_ID ) */ ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #respond &#8211;&gt;</p>
<p>&lt;?php endif /* if ( &#8216;open&#8217; == $post-&gt;comment_status ) */ ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #comments &#8211;&gt;</p>
<p>&nbsp;</p>
<p><strong>N</strong>ow it’s all done, your comments.php template is ready. Read the code and description of three functions given at the top and the code of comments.php carefully.</p>
<p><strong>Search Template (search.php)</strong></p>
<p>This is the search result template used when a search is performed.</p>
<p>The code is almost same to the single.php template, we will be writing some code under the bold remark given in the file here:</p>
<p>&lt;?php get_header(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;container&#8221;&gt;</p>
<p>&lt;div id=&#8221;content&#8221;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( have_posts() ) : ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php while ( have_posts() ) : the_post() ?&gt;</p>
<p>&lt;!&#8211; this is our loop &#8211;&gt;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php else : ?&gt;</p>
<p>&nbsp;</p>
<p><strong>&lt;!&#8211; here&#8217;s we&#8217;ll put a search form if</strong><strong> </strong><strong>there&#8217;re no posts &#8211;&gt;</strong><strong> </strong></p>
<p>&nbsp;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #content &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #container &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php get_sidebar(); ?&gt;</p>
<p>&lt;?php get_footer(); ?&gt;</p>
<p>Code if you like to check that if you are dealing with post or page:</p>
<p>&lt;?php if ( $post-&gt;post_type == &#8216;post&#8217; ) { ?&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>The #content div of search template will be:</p>
<p>&lt;?php if ( have_posts() ) : ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php _e( &#8216;Search Results for: &#8216;, &#8216;your-theme&#8217; ); ?&gt;&lt;span&gt;&lt;?php the_search_query(); ?&gt;&lt;/span&gt;&lt;/h1&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-above&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-above &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php while ( have_posts() ) : the_post() ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p>&lt;h2 class=&#8221;entry-title&#8221;&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221; title=&#8221;&lt;?php printf( __(&#8216;Permalink to %s&#8217;, &#8216;your-theme&#8217;), the_title_attribute(&#8216;echo=0&#8242;) ); ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( $post-&gt;post_type == &#8216;post&#8217; ) { ?&gt;</p>
<p>&lt;div class=&#8221;entry-meta&#8221;&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-author&#8221;&gt;&lt;?php _e(&#8216;By &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;author vcard&#8221;&gt;&lt;a href=&#8221;&lt;?php echo get_author_link( false, $authordata-&gt;ID, $authordata-&gt;user_nicename ); ?&gt;&#8221; title=&#8221;&lt;?php printf( __( &#8216;View all posts by %s&#8217;, &#8216;your-theme&#8217; ), $authordata-&gt;display_name ); ?&gt;&#8221;&gt;&lt;?php the_author(); ?&gt;&lt;/a&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-entry-date&#8221;&gt;&lt;?php _e(&#8216;Published &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;entry-date&#8221;&gt;&lt;abbr title=&#8221;&lt;?php the_time(&#8216;Y-m-dTH:i:sO&#8217;) ?&gt;&#8221;&gt;&lt;?php the_time( get_option( &#8216;date_format&#8217; ) ); ?&gt;&lt;/abbr&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;nttttt&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-meta &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-summary&#8221;&gt;</p>
<p>&lt;?php the_excerpt( __( &#8216;Continue reading &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )  ); ?&gt;</p>
<p>&lt;?php wp_link_pages(&#8216;before=&lt;div&gt;&#8217; . __( &#8216;Pages:&#8217;, &#8216;your-theme&#8217; ) . &#8216;&amp;after=&lt;/div&gt;&#8217;) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-summary &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( $post-&gt;post_type == &#8216;post&#8217; ) { ?&gt;</p>
<p>&lt;div class=&#8221;entry-utility&#8221;&gt;</p>
<p>&lt;span class=&#8221;cat-links&#8221;&gt;&lt;span&gt;&lt;?php _e( &#8216;Posted in &#8216;, &#8216;your-theme&#8217; ); ?&gt;&lt;/span&gt;&lt;?php echo get_the_category_list(&#8216;, &#8216;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;?php the_tags( &#8216;&lt;span&gt;&lt;span class=&#8221;entry-utility-prep entry-utility-prep-tag-links&#8221;&gt;&#8217; . __(&#8216;Tagged &#8216;, &#8216;your-theme&#8217; ) . &#8216;&lt;/span&gt;&#8217;, &#8220;, &#8220;, &#8220;&lt;/span&gt;ntttttt&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;n&#8221; ) ?&gt;</p>
<p>&lt;span class=&#8221;comments-link&#8221;&gt;&lt;?php comments_popup_link( __( &#8216;Leave a comment&#8217;, &#8216;your-theme&#8217; ), __( &#8217;1 Comment&#8217;, &#8216;your-theme&#8217; ), __( &#8216;% Comments&#8217;, &#8216;your-theme&#8217; ) ) ?&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;ntttttn&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #entry-utility &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-below&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php else : ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-0&#8243;&gt;</p>
<p>&lt;h2 class=&#8221;entry-title&#8221;&gt;&lt;?php _e( &#8216;Nothing Found&#8217;, &#8216;your-theme&#8217; ) ?&gt;&lt;/h2&gt;</p>
<p>&lt;div class=&#8221;entry-content&#8221;&gt;</p>
<p>&lt;p&gt;&lt;?php _e( &#8216;Sorry, but nothing matched your search criteria. Please try again with some different keywords.&#8217;, &#8216;your-theme&#8217; ); ?&gt;&lt;/p&gt;</p>
<p>&lt;?php get_search_form(); ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-content &#8211;&gt;</p>
<p>&lt;/div&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p><strong>Page Template (page.php)</strong></p>
<p>Same block of code as we have seen earlier but we are adding a little difference as this template is of a particular page, likewise if we usually create different pages in our blog.</p>
<p>Page template is used when an individual page is queried.</p>
<p>Here is the code page.php:</p>
<p>&lt;?php get_header(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;container&#8221;&gt;</p>
<p>&lt;div id=&#8221;content&#8221;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p>&lt;h1 class=&#8221;entry-title&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/h1&gt;</p>
<p>&lt;div class=&#8221;entry-content&#8221;&gt;</p>
<p>&lt;?php the_content(); ?&gt;</p>
<p>&lt;?php wp_link_pages(&#8216;before=&lt;div class=&#8221;page-link&#8221;&gt;&#8217; . __( &#8216;Pages:&#8217;, &#8216;your-theme&#8217; ) . &#8216;&amp;after=&lt;/div&gt;&#8217;) ?&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8216;&lt;span&gt;&#8217;, &#8216;&lt;/span&gt;&#8217; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-content &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( get_post_custom_values(&#8216;comments&#8217;) ) comments_template() // Add a custom field with Name and Value of &#8220;comments&#8221; to enable comments on this page ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;/div&gt;&lt;!&#8211; #content &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #container &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php get_sidebar(); ?&gt;</p>
<p>&lt;?php get_footer(); ?&gt;</p>
<p>&nbsp;</p>
<p><strong>Archive Template (archive.php)</strong></p>
<p>An important template. It shows posts on a certain criteria (you must have seen blog posts on the sidebar listed according to dates.</p>
<p>Here is your archive.php template containing loops same kind of loops which we have discussed earlier. The templates calls the posts rewind them etc.</p>
<p>&lt;?php the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( is_day() ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php printf( __( &#8216;Daily Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(get_option(&#8216;date_format&#8217;)) ) ?&gt;&lt;/h1&gt;</p>
<p>&lt;?php elseif ( is_month() ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php printf( __( &#8216;Monthly Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(&#8216;F Y&#8217;) ) ?&gt;&lt;/h1&gt;</p>
<p>&lt;?php elseif ( is_year() ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php printf( __( &#8216;Yearly Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(&#8216;Y&#8217;) ) ?&gt;&lt;/h1&gt;</p>
<p>&lt;?php elseif ( isset($_GET['paged']) &amp;&amp; !empty($_GET['paged']) ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php _e( &#8216;Blog Archives&#8217;, &#8216;your-theme&#8217; ) ?&gt;&lt;/h1&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php rewind_posts(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-above&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-above &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php while ( have_posts() ) : the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p>&lt;h2 class=&#8221;entry-title&#8221;&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221; title=&#8221;&lt;?php printf( __(&#8216;Permalink to %s&#8217;, &#8216;your-theme&#8217;), the_title_attribute(&#8216;echo=0&#8242;) ); ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-meta&#8221;&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-author&#8221;&gt;&lt;?php _e(&#8216;By &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;author vcard&#8221;&gt;&lt;a href=&#8221;&lt;?php echo get_author_link( false, $authordata-&gt;ID, $authordata-&gt;user_nicename ); ?&gt;&#8221; title=&#8221;&lt;?php printf( __( &#8216;View all posts by %s&#8217;, &#8216;your-theme&#8217; ), $authordata-&gt;display_name ); ?&gt;&#8221;&gt;&lt;?php the_author(); ?&gt;&lt;/a&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-entry-date&#8221;&gt;&lt;?php _e(&#8216;Published &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;entry-date&#8221;&gt;&lt;abbr title=&#8221;&lt;?php the_time(&#8216;Y-m-dTH:i:sO&#8217;) ?&gt;&#8221;&gt;&lt;?php the_time( get_option( &#8216;date_format&#8217; ) ); ?&gt;&lt;/abbr&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;nttttt&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-meta &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-summary&#8221;&gt;</p>
<p>&lt;?php the_excerpt( __( &#8216;Continue reading &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )  ); ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-summary &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-utility&#8221;&gt;</p>
<p>&lt;span class=&#8221;cat-links&#8221;&gt;&lt;span&gt;&lt;?php _e( &#8216;Posted in &#8216;, &#8216;your-theme&#8217; ); ?&gt;&lt;/span&gt;&lt;?php echo get_the_category_list(&#8216;, &#8216;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;?php the_tags( &#8216;&lt;span&gt;&lt;span class=&#8221;entry-utility-prep entry-utility-prep-tag-links&#8221;&gt;&#8217; . __(&#8216;Tagged &#8216;, &#8216;your-theme&#8217; ) . &#8216;&lt;/span&gt;&#8217;, &#8220;, &#8220;, &#8220;&lt;/span&gt;ntttttt&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;n&#8221; ) ?&gt;</p>
<p>&lt;span class=&#8221;comments-link&#8221;&gt;&lt;?php comments_popup_link( __( &#8216;Leave a comment&#8217;, &#8216;your-theme&#8217; ), __( &#8217;1 Comment&#8217;, &#8216;your-theme&#8217; ), __( &#8216;% Comments&#8217;, &#8216;your-theme&#8217; ) ) ?&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;ntttttn&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #entry-utility &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-below&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p><strong>Author Template (author.php)</strong></p>
<p>This is a quite easy to create. Following is the same author.php template but the red color code block is to be replaced by the code given after the following template which is basically the title section:</p>
<p>&lt;?php the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( is_day() ) : ?&gt;</p>
<p><span style="color: #ff0000">&lt;h1&gt;&lt;?php printf( __( &#8216;Daily Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(get_option(&#8216;date_format&#8217;)) ) ?&gt;&lt;/h1&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php elseif ( is_month() ) : ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php printf( __( &#8216;Monthly Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(&#8216;F Y&#8217;) ) ?&gt;&lt;/h1&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php elseif ( is_year() ) : ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php printf( __( &#8216;Yearly Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(&#8216;Y&#8217;) ) ?&gt;&lt;/h1&gt;</span></p>
<p><span style="color: #ff0000">&lt;?php elseif ( isset($_GET['paged']) &amp;&amp; !empty($_GET['paged']) ) : ?&gt;</span></p>
<p><span style="color: #ff0000">&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php _e( &#8216;Blog Archives&#8217;, &#8216;your-theme&#8217; ) ?&gt;&lt;/h1&gt;</span></p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php rewind_posts(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-above&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-above &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php while ( have_posts() ) : the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p>&lt;h2 class=&#8221;entry-title&#8221;&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221; title=&#8221;&lt;?php printf( __(&#8216;Permalink to %s&#8217;, &#8216;your-theme&#8217;), the_title_attribute(&#8216;echo=0&#8242;) ); ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-meta&#8221;&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-author&#8221;&gt;&lt;?php _e(&#8216;By &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;author vcard&#8221;&gt;&lt;a href=&#8221;&lt;?php echo get_author_link( false, $authordata-&gt;ID, $authordata-&gt;user_nicename ); ?&gt;&#8221; title=&#8221;&lt;?php printf( __( &#8216;View all posts by %s&#8217;, &#8216;your-theme&#8217; ), $authordata-&gt;display_name ); ?&gt;&#8221;&gt;&lt;?php the_author(); ?&gt;&lt;/a&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-entry-date&#8221;&gt;&lt;?php _e(&#8216;Published &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;entry-date&#8221;&gt;&lt;abbr title=&#8221;&lt;?php the_time(&#8216;Y-m-dTH:i:sO&#8217;) ?&gt;&#8221;&gt;&lt;?php the_time( get_option( &#8216;date_format&#8217; ) ); ?&gt;&lt;/abbr&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;nttttt&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-meta &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-summary&#8221;&gt;</p>
<p>&lt;?php the_excerpt( __( &#8216;Continue reading &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )  ); ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-summary &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-utility&#8221;&gt;</p>
<p>&lt;span class=&#8221;cat-links&#8221;&gt;&lt;span&gt;&lt;?php _e( &#8216;Posted in &#8216;, &#8216;your-theme&#8217; ); ?&gt;&lt;/span&gt;&lt;?php echo get_the_category_list(&#8216;, &#8216;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;?php the_tags( &#8216;&lt;span&gt;&lt;span class=&#8221;entry-utility-prep entry-utility-prep-tag-links&#8221;&gt;&#8217; . __(&#8216;Tagged &#8216;, &#8216;your-theme&#8217; ) . &#8216;&lt;/span&gt;&#8217;, &#8220;, &#8220;, &#8220;&lt;/span&gt;ntttttt&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;n&#8221; ) ?&gt;</p>
<p>&lt;span class=&#8221;comments-link&#8221;&gt;&lt;?php comments_popup_link( __( &#8216;Leave a comment&#8217;, &#8216;your-theme&#8217; ), __( &#8217;1 Comment&#8217;, &#8216;your-theme&#8217; ), __( &#8216;% Comments&#8217;, &#8216;your-theme&#8217; ) ) ?&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;ntttttn&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #entry-utility &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-below&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>Put the following code in the above given archive.php template’s red title section and save the template as author.php:</p>
<p>&lt;h1 class=&#8221;page-title author&#8221;&gt;&lt;?php printf( __( &#8216;Author Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;a class=&#8217;url fn n&#8217; href=&#8217;$authordata-&gt;user_url&#8217; title=&#8217;$authordata-&gt;display_name&#8217; rel=&#8217;me&#8217;&gt;$authordata-&gt;display_name&lt;/a&gt;&#8221; ) ?&gt;&lt;/h1&gt;</p>
<p>&lt;?php $authordesc = $authordata-&gt;user_description; if ( !empty($authordesc) ) echo apply_filters( &#8216;archive_meta&#8217;, &#8216;&lt;div&gt;&#8217; . $authordesc . &#8216;&lt;/div&gt;&#8217; ); ?&gt;</p>
<p>&nbsp;</p>
<p>Category Template (category.php)</p>
<p>Make a copy of archive.php template and save it as category.php. Then put the following given function in function.php:</p>
<p>// For category lists: Returns other categories except the current category</p>
<p>function cats_meow($glue) {</p>
<p>$current_cat = single_cat_title( &#8221;, false );</p>
<p>$separator = &#8220;n&#8221;;</p>
<p>$cats = explode( $separator, get_the_category_list($separator) );</p>
<p>foreach ( $cats as $i =&gt; $str ) {</p>
<p>if ( strstr( $str, &#8220;&gt;$current_cat&lt;&#8221; ) ) {</p>
<p>unset($cats[$i]);</p>
<p>break;</p>
<p>}</p>
<p>}</p>
<p>if ( empty($cats) )</p>
<p>return false;</p>
<p>&nbsp;</p>
<p>return trim(join( $glue, $cats ));</p>
<p>} // end cats_meow</p>
<p>&nbsp;</p>
<p>Now in the category.php which you have copied from archive.php, replace the title section that old one of red color with the following given code:</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php _e( &#8216;Category Archives:&#8217;, &#8216;your-theme&#8217; ) ?&gt; &lt;span&gt;&lt;?php single_cat_title() ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;</p>
<p>&lt;?php $categorydesc = category_description(); if ( !empty($categorydesc) ) echo apply_filters( &#8216;archive_meta&#8217;, &#8216;&lt;div&gt;&#8217; . $categorydesc . &#8216;&lt;/div&gt;&#8217; ); ?&gt;</p>
<p>&nbsp;</p>
<p>Your category.php would be looking like this:</p>
<p>&lt;?php the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( is_day() ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php _e( &#8216;Category Archives:&#8217;, &#8216;your-theme&#8217; ) ?&gt; &lt;span&gt;&lt;?php single_cat_title() ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;</p>
<p>&lt;?php $categorydesc = category_description(); if ( !empty($categorydesc) ) echo apply_filters( &#8216;archive_meta&#8217;, &#8216;&lt;div&gt;&#8217; . $categorydesc . &#8216;&lt;/div&gt;&#8217; ); ?&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php rewind_posts(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-above&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-above &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php while ( have_posts() ) : the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p>&lt;h2 class=&#8221;entry-title&#8221;&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221; title=&#8221;&lt;?php printf( __(&#8216;Permalink to %s&#8217;, &#8216;your-theme&#8217;), the_title_attribute(&#8216;echo=0&#8242;) ); ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-meta&#8221;&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-author&#8221;&gt;&lt;?php _e(&#8216;By &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;author vcard&#8221;&gt;&lt;a href=&#8221;&lt;?php echo get_author_link( false, $authordata-&gt;ID, $authordata-&gt;user_nicename ); ?&gt;&#8221; title=&#8221;&lt;?php printf( __( &#8216;View all posts by %s&#8217;, &#8216;your-theme&#8217; ), $authordata-&gt;display_name ); ?&gt;&#8221;&gt;&lt;?php the_author(); ?&gt;&lt;/a&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-entry-date&#8221;&gt;&lt;?php _e(&#8216;Published &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;entry-date&#8221;&gt;&lt;abbr title=&#8221;&lt;?php the_time(&#8216;Y-m-dTH:i:sO&#8217;) ?&gt;&#8221;&gt;&lt;?php the_time( get_option( &#8216;date_format&#8217; ) ); ?&gt;&lt;/abbr&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;nttttt&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-meta &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-summary&#8221;&gt;</p>
<p>&lt;?php the_excerpt( __( &#8216;Continue reading &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )  ); ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-summary &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-utility&#8221;&gt;</p>
<p>&lt;span&gt;&lt;span class=&#8221;entry-utility-prep entry-utility-prep-cat-links&#8221;&gt;&lt;?php _e( &#8216;Posted in &#8216;, &#8216;your-theme&#8217; ); ?&gt;&lt;/span&gt;&lt;?php echo get_the_category_list(&#8216;, &#8216;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;?php the_tags( &#8216;&lt;span&gt;&lt;span class=&#8221;entry-utility-prep entry-utility-prep-tag-links&#8221;&gt;&#8217; . __(&#8216;Tagged &#8216;, &#8216;your-theme&#8217; ) . &#8216;&lt;/span&gt;&#8217;, &#8220;, &#8220;, &#8220;&lt;/span&gt;ntttttt&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;n&#8221; ) ?&gt;</p>
<p>&lt;span class=&#8221;comments-link&#8221;&gt;&lt;?php comments_popup_link( __( &#8216;Leave a comment&#8217;, &#8216;your-theme&#8217; ), __( &#8217;1 Comment&#8217;, &#8216;your-theme&#8217; ), __( &#8216;% Comments&#8217;, &#8216;your-theme&#8217; ) ) ?&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;ntttttn&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #entry-utility &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-below&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>Now replace the blue color code block in #entry-utility with the following code:</p>
<p>&lt;?php if ( $cats_meow = cats_meow(&#8216;, &#8216;) ) : // Returns categories other than the one queried ?&gt;</p>
<p>&lt;span class=&#8221;cat-links&#8221;&gt;&lt;?php printf( __( &#8216;Also posted in %s&#8217;, &#8216;your-theme&#8217; ), $cats_meow ) ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;?php endif ?&gt;</p>
<p>Hence, the final look of your category.php is:</p>
<p>&lt;?php the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( is_day() ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php _e( &#8216;Category Archives:&#8217;, &#8216;your-theme&#8217; ) ?&gt; &lt;span&gt;&lt;?php single_cat_title() ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h1&gt;</p>
<p>&lt;?php $categorydesc = category_description(); if ( !empty($categorydesc) ) echo apply_filters( &#8216;archive_meta&#8217;, &#8216;&lt;div&gt;&#8217; . $categorydesc . &#8216;&lt;/div&gt;&#8217; ); ?&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php rewind_posts(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-above&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-above &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php while ( have_posts() ) : the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p>&lt;h2 class=&#8221;entry-title&#8221;&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221; title=&#8221;&lt;?php printf( __(&#8216;Permalink to %s&#8217;, &#8216;your-theme&#8217;), the_title_attribute(&#8216;echo=0&#8242;) ); ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-meta&#8221;&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-author&#8221;&gt;&lt;?php _e(&#8216;By &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;author vcard&#8221;&gt;&lt;a href=&#8221;&lt;?php echo get_author_link( false, $authordata-&gt;ID, $authordata-&gt;user_nicename ); ?&gt;&#8221; title=&#8221;&lt;?php printf( __( &#8216;View all posts by %s&#8217;, &#8216;your-theme&#8217; ), $authordata-&gt;display_name ); ?&gt;&#8221;&gt;&lt;?php the_author(); ?&gt;&lt;/a&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-entry-date&#8221;&gt;&lt;?php _e(&#8216;Published &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;entry-date&#8221;&gt;&lt;abbr title=&#8221;&lt;?php the_time(&#8216;Y-m-dTH:i:sO&#8217;) ?&gt;&#8221;&gt;&lt;?php the_time( get_option( &#8216;date_format&#8217; ) ); ?&gt;&lt;/abbr&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;nttttt&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-meta &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-summary&#8221;&gt;</p>
<p>&lt;?php the_excerpt( __( &#8216;Continue reading &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )  ); ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-summary &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div&gt;</p>
<p>&lt;?php if ( $cats_meow = cats_meow(&#8216;, &#8216;) ) : // Returns categories other than the one queried ?&gt;</p>
<p>&lt;span class=&#8221;cat-links&#8221;&gt;&lt;?php printf( __( &#8216;Also posted in %s&#8217;, &#8216;your-theme&#8217; ), $cats_meow ) ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;?php endif ?&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;?php the_tags( &#8216;&lt;span&gt;&lt;span class=&#8221;entry-utility-prep entry-utility-prep-tag-links&#8221;&gt;&#8217; . __(&#8216;Tagged &#8216;, &#8216;your-theme&#8217; ) . &#8216;&lt;/span&gt;&#8217;, &#8220;, &#8220;, &#8220;&lt;/span&gt;ntttttt&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;n&#8221; ) ?&gt;</p>
<p>&lt;span class=&#8221;comments-link&#8221;&gt;&lt;?php comments_popup_link( __( &#8216;Leave a comment&#8217;, &#8216;your-theme&#8217; ), __( &#8217;1 Comment&#8217;, &#8216;your-theme&#8217; ), __( &#8216;% Comments&#8217;, &#8216;your-theme&#8217; ) ) ?&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;ntttttn&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #entry-utility &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-below&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p><strong>Tags Template (tags.php)</strong></p>
<p>As clear from name; the template is about tags. Again create another copy of archive.php and rename it to tags.php and then drop following function to functions.php:</p>
<p>// lists tag on tag archives: Returns other tags except the current</p>
<p>function tag_ur_it($glue) {</p>
<p>$current_tag = single_tag_title( &#8221;, &#8221;,  false );</p>
<p>$separator = &#8220;n&#8221;;</p>
<p>$tags = explode( $separator, get_the_tag_list( &#8220;&#8221;, &#8220;$separator&#8221;, &#8220;&#8221; ) );</p>
<p>foreach ( $tags as $i =&gt; $str ) {</p>
<p>if ( strstr( $str, &#8220;&gt;$current_tag&lt;&#8221; ) ) {</p>
<p>unset($tags[$i]);</p>
<p>break;</p>
<p>}</p>
<p>}</p>
<p>if ( empty($tags) )</p>
<p>return false;</p>
<p>&nbsp;</p>
<p>return trim(join( $glue, $tags ));</p>
<p>} // end tag_ur_it</p>
<p>&nbsp;</p>
<p>Following is your renamed copy of archive.php template. Do the changes given after this template:<br />
&lt;?php the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( is_day() ) : ?&gt;</p>
<p><span style="color: #ff0000">&lt;h1&gt;&lt;?php printf( __( &#8216;Daily Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(get_option(&#8216;date_format&#8217;)) ) ?&gt;&lt;/h1&gt;</span></p>
<p>&lt;?php elseif ( is_month() ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php printf( __( &#8216;Monthly Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(&#8216;F Y&#8217;) ) ?&gt;&lt;/h1&gt;</p>
<p>&lt;?php elseif ( is_year() ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php printf( __( &#8216;Yearly Archives: &lt;span&gt;%s&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; ), get_the_time(&#8216;Y&#8217;) ) ?&gt;&lt;/h1&gt;</p>
<p>&lt;?php elseif ( isset($_GET['paged']) &amp;&amp; !empty($_GET['paged']) ) : ?&gt;</p>
<p>&lt;h1 class=&#8221;page-title&#8221;&gt;&lt;?php _e( &#8216;Blog Archives&#8217;, &#8216;your-theme&#8217; ) ?&gt;&lt;/h1&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php rewind_posts(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-above&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-above &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php while ( have_posts() ) : the_post(); ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;div id=&#8221;post-&lt;?php the_ID(); ?&gt;&#8221; &lt;?php post_class(); ?&gt;&gt;</p>
<p>&lt;h2 class=&#8221;entry-title&#8221;&gt;&lt;a href=&#8221;&lt;?php the_permalink(); ?&gt;&#8221; title=&#8221;&lt;?php printf( __(&#8216;Permalink to %s&#8217;, &#8216;your-theme&#8217;), the_title_attribute(&#8216;echo=0&#8242;) ); ?&gt;&#8221; rel=&#8221;bookmark&#8221;&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-meta&#8221;&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-author&#8221;&gt;&lt;?php _e(&#8216;By &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;author vcard&#8221;&gt;&lt;a href=&#8221;&lt;?php echo get_author_link( false, $authordata-&gt;ID, $authordata-&gt;user_nicename ); ?&gt;&#8221; title=&#8221;&lt;?php printf( __( &#8216;View all posts by %s&#8217;, &#8216;your-theme&#8217; ), $authordata-&gt;display_name ); ?&gt;&#8221;&gt;&lt;?php the_author(); ?&gt;&lt;/a&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-prep meta-prep-entry-date&#8221;&gt;&lt;?php _e(&#8216;Published &#8216;, &#8216;your-theme&#8217;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;entry-date&#8221;&gt;&lt;abbr title=&#8221;&lt;?php the_time(&#8216;Y-m-dTH:i:sO&#8217;) ?&gt;&#8221;&gt;&lt;?php the_time( get_option( &#8216;date_format&#8217; ) ); ?&gt;&lt;/abbr&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;nttttt&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-meta &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-summary&#8221;&gt;</p>
<p>&lt;?php the_excerpt( __( &#8216;Continue reading &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )  ); ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; .entry-summary &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;div class=&#8221;entry-utility&#8221;&gt;</p>
<p>&lt;span class=&#8221;cat-links&#8221;&gt;&lt;span&gt;&lt;?php _e( &#8216;Posted in &#8216;, &#8216;your-theme&#8217; ); ?&gt;&lt;/span&gt;&lt;?php echo get_the_category_list(&#8216;, &#8216;); ?&gt;&lt;/span&gt;</p>
<p>&lt;span class=&#8221;meta-sep&#8221;&gt; | &lt;/span&gt;</p>
<p><span style="color: #333399">&lt;?php the_tags( &#8216;&lt;span class=&#8221;tag-links&#8221;&gt;&lt;span&gt;&#8217; . __(&#8216;Tagged &#8216;, &#8216;your-theme&#8217; ) . &#8216;&lt;/span&gt;&#8217;, &#8220;, &#8220;, &#8220;&lt;/span&gt;ntttttt&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;n&#8221; ) ?&gt;</span></p>
<p>&lt;span class=&#8221;comments-link&#8221;&gt;&lt;?php comments_popup_link( __( &#8216;Leave a comment&#8217;, &#8216;your-theme&#8217; ), __( &#8217;1 Comment&#8217;, &#8216;your-theme&#8217; ), __( &#8216;% Comments&#8217;, &#8216;your-theme&#8217; ) ) ?&gt;&lt;/span&gt;</p>
<p>&lt;?php edit_post_link( __( &#8216;Edit&#8217;, &#8216;your-theme&#8217; ), &#8220;&lt;span class=&#8221;meta-sep&#8221;&gt;|&lt;/span&gt;ntttttt&lt;span class=&#8221;edit-link&#8221;&gt;&#8221;, &#8220;&lt;/span&gt;ntttttn&#8221; ) ?&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #entry-utility &#8211;&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #post-&lt;?php the_ID(); ?&gt; &#8211;&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php endwhile; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php global $wp_query; $total_pages = $wp_query-&gt;max_num_pages; if ( $total_pages &gt; 1 ) { ?&gt;</p>
<p>&lt;div id=&#8221;nav-below&#8221;&gt;</p>
<p>&lt;div class=&#8221;nav-previous&#8221;&gt;&lt;?php next_posts_link(__( &#8216;&lt;span class=&#8221;meta-nav&#8221;&gt;&amp;laquo;&lt;/span&gt; Older posts&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;div class=&#8221;nav-next&#8221;&gt;&lt;?php previous_posts_link(__( &#8216;Newer posts &lt;span&gt;&amp;raquo;&lt;/span&gt;&#8217;, &#8216;your-theme&#8217; )) ?&gt;&lt;/div&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #nav-below &#8211;&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&nbsp;</p>
<p>Replace red color code block of tite with:</p>
<p><code>&lt;h1 class="page-title"&gt;&lt;?php _e( 'Tag Archives:', 'your-theme'</code> <code>) ?&gt; &lt;span&gt;&lt;?php single_tag_title() ?&gt;&lt;/span&gt;&lt;/h1&gt;</code></p>
<p>And, replace the blue color code block of entry-utility with:</p>
<p>&lt;?php if ( $tag_ur_it = tag_ur_it(&#8216;, &#8216;) ) : // Returns tags other than the one queried ?&gt;</p>
<p>&lt;span class=&#8221;tag-links&#8221;&gt;&lt;?php printf( __( &#8216;Also tagged %s&#8217;, &#8216;your-theme&#8217; ), $tag_ur_it ) ?&gt;&lt;/span&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>Now, the following is your complete template of tags.php</p>
<p><strong>Sidebar Template (sidebar.php)</strong></p>
<p>Register widget areas in functions.php for your sidebar by the following code block:</p>
<p>// Registering widget areas</p>
<p>function theme_widgets_init() {</p>
<p>// Area 1</p>
<p>register_sidebar( array (</p>
<p>&#8216;name&#8217; =&gt; &#8216;Primary Widget Area&#8217;,</p>
<p>&#8216;id&#8217; =&gt; &#8216;primary_widget_area&#8217;,</p>
<p>&#8216;before_widget&#8217; =&gt; &#8216;&lt;li id=&#8221;%1$s&#8221; class=&#8221;widget-container %2$s&#8221;&gt;&#8217;,</p>
<p>&#8216;after_widget&#8217; =&gt; &#8220;&lt;/li&gt;&#8221;,</p>
<p>&#8216;before_title&#8217; =&gt; &#8216;&lt;h3&gt;&#8217;,</p>
<p>&#8216;after_title&#8217; =&gt; &#8216;&lt;/h3&gt;&#8217;,</p>
<p>) );</p>
<p>&nbsp;</p>
<p>// Area 2</p>
<p>register_sidebar( array (</p>
<p>&#8216;name&#8217; =&gt; &#8216;Secondary Widget Area&#8217;,</p>
<p>&#8216;id&#8217; =&gt; &#8216;secondary_widget_area&#8217;,</p>
<p>&#8216;before_widget&#8217; =&gt; &#8216;&lt;li id=&#8221;%1$s&#8221; class=&#8221;widget-container %2$s&#8221;&gt;&#8217;,</p>
<p>&#8216;after_widget&#8217; =&gt; &#8220;&lt;/li&gt;&#8221;,</p>
<p>&#8216;before_title&#8217; =&gt; &#8216;&lt;h3&gt;&#8217;,</p>
<p>&#8216;after_title&#8217; =&gt; &#8216;&lt;/h3&gt;&#8217;,</p>
<p>) );</p>
<p>} // end theme_widgets_init</p>
<p>&nbsp;</p>
<p>add_action( &#8216;init&#8217;, &#8216;theme_widgets_init&#8217; );</p>
<p>Drop following function in function.php to check for widgets in the widget areas:</p>
<p>function is_sidebar_active( $index ){</p>
<p>global $wp_registered_sidebars;</p>
<p>&nbsp;</p>
<p>$widgetcolums = wp_get_sidebars_widgets();</p>
<p>&nbsp;</p>
<p>if ($widgetcolums[$index]) return true;</p>
<p>&nbsp;</p>
<p>return false;</p>
<p>}</p>
<p>&nbsp;</p>
<p>Add the following code in functions.php for the wordpress to add default widgets:</p>
<p>&nbsp;</p>
<p>$preset_widgets = array (</p>
<p>&#8216;primary_widget_area&#8217;  =&gt; array( &#8216;search&#8217;, &#8216;pages&#8217;, &#8216;categories&#8217;, &#8216;archives&#8217; ),</p>
<p>&#8216;secondary_widget_area&#8217;  =&gt; array( &#8216;links&#8217;, &#8216;meta&#8217; )</p>
<p>);</p>
<p>if ( isset( $_GET['activated'] ) ) {</p>
<p>update_option( &#8216;sidebars_widgets&#8217;, $preset_widgets );</p>
<p>}</p>
<p>&nbsp;</p>
<p>Now last step is to create your sidebar.php template:</p>
<p>&lt;?php if ( is_sidebar_active(&#8216;primary_widget_area&#8217;) ) : ?&gt;</p>
<p>&lt;div id=&#8221;primary&#8221;&gt;</p>
<p>&lt;ul class=&#8221;xoxo&#8221;&gt;</p>
<p>&lt;?php dynamic_sidebar(&#8216;primary_widget_area&#8217;); ?&gt;</p>
<p>&lt;/ul&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #primary .widget-area &#8211;&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>&lt;?php if ( is_sidebar_active(&#8216;secondary_widget_area&#8217;) ) : ?&gt;</p>
<p>&lt;div id=&#8221;secondary&#8221;&gt;</p>
<p>&lt;ul class=&#8221;xoxo&#8221;&gt;</p>
<p>&lt;?php dynamic_sidebar(&#8216;secondary_widget_area&#8217;); ?&gt;</p>
<p>&lt;/ul&gt;</p>
<p>&lt;/div&gt;&lt;!&#8211; #secondary .widget-area &#8211;&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<p>Now coding with PHP is done. And now what you have to do is to style your theme.</p>
<p><strong> </strong></p>
<p><strong>Style (style.css)</strong></p>
<p>&nbsp;</p>
<p>As we have never discussed about CSS hence I am giving you a brief introduction. CSS stands for Cascading Style sheets Here it is used for giving a presentation structure (layout and colours) to your theme. It is separate from HTML structure which fixes up the control of your blog and makes it fast and easy to update.</p>
<p>&nbsp;</p>
<p>First of all create style.css and open it in a text editor and add a CSS comment which tells wordpress about your theme:</p>
<p><code>/*</code></p>
<p><code>Theme Name: kalplata</code></p>
<p><code>Theme URI: </code><a href="http://sangkrit.net/kalplata/">http://sangkrit.net/kalplata/</a></p>
<p><code>Description: A search engine optimized website framework for WordPress.</code></p>
<p><code>Author: You</code></p>
<p><code>Author URI: </code><a href="http://sangkrit.net/">http://sangkrit.net/</a></p>
<p><code>Version: x.x</code></p>
<p><code>Tags: should be comma seperated</code></p>
<p><code>.</code></p>
<p><code>GNU General Public License, version 2 (GPL).</code></p>
<p><a href="http://www.gnu.org/licenses/old-licenses/gpl-2.0.html">http://www.gnu.org/licenses/old-licenses/gpl-2.0.html</a></p>
<p><code>*/</code></p>
<p>Note: Choose your own theme name likewise here we are creating a theme named as ‘kalplata’.</p>
<p>&nbsp;</p>
<p>(Still Writing)</p>
<p><a href="http://codex.wordpress.org/Know_Your_Sources#CSS">Here are your sources to CSS</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href='http://sangkrit.net/2011/09/09/how-to-create-a-search-template-for-wordpress/' rel='bookmark' title='How To Create A Search Template For WordPress'>How To Create A Search Template For WordPress</a> <small>Search result template is used when a search is performed...</small></li>
<li><a href='http://sangkrit.net/2011/09/15/easiest-way-of-creating-post-attachment-for-wordpress/' rel='bookmark' title='Easiest Way Of  Creating Post Attachment For WordPress'>Easiest Way Of  Creating Post Attachment For WordPress</a> <small>Easiest way to created attachment.php is to copy single.php, renaming...</small></li>
<li><a href='http://sangkrit.net/2012/09/01/how-to-add-comment-numbers-in-your-wordpress-theme/' rel='bookmark' title='How To Add Comment Numbers In Your WordPress Theme ?'>How To Add Comment Numbers In Your WordPress Theme ?</a> <small>There are many WordPress themes that don&#8217;t show numbers on...</small></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://sangkrit.net/2011/05/23/getting-started-with-wordpress-theme-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Separate Trackbacks / Pingbacks and True Comments</title>
		<link>http://sangkrit.net/2011/05/21/how-to-separate-trackbacks-pingbacks-and-true-comments/</link>
		<comments>http://sangkrit.net/2011/05/21/how-to-separate-trackbacks-pingbacks-and-true-comments/#comments</comments>
		<pubDate>Sat, 21 May 2011 15:48:50 +0000</pubDate>
		<dc:creator>Shardul Pandey</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[comments .php]]></category>
		<category><![CDATA[How to Separate Trackbacks / Pingbacks and True Comments]]></category>
		<category><![CDATA[How to Separate Trackbacks / Pingbacks and True Comments In My Blog]]></category>
		<category><![CDATA[How to Separate Trackbacks / Pingbacks and True Comments In Wordpress]]></category>
		<category><![CDATA[wordpress tricks]]></category>

		<guid isPermaLink="false">http://lamp.sangkrit.net/?p=206</guid>
		<description><![CDATA[<p>Organise the comment area by placing the comments on one side and trackbacks to other in your comments .php template:</p> <p>&#60;?php if ( $comments ) : ?&#62;</p> <p>&#60;?php foreach ($comments as $comment) : ?&#62;</p> <p>&#60;?php $comment_type = get_comment_type(); ?&#62;</p> <p>&#60;?php if($comment_type == &#8216;comment&#8217;) { ?&#62;</p> <p>&#60;!&#8211; This is a comment &#8211;&#62;</p> <p>&#60;!&#8211; Comment&#8217;s content&#8211;&#62;</p> <p>&#60;?php [...]<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href='http://sangkrit.net/2013/01/14/how-to-show-trackbacks-and-pingbacks-as-widget-in-wordpress/' rel='bookmark' title='How To Show Trackbacks And Pingbacks As Widget In WordPress ?'>How To Show Trackbacks And Pingbacks As Widget In WordPress ?</a> <small>There are many plugins that allows you to show your...</small></li>
<li><a href='http://sangkrit.net/2012/09/14/stop-wordpress-trackback-spams-by-blocking-their-requests-easily-validate-all-incoming-trackbacks/' rel='bookmark' title='Stop WordPress Trackback Spams By Blocking Their Requests, Easily Validate All Incoming Trackbacks'>Stop WordPress Trackback Spams By Blocking Their Requests, Easily Validate All Incoming Trackbacks</a> <small>You can turn off trackbacks completely from your WordPress settings...</small></li>
<li><a href='http://sangkrit.net/2012/11/07/how-to-stop-wordpress-from-sending-pings-while-linking-different-posts-within-your-website/' rel='bookmark' title='How To Stop WordPress From Sending Pings When Linking Different Posts Within Your Website ?'>How To Stop WordPress From Sending Pings When Linking Different Posts Within Your Website ?</a> <small>Whenever you internally link your posts, WordPress sends a trackback...</small></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<p>Organise the comment area by placing the comments on one side and trackbacks to other in your comments .php template:</p>
<p>&lt;?php if ( $comments ) : ?&gt;</p>
<p>&lt;?php foreach ($comments as $comment) : ?&gt;</p>
<p>&lt;?php $comment_type = get_comment_type(); ?&gt;</p>
<p>&lt;?php if($comment_type == &#8216;comment&#8217;) { ?&gt;</p>
<p>&lt;!&#8211; This is a comment &#8211;&gt;</p>
<p>&lt;!&#8211; Comment&#8217;s content&#8211;&gt;</p>
<p>&lt;?php } else { $trackback = true; }?&gt;</p>
<p>&lt;?php endforeach; ?&gt;</p>
<p>&lt;?php if ($trackback == true) { ?&gt;</p>
<p>&lt;!&#8211; This is a trackback &#8211;&gt;</p>
<p>&lt;ol id=&#8221;trackbacks-ol&#8221;&gt;</p>
<p>&lt;?php foreach ($comments as $comment) : ?&gt;</p>
<p>&lt;?php $comment_type = get_comment_type(); ?&gt;</p>
<p>&lt;?php if($comment_type != &#8216;comment&#8217;) { ?&gt;</p>
<p>&lt;li&gt;</p>
<p>&lt;?php comment_author_link() ?&gt;</p>
<p>&lt;/li&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&lt;?php endforeach; ?&gt;</p>
<p>&lt;/ol&gt;</p>
<p>&lt;?php } ?&gt;</p>
<p>&lt;?php else : ?&gt;</p>
<p>&lt;?php endif; ?&gt;</p>
<p>&nbsp;</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href='http://sangkrit.net/2013/01/14/how-to-show-trackbacks-and-pingbacks-as-widget-in-wordpress/' rel='bookmark' title='How To Show Trackbacks And Pingbacks As Widget In WordPress ?'>How To Show Trackbacks And Pingbacks As Widget In WordPress ?</a> <small>There are many plugins that allows you to show your...</small></li>
<li><a href='http://sangkrit.net/2012/09/14/stop-wordpress-trackback-spams-by-blocking-their-requests-easily-validate-all-incoming-trackbacks/' rel='bookmark' title='Stop WordPress Trackback Spams By Blocking Their Requests, Easily Validate All Incoming Trackbacks'>Stop WordPress Trackback Spams By Blocking Their Requests, Easily Validate All Incoming Trackbacks</a> <small>You can turn off trackbacks completely from your WordPress settings...</small></li>
<li><a href='http://sangkrit.net/2012/11/07/how-to-stop-wordpress-from-sending-pings-while-linking-different-posts-within-your-website/' rel='bookmark' title='How To Stop WordPress From Sending Pings When Linking Different Posts Within Your Website ?'>How To Stop WordPress From Sending Pings When Linking Different Posts Within Your Website ?</a> <small>Whenever you internally link your posts, WordPress sends a trackback...</small></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://sangkrit.net/2011/05/21/how-to-separate-trackbacks-pingbacks-and-true-comments/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
