<?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>Blogsessive &#187; template tags</title>
	<atom:link href="http://blogsessive.com/tag/template-tags/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogsessive.com</link>
	<description>Visit Blogsessive for daily WordPress blogging tips.</description>
	<lastBuildDate>Fri, 16 Dec 2011 08:05:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Post Excerpts and the More Tag in WordPress</title>
		<link>http://blogsessive.com/blogging-tools/wordpress-post-excerpts-more-tag/</link>
		<comments>http://blogsessive.com/blogging-tools/wordpress-post-excerpts-more-tag/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 20:38:27 +0000</pubDate>
		<dc:creator>Alex, Blogsessive</dc:creator>
				<category><![CDATA[Blogging Tools]]></category>
		<category><![CDATA[Coding Tips]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[excerpts]]></category>
		<category><![CDATA[more]]></category>
		<category><![CDATA[template tags]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://blogsessive.com/?p=418</guid>
		<description><![CDATA[Looking for really affordable premium WordPress themes?Not only once, it has been said that displaying full posts on your blog home page, category pages or archive pages increases the chance of being penalized for duplicate content. In WordPress, using post excerpts has proven to be a good alternative, but one that has its downsides: You [...]]]></description>
			<content:encoded><![CDATA[<p>Blogsessive recommends WP WebHost for <a href="http://blogsessive.com/go-wpwebhost/" title="WordPress Hosting" target="_blank"><strong>quality WordPress blog hosting</strong></a>!</p><p>Not only once, it has been said that displaying full posts on your blog home page, category pages or archive pages increases the chance of being penalized for duplicate content.</p>
<p>In WordPress, using <strong>post excerpts</strong> has proven to be a good alternative, but one that has its downsides:</p>
<ul>
<li>You lose control over text formatting;</li>
<li>Images won&#8217;t be displayed;</li>
<li>If you don&#8217;t take time to write them yourself, WordPress might not select the most appropriate fragments;</li>
<li>Readers might not be convinced to further click, if the excerpt is not attractive enough.</li>
</ul>
<h3>Better Post Excerpts</h3>
<p>If you&#8217;re concerned about your writing style, you&#8217;ll most definitely take care about how you structure your posts, where you insert images and how you write the introductory paragraph.</p>
<p>With these in mind, you basically got yourself a very good post excerpt, one that you should not leave to WordPress to decide when and where to cut.</p>
<h4>The &#8216;More&#8217; Tag</h4>
<p>This is the most valid alternative to displaying post excerpts, if <strong>the_excerpt() </strong>template tag does not fit your needs.</p>
<p><strong>More</strong> is what the WordPress developers call a <em>quicktag</em>, designed to cut-off large posts into two fragments: one that will be displayed as an excerpt and one that users will continue to read from after clicking the &#8220;read more&#8221; link. It serves as a marker inside the post so that users who come from the excerpt link, will start reading the content from that point on, and not from the beginning, again.<span id="more-418"></span></p>
<p>What this quicktag actually represents is a HTML comment that WordPress translates a the cut-off point. To use it while editing your posts in HTML view, you simply need to add this where you want the post cut:</p>
<pre>Your introductory paragraph should be placed before using the 'more' quicktag.
That way it will act as a post excerpt.
&lt;!--more--&gt;</pre>
<p>Using it like in the above example will return a post excerpt similar to this:</p>
<blockquote><p>Your introductory paragraph should be placed before using the &#8216;more&#8217; quicktag.<br />
That way it will act as a post excerpt. <a href="#" rel="nofollow">more&#8230;</a></p></blockquote>
<h3>Customizing the &#8216;more&#8217; link</h3>
<p>The default text (<em>more&#8230;</em>) is not very attractive, right? I mean, you must really be interested in the rest of the story to click it.</p>
<p>But fear not, there are many ways in which you could customize the link, applying a global or single post effect. Described below are two methods you could use.</p>
<h4 style="margin-top: 25px">Method One: Customizing the_content() template tag</h4>
<p class="articlefeat">
<strong>Effects:</strong> Global<br />
<strong>Requirements:</strong> Minor coding knowledge</p>
<p>As per default, posts excerpts are displayed by using <em>the_excerpt()</em>, while full posts are displayed through the use of <em>the_content() tag</em>.</p>
<p>If you take a look at the code of your theme&#8217;s <em>index.php</em> file, and of course if it uses full posts, you&#8217;ll notice a line of code similar to this one:</p>
<pre>&lt;?php the_content(); ?&gt;</pre>
<p>The easiest way to customize it and obtain a global effect would be by adding a parameter containing your own &#8216;read more&#8217; text, as shown in the example below:</p>
<pre>&lt;?php the_content(' Continue reading this post!'); ?&gt;</pre>
<p>The end result will look similar to this:</p>
<blockquote><p>Your introductory paragraph should be placed before using the &#8216;more&#8217; quicktag.<br />
That way it will act as a post excerpt. <a href="#" rel="nofollow"> Continue reading this post!</a></p></blockquote>
<p>To further more customize the link, you can even use HTML code and add CSS classes to it:</p>
<pre>&lt;?php the_content(' <span class="moreLink">Continue reading this post!</span>'); ?&gt;</pre>
<p>or use WordPress&#8217; <em>get_the_title()</em> template tag to add the post name inside the link, like this:</p>
<pre>&lt;?php the_content(' Continue reading '.get_the_title()); ?&gt;</pre>
<p>Assuming the example of my own post title, this will result in something similar the this:</p>
<blockquote><p>Your introductory paragraph should be placed before using the &#8216;more&#8217; quicktag.</p>
<p>That way it will act as a post excerpt. <a href="#" rel="nofollow"> Continue reading Post Excerpts and the More Tag in WordPress</a></p></blockquote>
<p>Of course, you could always use a combination of HTML tags and WordPress template tags to further customize the link, as long as you keep in mind that the effect will be global (will apply to all posts using the <em>more</em> quicktag).</p>
<h4 style="margin-top: 25px">Method Two: Customizing the &lt;!&#45;&#45;more&#45;&#45;&gt; quicktag</h4>
<p class="articlefeat">
<strong>Effects:</strong> Single post<br />
<strong>Requirements:</strong> Nothing a 5 year old won&#8217;t manage</p>
<p>Assuming you have adjusted the link to your needs by using the above described global-method and on some posts you need to tweak the link more, the best way to customize the display text is my adding it to the &lt;!&#45;&#45;more&#45;&#45;&gt; quicktag, as shown below, in your post HTML view:</p>
<pre>&lt;!--more This is my custom more text--&gt;</pre>
<p>This will result in:</p>
<blockquote><p>Your introductory paragraph should be placed before using the &#8216;more&#8217; quicktag.<br />
That way it will act as a post excerpt. <a href="#" rel="nofollow"> This is my custom more text</a></p></blockquote>
<p><strong>Note:</strong> The results of this method override the defaults or the effects of the first method and only affect the text, and not the formatting.</p>
<h3>That&#8217;s it!</h3>
<p>Easy as one, two, three, right? Happy customizing! And in case you need more information, here are a few links from the WordPress Codex:</p>
<ul>
<li><a href="http://codex.wordpress.org/Customizing_the_Read_More" target="_blank" rel="external">Customizing the Read More</a></li>
<li><a href="http://codex.wordpress.org/Template_Tags/the_content" target="_blank" rel="external">Template Tags: the_content()</a></li>
<li><a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank" rel="external">Template Tags: the_excerpt()</a></li>
</ul>
<hr /><h3>Free PDF eBook: Corporate Blogging Guide by Blogsessive</h3>As a subscribe reader of Blogsessive, this is my gift to you: a guide to corporate blogging (but not only) that will help you in your blogging adventures! <a href="http://blogsessive.com/wp-content/plugins/download-monitor/download.php?id=8" target="_blank">Download now, for FREE!</a><br /><br /><hr/><div style="background: #eeeeee;">Advertise on Blogsessive! <a href="http://buysellads.com/buy/detail/310/" title="Advertise on Blogsessive">125x125 banners</a> for <strong>$50 per month</strong>!</div>&copy;2008-2010 Copyright by <a href="http://blogsessive.com" title="Blogging tips">Blogsessive - Blogging Tips</a>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please <a href="http://blogsessive.com/contact" title="Contact Blogsessive">contact us</a>, so that we can take legal action immediately.<img src="http://blogsessive.com/?ak_action=api_record_view&id=418&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blogsessive.com/blogging-tools/wordpress-post-excerpts-more-tag/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>How To Remove the White Space in wp_list_pages()</title>
		<link>http://blogsessive.com/blogging-tools/how-to-remove-the-white-space-in-wp_list_pages/</link>
		<comments>http://blogsessive.com/blogging-tools/how-to-remove-the-white-space-in-wp_list_pages/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 19:57:06 +0000</pubDate>
		<dc:creator>Alex, Blogsessive</dc:creator>
				<category><![CDATA[Blogging Tools]]></category>
		<category><![CDATA[Coding Tips]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[template tags]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[white space]]></category>
		<category><![CDATA[wp_list_pages]]></category>

		<guid isPermaLink="false">http://blogsessive.com/?p=39</guid>
		<description><![CDATA[The white space generated by wp_list_pages() has been a nightmare for many WordPress themes designers. It doesn't have to be one for you!]]></description>
			<content:encoded><![CDATA[<p>Looking for really <a href="http://blogsessive.com/go-themeforest/" title="Affordable Premium WP Themes" target="_blank"><strong>affordable premium WordPress themes</strong></a>?</p><p><strong>wp_list_pages()</strong> is one of the most common WordPress template tags. Sometimes, the little white space that some browsers add to the output of this function can create a big mess in your theme&#8217;s template, making it hard to style, especially when trying to create a horizontal list. The fix for this is quite simple and requires minimum coding knowledge, if none at all.</p>
<h3>The Problem</h3>
<p>The wp_list_pages() generates either a series of &lt;li&gt; elements containing links to all of you blog&#8217;s pages, or a full unordered list with a heading at the beginning.<br />
The output of this list looks like this:<span id="more-39"></span></p>
<pre>&lt;ul&gt;
&lt;li&gt;&lt;a href="#"&gt;Page name&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#"&gt;Page name&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</pre>
<p>While some browsers don&#8217;t have a problem with elements being generated on new lines, in some, this method causes a white space to show up in front of each list item. This space becomes visible and annoying when trying to create a horizontal menu with background colors and equal horizontal spacing.</p>
<h3>The Fix</h3>
<p>To get rid of the white space, your output would need to look like this:</p>
<pre>&lt;ul&gt;&lt;li&gt;&lt;a href="#"&gt;Page name&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#"&gt;Page name&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</pre>
<p>This can be achieved by using a small PHP function that will take the code generated by wp_list_pages() and turn it into something similar to the example above. To make this function available for use in your templates you need to edit the &#8220;functions.php&#8221; file, found in you theme&#8217;s directory. If you don&#8217;t have such a file, create an empty one and name it &#8220;functions.php&#8221;.</p>
<p>In functions.php add the following code at the beginning or at the end of the file. Just be careful not to paste it inside another function and cause the script to break.</p>
<pre>function qbkl_nospace($input) {
$output = str_replace(array("\n", "\r", "\t"), "", $input);
echo $output;
}</pre>
<p><img class="alignnone size-full wp-image-40" title="whitespace-fix" src="http://blogsessive.com/wp-content/uploads/2008/04/whitespace-fix.gif" alt="White space fix" width="500" height="60" /></p>
<h3>Usage</h3>
<p>To apply the fix, simply find the wp_list_pages() in your theme&#8217;s template (usually header.php or sidebar.php) and edit the code according to the following example:</p>
<p>Find:</p>
<pre>&lt;?php wp_list_pages(); ?&gt;</pre>
<p>Replace with:</p>
<pre>&lt;?php qbkl_nospace(wp_list_pages()); ?&gt;</pre>
<p>This fix works with any function or template tag that generates the same problem.</p>
<p>The white space generated by wp_list_pages() has been a nightmare for many WordPress themes designers. It doesn&#8217;t have to be one for you!</p>
<h3>Where is wp_list_pages() located?</h3>
<p>Although it&#8217;s not recommended that you alter the base code of WordPress, advanced users might feel like taking such a job.</p>
<p>If you need to alter the output, <strong>wp_list_pages</strong> is defined in the <em>post-template.php</em> file, in the &#8220;<em>wp-includes</em>&#8221; folder of your WordPress blog.</p>
<p>For further tweaking, you might also need to adjust the <strong>walk_page_tree</strong> function, located in the same file, which makes use of the class <strong>Walker_Page</strong>, extending the <strong>Walker</strong> class, both located in <em>wp-includes/classes.php</em>.</p>
<p>* The above file names and locations are confirmed for WordPress 2.5 to 2.6.3.</p>
<p>If you&#8217;re having any questions or need further assistance, please use <strong><a title="Add your comment" href="http://blogsessive.com/blogging-tools/how-to-remove-the-white-space-in-wp_list_pages/#respond" target="_self">this post&#8217;s comment form</a></strong>.</p>
<hr /><h3>Free PDF eBook: Corporate Blogging Guide by Blogsessive</h3>As a subscribe reader of Blogsessive, this is my gift to you: a guide to corporate blogging (but not only) that will help you in your blogging adventures! <a href="http://blogsessive.com/wp-content/plugins/download-monitor/download.php?id=8" target="_blank">Download now, for FREE!</a><br /><br /><hr/><div style="background: #eeeeee;">Advertise on Blogsessive! <a href="http://buysellads.com/buy/detail/310/" title="Advertise on Blogsessive">125x125 banners</a> for <strong>$50 per month</strong>!</div>&copy;2008-2010 Copyright by <a href="http://blogsessive.com" title="Blogging tips">Blogsessive - Blogging Tips</a>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please <a href="http://blogsessive.com/contact" title="Contact Blogsessive">contact us</a>, so that we can take legal action immediately.<img src="http://blogsessive.com/?ak_action=api_record_view&id=39&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blogsessive.com/blogging-tools/how-to-remove-the-white-space-in-wp_list_pages/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>WordPress Template Tags: wp_get_archives()</title>
		<link>http://blogsessive.com/blogging-tools/wordpress-template-tags-wp_get_archives/</link>
		<comments>http://blogsessive.com/blogging-tools/wordpress-template-tags-wp_get_archives/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 16:04:04 +0000</pubDate>
		<dc:creator>Alex, Blogsessive</dc:creator>
				<category><![CDATA[Blogging Tools]]></category>
		<category><![CDATA[Coding Tips]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[template tags]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp_get_archives()]]></category>

		<guid isPermaLink="false">http://blogsessive.com/blogging-tools/wordpress-template-tags-wp_get_archives/</guid>
		<description><![CDATA[Looking for really affordable premium WordPress themes?Welcome to our new series&#8217; first post! The &#8220;WordPress Template Tags&#8221; series is intended to bring into spotlight some of WordPress&#8217; less common, but very useful template tags. While the contents can&#8217;t be considered a revelation to advanced WP users and developers, it can be of big help to [...]]]></description>
			<content:encoded><![CDATA[<p>Looking for really <a href="http://blogsessive.com/go-themeforest/" title="Affordable Premium WP Themes" target="_blank"><strong>affordable premium WordPress themes</strong></a>?</p><p>Welcome to our new series&#8217; first post! The &#8220;WordPress Template Tags&#8221; series is intended to bring into spotlight some of WordPress&#8217; less common, but very useful template tags. While the contents can&#8217;t be considered a revelation to advanced WP users and developers, it can be of big help to those who take their first steps in the amazing world of online publishing using this famous blogging platform.</p>
<p>But enough chit chat! Here&#8217;s our first recommendation:</p>
<h3>wp_get_archives()</h3>
<p>Have you ever thought of how to display a list of your most recent posts? Or a list of all posts published in the last 10 days? Or 6 months? Or 2 years?<span id="more-27"></span><br />
If so, after searching for a solution, you came across a plugin to help you, or used the WordPress&#8217; standard &#8220;Recent Posts&#8221; widget.</p>
<p>For such a small need, you had to install one more thing, when it could have solved with one tiny line of code using the wp_get_archives() template tag.</p>
<p>What makes this tag so useful is the possibility to customize the result based on a few factors like: type, format, limit, code to be added before &amp; after or post count. Since by default this template tag returns results inside of &lt;li&gt;&lt;/li&gt; elements, remember to always enclose it in &lt;ul&gt;&lt;/ul&gt;, like shown below:</p>
<h3>Usage &amp; Examples:</h3>
<p>1. Display an archive of the last 6 months:</p>
<pre>&lt;ul&gt;&lt;?php wp_get_archives('type=monthly&amp;limit=6'); ?&gt;&lt;/ul&gt;</pre>
<p>2. Display the latest 10 posts:</p>
<pre>&lt;ul&gt;&lt;?php wp_get_archives('type=postbypost&amp;limit=10'); ?&gt;&lt;/ul&gt;</pre>
<p>Also, the display mode can be customized so that instead of showing a &lt;ul&gt; / &lt;li&gt; list, the archives could be displayed in a dropdown form element.</p>
<p><strong>More reference:</strong> <a href="http://codex.wordpress.org/Template_Tags/wp_get_archives" title="WordPress Codex">WordPress Codex on wp_get_archives()</a></p>
<hr /><h3>Free PDF eBook: Corporate Blogging Guide by Blogsessive</h3>As a subscribe reader of Blogsessive, this is my gift to you: a guide to corporate blogging (but not only) that will help you in your blogging adventures! <a href="http://blogsessive.com/wp-content/plugins/download-monitor/download.php?id=8" target="_blank">Download now, for FREE!</a><br /><br /><hr/><div style="background: #eeeeee;">Advertise on Blogsessive! <a href="http://buysellads.com/buy/detail/310/" title="Advertise on Blogsessive">125x125 banners</a> for <strong>$50 per month</strong>!</div>&copy;2008-2010 Copyright by <a href="http://blogsessive.com" title="Blogging tips">Blogsessive - Blogging Tips</a>. This Feed is for personal non-commercial use only. If you are not reading this material in your news aggregator, the site you are looking at is guilty of copyright infringement. Please <a href="http://blogsessive.com/contact" title="Contact Blogsessive">contact us</a>, so that we can take legal action immediately.<img src="http://blogsessive.com/?ak_action=api_record_view&id=27&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://blogsessive.com/blogging-tools/wordpress-template-tags-wp_get_archives/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

