<?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>Keep Walking &#187; Hacks</title>
	<atom:link href="http://www.aowaa.com/tag/hacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aowaa.com</link>
	<description>Free Wordpress Theme, Make Money Online And Cool Gadgets</description>
	<lastBuildDate>Fri, 09 Jul 2010 15:44:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to Add Advertisement Between Posts in WordPress</title>
		<link>http://www.aowaa.com/how-to-add-advertisement-between-posts-in-wordpress/</link>
		<comments>http://www.aowaa.com/how-to-add-advertisement-between-posts-in-wordpress/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 03:05:54 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Advertisement]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Money Blogging]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.aowaa.com/?p=223</guid>
		<description><![CDATA[The advertisement is the best and easiest way for money blogging. Most of us like to put the advertisement in the sidebar and in the post. As we know the more advertisement you show the more earning you get. So we should think about how to increase advertisements friendly and effectively. The bottom of the [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>advertisement</strong> is the best and easiest way for <a href="http://www.aowaa.com/how-to-start-your-money-blogging/" target="_self">money blogging</a>. Most of us like to put the advertisement in the sidebar and in the post. As we know the more <a href="http://www.aowaa.com/tag/advertisement/" target="_self">advertisement</a> you show the more earning you get. So we should think about how to increase advertisements friendly and effectively.</p>
<p>The bottom of the first post in your home page is a good position for <strong>advertisements</strong>. The readers will take note of what is it at the bottom of the first post. If there is a size of 468X60 ads, it will be blended in your blog perfectly.</p>
<div id="attachment_301" class="wp-caption aligncenter" style="width: 507px"><a href="http://www.aowaa.com/wp-content/uploads/2009/11/post-bottom-ads.JPG" class="highslide-image" onclick="return hs.expand(this);"><img class="size-full wp-image-301 " title="post-bottom-ads" src="http://www.aowaa.com/wp-content/uploads/2009/11/post-bottom-ads.JPG" alt="post-bottom-ads" width="497" height="132" /></a><p class="wp-caption-text">The advertisement in the bottom of first post in home page</p></div>
<p><span id="more-223"></span>If you want add the great ads in the home page, you can get start from the <code>index.php</code> file of your <a href="http://www.aowaa.com/tag/theme/" target="_self">wordpress theme</a>. Find the statement of:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Add this code before that statement, and it should be like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$postcount</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'1'</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>And then find the statement of  <code>&lt;?php endwhile; ?&gt;</code>, and add the post count code before, when you finish it will look like this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$postcount</span> <span style="color: #339933;">++;</span>endwhile<span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Now you can add the advertisement between the while and endwhile function, using same format like the below code, you can change the number to change how many post with advertisements.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$postcount</span><span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!--  your ad code --&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<hr />
<p><small>© Alex for <a href="http://www.aowaa.com">Keep Walking</a>, 2009. |
<a href="http://www.aowaa.com/how-to-add-advertisement-between-posts-in-wordpress/">Permalink</a> |
<a href="http://www.aowaa.com/how-to-add-advertisement-between-posts-in-wordpress/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.aowaa.com/how-to-add-advertisement-between-posts-in-wordpress/&title=How to Add Advertisement Between Posts in WordPress">del.icio.us</a>
<br/>
Post tags: <a href="http://www.aowaa.com/tag/advertisement/" rel="tag">Advertisement</a>, <a href="http://www.aowaa.com/tag/hacks/" rel="tag">Hacks</a>, <a href="http://www.aowaa.com/tag/money-blogging/" rel="tag">Money Blogging</a>, <a href="http://www.aowaa.com/tag/tutorial/" rel="tag">Tutorial</a><br/>
</small></p>
	<h3>Related posts: </h3>
	<ul class="st-related-posts">
	<li><a href="http://www.aowaa.com/how-to-start-your-money-blogging/" title="How To Start Your Money Blogging (March 4, 2009)">How To Start Your Money Blogging</a> (3)</li>
	<li><a href="http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/" title="How to Get Thumbnail Automatically from WordPress Posts (April 24, 2009)">How to Get Thumbnail Automatically from WordPress Posts</a> (5)</li>
	<li><a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/" title="How to Create Archives Page without Any Plugin in WordPress (September 2, 2009)">How to Create Archives Page without Any Plugin in WordPress</a> (2)</li>
	<li><a href="http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/" title="How to Add Spam and Delete Action Links to WordPress Comments (August 6, 2009)">How to Add Spam and Delete Action Links to WordPress Comments</a> (0)</li>
	<li><a href="http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/" title="How to Add Colorful Tag Cloud without Any Plugin in WordPress (August 20, 2009)">How to Add Colorful Tag Cloud without Any Plugin in WordPress</a> (10)</li>
	<li><a href="http://www.aowaa.com/let-your-blog-snow-in-christmas-day/" title="Let Your Blog Snow in Christmas Day (December 17, 2008)">Let Your Blog Snow in Christmas Day</a> (0)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.aowaa.com/how-to-add-advertisement-between-posts-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Create Archives Page without Any Plugin in WordPress</title>
		<link>http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/</link>
		<comments>http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 15:30:34 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Archives]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.aowaa.com/?p=220</guid>
		<description><![CDATA[The archives page can show how many articles you have been write, and when you wrote this articles. There are many wordpress plugin that can build your wordpress archives page, such as Clean Archives Reloaded, WP-EasyArchives and so on. If you do not like to use so much wordpress plugin, you can build the archives [...]]]></description>
			<content:encoded><![CDATA[<p>The <strong>archives page</strong> can show how many articles you have been write, and when you wrote this articles. There are many wordpress plugin that can build your wordpress <a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/" target="_self">archives page</a>, such as <a href="http://www.caxblog.com/wordpress-plugin-clean-archives-reloaded/">Clean Archives Reloaded</a>, <a href="http://www.neoease.com/wp-easyarchives/" target="_blank">WP-EasyArchives</a> and so on.</p>
<p>If you do not like to use so much <a href="../tag/plugin/" target="_self">wordpress plugin</a>, you can build the <strong>archives page</strong> yourself. Do some copy-edit to your <code>page.php</code> file, you can have your own <a href="../tag/archives/" target="_self">archives page</a>.</p>
<p><img class="size-full wp-image-232 alignnone" title="WordPress_archives-1" src="http://www.aowaa.com/wp-content/uploads/2009/09/WordPress_archives-1.jpg" alt="WordPress_archives-1" width="400" height="300" /></p>
<p><span id="more-220"></span>1. Copy you <code>page.php</code> file of your wordpress theme and rename it as <code>archives.php</code>. Add this code to the header of the file before <code>&lt;?php get_header(); ?&gt;</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Template Name: Archives
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>2. Add this code below the function <code>&lt;?php the_content(); ?&gt;</code>, or replace the function as you like.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// echo archives start</span>
<span style="color: #000088;">$lastpost</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT ID FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> WHERE post_date &lt;'&quot;</span> <span style="color: #339933;">.</span> current_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;' AND post_status='publish' AND post_type='post' AND post_password='' ORDER BY post_date DESC LIMIT 1&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hfy_archives_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$lastpost</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;DELETE FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;options</span> WHERE option_name LIKE 'hfy_archives_%'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #666666; font-style: italic;">// Get all of the months that have posts</span>
 <span style="color: #000088;">$monthquery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT DISTINCT YEAR(post_date) AS year, MONTH(post_date) AS month, count(ID) as posts FROM &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">posts</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; WHERE post_date &lt;'&quot;</span> <span style="color: #339933;">.</span> current_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mysql'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;' AND post_status='publish' AND post_type='post' AND post_password='' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$monthresults</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$monthquery</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$monthresults</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #666666; font-style: italic;">// Loop through each month</span>
 <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$monthresults</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$monthresult</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$thismonth</span>    <span style="color: #339933;">=</span> zeroise<span style="color: #009900;">&#40;</span><span style="color: #000088;">$monthresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$thisyear</span>    <span style="color: #339933;">=</span> <span style="color: #000088;">$monthresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Get all of the posts for the current month</span>
 <span style="color: #000088;">$postquery</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT ID, post_date, post_title, comment_count FROM &quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">posts</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot; WHERE post_date LIKE '<span style="color: #006699; font-weight: bold;">$thisyear</span>-<span style="color: #006699; font-weight: bold;">$thismonth</span>-%' AND post_date AND post_status='publish' AND post_type='post' AND post_password='' ORDER BY post_date DESC&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$postresults</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$postquery</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$postresults</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #666666; font-style: italic;">// The month year title things</span>
 <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%s %d'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$month</span><span style="color: #009900;">&#91;</span>zeroise<span style="color: #009900;">&#40;</span><span style="color: #000088;">$monthresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">month</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$monthresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">year</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$postcount</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$postresults</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;p&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$text</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;nbsp;(&amp;nbsp;&lt;span&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$postresults</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/span&gt;&amp;nbsp;posts&amp;nbsp;)&lt;/p&gt;'</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;ul class='archiveslist'&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$postresults</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$postresult</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$postresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_date</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">'0000-00-00 00:00:00'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$postresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$arc_title</span>    <span style="color: #339933;">=</span> <span style="color: #000088;">$postresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$arc_title</span><span style="color: #009900;">&#41;</span>
 <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> wptexturize<span style="color: #009900;">&#40;</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$arc_title</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">else</span>
 <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$postresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$title_text</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'read more &amp;quot;'</span> <span style="color: #339933;">.</span> wp_specialchars<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;quot;'</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'    &lt;li&gt;'</span> <span style="color: #339933;">.</span> mysql2date<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'m-d'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$postresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_date</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">':&amp;nbsp;'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;a href='<span style="color: #006699; font-weight: bold;">$url</span>' title='<span style="color: #006699; font-weight: bold;">$title_text</span>'&gt;<span style="color: #006699; font-weight: bold;">$text</span>&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&amp;nbsp;('</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$postresult</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_count</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">')'</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/li&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;/ul&gt;<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #009900;">&#125;</span>
 update_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'hfy_archives_'</span><span style="color: #339933;">.</span><span style="color: #000088;">$lastpost</span><span style="color: #339933;">,</span><span style="color: #000088;">$output</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;strong&gt;'</span><span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ERROR:'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/strong&gt; '</span><span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No items were found to be displayed.'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$output</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//echo archives end</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>When you finish this coding, upload the <code>archives.php</code> file to your <a href="http://www.aowaa.com/tag/theme/" target="_self">wordpress theme</a> directory. At this point the archives functions have been created, and you can use it to show your <a href="http://www.aowaa.com/tag/archives/" target="_self">archives</a> posts.</p>
<div id="attachment_233" class="wp-caption aligncenter" style="width: 358px"><img class="size-full wp-image-233 " title="archives-page" src="http://www.aowaa.com/wp-content/uploads/2009/09/archives-page.gif" alt="archives-page" width="348" height="201" /><p class="wp-caption-text">Archives Template</p></div>
<p>Go to the dashboard, create a new page name as <strong>Archives</strong> and select the <strong>Archives</strong> as the page template. Click to see your new page after you publish it. You can see the <a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/" target="_self">archives page</a> show all your wrote post by post.</p>
<p>The <a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/" target="_self">archives page</a> can list the articles monthly and show the comment number at the end of each post. The list will update when you post a new articles, so don’t be confused when the list show the wrong comment number.</p>
<hr />
<p><small>© Alex for <a href="http://www.aowaa.com">Keep Walking</a>, 2009. |
<a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/">Permalink</a> |
<a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/&title=How to Create Archives Page without Any Plugin in WordPress">del.icio.us</a>
<br/>
Post tags: <a href="http://www.aowaa.com/tag/archives/" rel="tag">Archives</a>, <a href="http://www.aowaa.com/tag/hacks/" rel="tag">Hacks</a>, <a href="http://www.aowaa.com/tag/tutorial/" rel="tag">Tutorial</a>, <a href="http://www.aowaa.com/tag/wordpress/" rel="tag">Wordpress</a><br/>
</small></p>
	<h3>Related posts: </h3>
	<ul class="st-related-posts">
	<li><a href="http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/" title="How to Get Thumbnail Automatically from WordPress Posts (April 24, 2009)">How to Get Thumbnail Automatically from WordPress Posts</a> (5)</li>
	<li><a href="http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/" title="How to Add Spam and Delete Action Links to WordPress Comments (August 6, 2009)">How to Add Spam and Delete Action Links to WordPress Comments</a> (0)</li>
	<li><a href="http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/" title="How to Add Colorful Tag Cloud without Any Plugin in WordPress (August 20, 2009)">How to Add Colorful Tag Cloud without Any Plugin in WordPress</a> (10)</li>
	<li><a href="http://www.aowaa.com/how-to-seo-your-wordpress-theme/" title="How to SEO Your WordPress Theme (December 18, 2008)">How to SEO Your WordPress Theme</a> (4)</li>
	<li><a href="http://www.aowaa.com/how-to-add-advertisement-between-posts-in-wordpress/" title="How to Add Advertisement Between Posts in WordPress (November 13, 2009)">How to Add Advertisement Between Posts in WordPress</a> (0)</li>
	<li><a href="http://www.aowaa.com/update-to-wordpress-27-and-change-the-theme/" title="Update to WordPress 2.7 And Change The Theme (December 12, 2008)">Update to WordPress 2.7 And Change The Theme</a> (3)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Add Colorful Tag Cloud without Any Plugin in WordPress</title>
		<link>http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/</link>
		<comments>http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 03:43:49 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Tag Cloud]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.aowaa.com/?p=216</guid>
		<description><![CDATA[The tags cloud page can show the most discussed topics to your readers.Using the wp_tag_cloud function can add the tag cloud in your wordpress page. You can learn more about wp_tag_cloud function from wordpress codex. But the default tag cloud in wordpress show in single color, it’s blankness and hard to read. So if you [...]]]></description>
			<content:encoded><![CDATA[<p>The tags cloud page can show the most discussed topics to your readers.Using the wp_tag_cloud function can add the tag cloud in your wordpress page. You can learn more about <a href="http://codex.wordpress.org/Template_Tags/wp_tag_cloud" target="_blank">wp_tag_cloud</a> function from wordpress codex. But the default tag cloud in wordpress show in single color, it’s blankness and hard to read. So if you make the tag cloud show up colorful, the readers can easily get your main topics and know what are you talking about in your blog.</p>
<div id="attachment_221" class="wp-caption alignnone" style="width: 405px"><img class="size-full wp-image-221 " title="color tag cloud" src="http://www.aowaa.com/wp-content/uploads/2009/08/color-tag-cloud.jpg" alt="color tag cloud" width="395" height="141" /><p class="wp-caption-text">Colorful Tag Cloud</p></div>
<p><span id="more-216"></span>If you have installed the <a href="http://wordpress.org/extend/plugins/simple-tags/" target="_blank">simple tags</a> wordpress plugin, you can use the function <code>&lt;?php st_tag_cloud(); ?&gt;</code> to add the <strong>colorful tag cloud</strong>. But if you didn’t, we can tell you an easily way to add the <a href="http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/" target="_self">colorful tag cloud</a> without any plugin in wordpress. You can see the demo from my <a href="http://www.aowaa.com/archive/tags/" target="_self">colorful tag cloud page</a>.</p>
<p>Firstly, open the <code>functions.php</code> file in your theme directory, copy the subjacent code and paste it in your functions.php file.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #666666; font-style: italic;">//Start of colorful tag cloud</span>
<span style="color: #000000; font-weight: bold;">function</span> colorCloud<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace_callback</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|&lt;a (.+?)&gt;|i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'colorCloudCallback'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #000088;">$text</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> colorCloudCallback<span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$color</span> <span style="color: #339933;">=</span> <span style="color: #990000;">dechex</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">16777215</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$pattern</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/style=(\'|\&quot;)(.*)(\'|\&quot;)/i'</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$text</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$pattern</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;style=<span style="color: #000099; font-weight: bold;">\&quot;</span>color:#<span style="color: #006699; font-weight: bold;">{$color}</span>;<span style="color: #006699; font-weight: bold;">$2</span>;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;&lt;a <span style="color: #006699; font-weight: bold;">$text</span>&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_tag_cloud'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'colorCloud'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">//End of colorful tag cloud</span></pre></td></tr></table></div>

<p>Add the subjacent code to where you want the tag cloud show. And it’s done, you can see the <a href="http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/" target="_self">colorful tag cloud</a> in your wordpress blog now.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_tag_cloud<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'smallest=8&amp;largest=24&amp;number=50'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<hr />
<p><small>© Alex for <a href="http://www.aowaa.com">Keep Walking</a>, 2009. |
<a href="http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/">Permalink</a> |
<a href="http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/#comments">10 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/&title=How to Add Colorful Tag Cloud without Any Plugin in WordPress">del.icio.us</a>
<br/>
Post tags: <a href="http://www.aowaa.com/tag/hacks/" rel="tag">Hacks</a>, <a href="http://www.aowaa.com/tag/tag-cloud/" rel="tag">Tag Cloud</a>, <a href="http://www.aowaa.com/tag/tutorial/" rel="tag">Tutorial</a>, <a href="http://www.aowaa.com/tag/wordpress/" rel="tag">Wordpress</a><br/>
</small></p>
	<h3>Related posts: </h3>
	<ul class="st-related-posts">
	<li><a href="http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/" title="How to Get Thumbnail Automatically from WordPress Posts (April 24, 2009)">How to Get Thumbnail Automatically from WordPress Posts</a> (5)</li>
	<li><a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/" title="How to Create Archives Page without Any Plugin in WordPress (September 2, 2009)">How to Create Archives Page without Any Plugin in WordPress</a> (2)</li>
	<li><a href="http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/" title="How to Add Spam and Delete Action Links to WordPress Comments (August 6, 2009)">How to Add Spam and Delete Action Links to WordPress Comments</a> (0)</li>
	<li><a href="http://www.aowaa.com/how-to-seo-your-wordpress-theme/" title="How to SEO Your WordPress Theme (December 18, 2008)">How to SEO Your WordPress Theme</a> (4)</li>
	<li><a href="http://www.aowaa.com/how-to-add-advertisement-between-posts-in-wordpress/" title="How to Add Advertisement Between Posts in WordPress (November 13, 2009)">How to Add Advertisement Between Posts in WordPress</a> (0)</li>
	<li><a href="http://www.aowaa.com/update-to-wordpress-27-and-change-the-theme/" title="Update to WordPress 2.7 And Change The Theme (December 12, 2008)">Update to WordPress 2.7 And Change The Theme</a> (3)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>How to Add Spam and Delete Action Links to WordPress Comments</title>
		<link>http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/</link>
		<comments>http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 03:24:39 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Comment]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.aowaa.com/?p=198</guid>
		<description><![CDATA[As we know, we just only can see the edit action link in the comments of wordpress blog when we logged in. If you want to delete or mark the comments as spam, we should click the edit action link ,go into dashboard and finish the manipulation. And now, it’s easy to add the delete [...]]]></description>
			<content:encoded><![CDATA[<p>As we know, we just only can see the edit action link in the comments of <a href="http://www.aowaa.com/category/wordpress/" target="_self">wordpress</a> blog when we logged in. If you want to delete or mark the comments as spam, we should click the edit action link ,go into dashboard and finish the manipulation.</p>
<p>And now, it’s easy to add the delete and spam action link to the comment template, and you can clean your comments easily from the post. Firstly, you should open the <code>functions.php</code> file and add this code.</p>
<div id="attachment_199" class="wp-caption aligncenter" style="width: 532px"><img class="size-full wp-image-199 " title="del-spam" src="http://www.aowaa.com/wp-content/uploads/2009/08/del-spam.GIF" alt="del-spam" width="522" height="90" /><p class="wp-caption-text">Spam and Delete Link</p></div>
<p><span id="more-198"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">function</span> delete_comment_link<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span>	<span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_post'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'| &lt;a href=&quot;'</span><span style="color: #339933;">.</span>admin_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&gt;del&lt;/a&gt; ';
		echo '| &lt;a href=&quot;</span><span style="color: #0000ff;">'.admin_url(&quot;&gt;spam&lt;/a&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And than, find the <code>edit_comment_link</code> function in your <code>comment.php</code> or the <code>functions.php</code> file, add this code after the <code>edit_comment_link</code> function.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;">delete_comment_link<span style="color: #009900;">&#40;</span>get_comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Your edit link code may look like this.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_comment_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Edit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">' | '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> delete_comment_link<span style="color: #009900;">&#40;</span>get_comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If you don&#8217;t like coding, you can try the <a href="http://wordpress.org/extend/plugins/wp-ajax-edit-comments/" target="_blank">WP AJAX Edit Comment</a> plugin. It&#8217;s an awesome and powerful <a href="http://www.aowaa.com/tag/plugin/" target="_self">wordpress plugin</a>.</p>
<p><img class="alignnone size-full wp-image-200" title="ajax-edit-comment" src="http://www.aowaa.com/wp-content/uploads/2009/08/ajax-edit-comment.jpg" alt="ajax-edit-comment" width="450" height="211" /></p>
<hr />
<p><small>© Alex for <a href="http://www.aowaa.com">Keep Walking</a>, 2009. |
<a href="http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/">Permalink</a> |
<a href="http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/#comments">No comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/&title=How to Add Spam and Delete Action Links to WordPress Comments">del.icio.us</a>
<br/>
Post tags: <a href="http://www.aowaa.com/tag/comment/" rel="tag">Comment</a>, <a href="http://www.aowaa.com/tag/hacks/" rel="tag">Hacks</a>, <a href="http://www.aowaa.com/tag/theme/" rel="tag">Theme</a>, <a href="http://www.aowaa.com/tag/tutorial/" rel="tag">Tutorial</a>, <a href="http://www.aowaa.com/tag/wordpress/" rel="tag">Wordpress</a><br/>
</small></p>
	<h3>Related posts: </h3>
	<ul class="st-related-posts">
	<li><a href="http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/" title="How to Get Thumbnail Automatically from WordPress Posts (April 24, 2009)">How to Get Thumbnail Automatically from WordPress Posts</a> (5)</li>
	<li><a href="http://www.aowaa.com/how-to-seo-your-wordpress-theme/" title="How to SEO Your WordPress Theme (December 18, 2008)">How to SEO Your WordPress Theme</a> (4)</li>
	<li><a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/" title="How to Create Archives Page without Any Plugin in WordPress (September 2, 2009)">How to Create Archives Page without Any Plugin in WordPress</a> (2)</li>
	<li><a href="http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/" title="How to Add Colorful Tag Cloud without Any Plugin in WordPress (August 20, 2009)">How to Add Colorful Tag Cloud without Any Plugin in WordPress</a> (10)</li>
	<li><a href="http://www.aowaa.com/update-to-wordpress-27-and-change-the-theme/" title="Update to WordPress 2.7 And Change The Theme (December 12, 2008)">Update to WordPress 2.7 And Change The Theme</a> (3)</li>
	<li><a href="http://www.aowaa.com/the-collection-of-free-wordpress-theme-collection/" title="The Collection of Free WordPress Themes Collection (December 3, 2009)">The Collection of Free WordPress Themes Collection</a> (4)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Get Thumbnail Automatically from WordPress Posts</title>
		<link>http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/</link>
		<comments>http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 09:07:39 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[Thumbnail]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://www.aowaa.com/?p=186</guid>
		<description><![CDATA[If you are the Hybrid WordPress theme user, you may found that the Hybrid theme can get the thumbnail form your blog without any setting. Not only the Hybrid but also all the child theme of Hybrid can do this. Sometimes, your reader can easily know the content from the post title with the thumbnail. [...]]]></description>
			<content:encoded><![CDATA[<p>If you are the <a href="http://www.aowaa.com/free-wordpress-theme-hybrid/" target="_self">Hybrid WordPress theme</a> user, you may found that the Hybrid theme can get the <a href="http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/" target="_self">thumbnail</a> form your blog without any setting. Not only the Hybrid but also all the child theme of Hybrid can do this. Sometimes, your reader can easily know the content from the post title with the thumbnail. You can see the demo form <a href="http://www.caxblog.com/category/about-wordpress/" target="_self">here</a>.</p>
<p>It’s not too difficult to you if you know a little PHP coding. There’s en easy way to show the thumbnail in your blog. And you must add some code to the <code>functions.php</code> file in your <a href="http://www.aowaa.com/tag/theme/" target="_self">wordpress theme</a> directory.</p>
<p><img class="alignnone size-full wp-image-189" title="blogging-thumbnail" src="http://www.aowaa.com/wp-content/uploads/2009/04/blogging-thumbnail.jpg" alt="blogging-thumbnail" width="448" height="275" /></p>
<p><span id="more-186"></span>Open the <code>functions.php</code> file with some code editor and plaster this code between the <code>&lt;? php</code>and <code>?&gt;</code>in your <code>functions.php</code> file, and then save it.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #000000; font-weight: bold;">function</span> catch_that_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">,</span> <span style="color: #000088;">$posts</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$first_img</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #990000;">ob_end_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_match_all</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/&lt;img.+src=[\'&quot;]([^\'&quot;]+)[\'&quot;].*&gt;/i'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$first_img</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$matches</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$first_img</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">//Defines a default image</span>
 <span style="color: #000088;">$first_img</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;your default Thumbnail URL&quot;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">return</span> <span style="color: #000088;">$first_img</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This code means it can find the first photo of your posts and got it as the <a href="http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/" target="_self">thumbnail</a>, if there’s no photo in your post it will show what you set in <code>$first_img</code>. When you finish this coding, add this code in what you want the thumbnail show.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;&lt;?php printf( __( 'Permalink to %s' ), the_title_attribute('echo=0') ) ?&gt;</span></span>&quot; rel=&quot;bookmark&quot; href=&quot;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>&quot;&gt;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;img</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;thumbnail&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;&lt;?php echo catch_that_image() ?&gt;</span></span>&quot; alt=&quot;&quot; /&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>In the end add this css code in your style.css file.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:Consolas,Monaco,"Courier New",Courier,monospace;"><span style="color: #6666ff;">.thumbnail</span> 	<span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>width<span style="color: #00AA00;">:</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">;</span>height<span style="color: #00AA00;">:</span> <span style="color: #933;">150px</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">12px</span> <span style="color: #933;">6px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span> <span style="color: #933;">3px</span><span style="color: #00AA00;">;</span>background<span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#eee</span><span style="color: #00AA00;">;</span>border<span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ddd</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.sticky</span> <span style="color: #6666ff;">.thumbnail</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">transparent</span><span style="color: #00AA00;">;</span>border<span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>And now it&#8217;s done, you can see the first photo of your post in the left side of your blog.</p>
<hr />
<p><small>© Alex for <a href="http://www.aowaa.com">Keep Walking</a>, 2009. |
<a href="http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/">Permalink</a> |
<a href="http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/#comments">5 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/&title=How to Get Thumbnail Automatically from WordPress Posts">del.icio.us</a>
<br/>
Post tags: <a href="http://www.aowaa.com/tag/hacks/" rel="tag">Hacks</a>, <a href="http://www.aowaa.com/tag/theme/" rel="tag">Theme</a>, <a href="http://www.aowaa.com/tag/thumbnail/" rel="tag">Thumbnail</a>, <a href="http://www.aowaa.com/tag/tutorial/" rel="tag">Tutorial</a>, <a href="http://www.aowaa.com/tag/wordpress/" rel="tag">Wordpress</a><br/>
</small></p>
	<h3>Related posts: </h3>
	<ul class="st-related-posts">
	<li><a href="http://www.aowaa.com/how-to-add-spam-and-delete-action-links-to-wordpress-comments/" title="How to Add Spam and Delete Action Links to WordPress Comments (August 6, 2009)">How to Add Spam and Delete Action Links to WordPress Comments</a> (0)</li>
	<li><a href="http://www.aowaa.com/how-to-seo-your-wordpress-theme/" title="How to SEO Your WordPress Theme (December 18, 2008)">How to SEO Your WordPress Theme</a> (4)</li>
	<li><a href="http://www.aowaa.com/create-archives-page-without-any-plugin-wordpress/" title="How to Create Archives Page without Any Plugin in WordPress (September 2, 2009)">How to Create Archives Page without Any Plugin in WordPress</a> (2)</li>
	<li><a href="http://www.aowaa.com/how-to-add-colorful-tag-cloud-without-any-plugin-in-wordpress/" title="How to Add Colorful Tag Cloud without Any Plugin in WordPress (August 20, 2009)">How to Add Colorful Tag Cloud without Any Plugin in WordPress</a> (10)</li>
	<li><a href="http://www.aowaa.com/update-to-wordpress-27-and-change-the-theme/" title="Update to WordPress 2.7 And Change The Theme (December 12, 2008)">Update to WordPress 2.7 And Change The Theme</a> (3)</li>
	<li><a href="http://www.aowaa.com/the-collection-of-free-wordpress-theme-collection/" title="The Collection of Free WordPress Themes Collection (December 3, 2009)">The Collection of Free WordPress Themes Collection</a> (4)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.aowaa.com/how-to-get-thumbnail-automatically-from-wordpress-posts/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
