<?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>Emanuele Feronato &#187; WordPress</title>
	<atom:link href="http://www.emanueleferonato.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.emanueleferonato.com</link>
	<description>italian geek and PROgrammer</description>
	<lastBuildDate>Thu, 02 Sep 2010 09:32:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Create a contact page in WordPress 3.0</title>
		<link>http://www.emanueleferonato.com/2010/07/01/create-a-contact-page-in-wordpress-3-0/</link>
		<comments>http://www.emanueleferonato.com/2010/07/01/create-a-contact-page-in-wordpress-3-0/#comments</comments>
		<pubDate>Thu, 01 Jul 2010 08:40:27 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=3076</guid>
		<description><![CDATA[We know there are hundreds of plugins to let you host a contact form in WordPress, but I am going to show you how to create your own one. We are about to create a custom contact page that will work under WP 3.0, and more precisely with Twenty Ten theme. Obviously, with some minor [...]]]></description>
			<content:encoded><![CDATA[<p>We know there are hundreds of plugins to let you host a contact form in WordPress, but I am going to show you how to create your own one.</p>
<p>We are about to create a custom contact page that will work under WP 3.0, and more precisely with Twenty Ten theme. Obviously, with some minor changes you will be able to do the same in your theme.</p>
<p><strong>The script</strong></p>
<p>Let&#8217;s start: in your theme folder, create a new file called <code>contact.php</code> (or whatever other name with <code>php</code> extension) and write this code:</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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Template Name: Contact me
*/</span>
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>sent<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$error</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$error</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;p&gt;Please enter your name&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">filter_var</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_email<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>FILTER_VALIDATE_EMAIL<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$error</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;p&gt;Please enter a valid email address&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>                        
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_message<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$error</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;&lt;p&gt;Please enter a message&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mail</span><span style="color: #009900;">&#40;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;admin_email&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; sent you a message from &quot;</span><span style="color: #339933;">.</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;blogname&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_message<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;From: &quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_name<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &lt;&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_email<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&gt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>Reply-To:&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_email<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;div id=&quot;container&quot;&gt;
	&lt;div id=&quot;content&quot; role=&quot;main&quot;&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</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: #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: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;div id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&gt;	
			&lt;h1 class=&quot;entry-title&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;
			&lt;div class=&quot;entry-content&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;p&gt;&lt;strong&gt;Message succesfully sent. I'll reply as soon as I can&lt;/strong&gt;&lt;/p&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$error</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;p&gt;&lt;strong&gt;Your messange hasn't been sent&lt;/strong&gt;&lt;p&gt;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$error</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: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; id=&quot;contact_me&quot; method=&quot;post&quot;&gt;
					&lt;input type=&quot;hidden&quot; name=&quot;sent&quot; id=&quot;sent&quot; value=&quot;1&quot; /&gt;
					&lt;ul class=&quot;contactform&quot;&gt;
						&lt;li&gt;
							&lt;label for=&quot;your_name&quot;&gt;Name&lt;/label&gt;
							&lt;input type=&quot;text&quot; name=&quot;your_name&quot; id=&quot;your_name&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_name<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
						&lt;/li&gt;
						&lt;li&gt;
							&lt;label for=&quot;your_email&quot;&gt;Email&lt;/label&gt;
							&lt;input type=&quot;text&quot; name=&quot;your_email&quot; id=&quot;your_email&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_email<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
						&lt;/li&gt;
						&lt;li&gt;
							&lt;label for=&quot;your_message&quot;&gt;Message:&lt;/label&gt;
							&lt;textarea name=&quot;your_message&quot; id=&quot;your_message&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span>your_message<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;
						&lt;/li&gt;
						&lt;li&gt;
							&lt;input type=&quot;submit&quot; name = &quot;send&quot; value = &quot;Send email&quot; /&gt;
						&lt;/li&gt;
					&lt;/ul&gt;
				&lt;/form&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>
			&lt;/div&gt;&lt;!-- .entry-content --&gt;
		&lt;/div&gt;&lt;!-- #post-## --&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/div&gt;&lt;!-- #content --&gt;
&lt;/div&gt;&lt;!-- #container --&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</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> get_footer<span style="color: #009900;">&#40;</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>

<p>Now let&#8217;s see what we&#8217;ve done:<span id="more-3076"></span></p>
<p><strong>Lines 2-4</strong>: This is the way we assign a template name to the page. In this case, the name is <code>Contact me</code></p>
<p>We&#8217;ll see later what <strong>lines 5-19</strong> do, and let&#8217;s jump to&#8230;</p>
<p><strong>Lines 21-27</strong>: this is the same content you can find in <code>page.php</code> file into Twenty Ten theme folder, and if you&#8217;re using a different theme it should be the same content you can find in your theme <code>page.php</code> file until the beginning of the content of the page (typically <code>the_content()</code>).</p>
<p>In my case, I just replaced</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_front_page<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;h2 class=&quot;entry-title&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>	
	&lt;h1 class=&quot;entry-title&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&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></td></tr></table></div>

<p>with</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;h1 class=&quot;entry-title&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h1&gt;</pre></div></div>

<p>because I know a contact page can&#8217;t be the front page.</p>
<p><strong>Lines 28-33</strong>: Here come to play two variables, called <code>$error</code> and <code>$email</code>, you&#8217;ll see later how to set their values, meanwhile you have to know <code>$error</code> is an empty string or a string with an error (something like &#8220;You email address is not valid&#8221;) and <code>$email</code> is <code>true</code> if the email has been successfully sent.</p>
<p>The code proceeds this way:</p>
<p>* If the email has been sent, show a &#8220;Thank you message&#8221; and nothing else</p>
<p>* If the email has not been sent and there is an error, show the error and the form</p>
<p>* If the email has not been sent and there isn&#8217;t an error, show the page content (something like &#8220;Hello!! This is my fancy contact page!! Drop me a mail!!) and the form</p>
<p><strong>Lines 34-53</strong>: The form itself, the easiest possible, it&#8217;s up to you to add some more fields, if needed, and some styling.</p>
<p><strong>Lines 55-61</strong>: The end of the page, like in the normal Twenty Ten page.</p>
<p>Now it&#8217;s time to see the php that handles emails and errors</p>
<p><strong>Line 5</strong>: If &#8220;Send email&#8221; button (<strong>line 50</strong>) has been pressed&#8230;</p>
<p><strong>Line 6</strong>: set <code>$error</code> variable to empty string</p>
<p><strong>Lines 7-9</strong>: creating an error message if the user did not enter his name</p>
<p><strong>Lines 10-12</strong>: same as before, looking for a valid email address</p>
<p><strong>Lines 13-15</strong>: same as before, looking for a message</p>
<p><strong>Lines 16-18</strong>: if I did not find any error, I send the email with a basic formatting and sanitizing.</p>
<p><strong>The setup</strong></p>
<p>Once you created this file, create a new page this way:</p>
<p><img src="/wp-content/uploads/2010/07/pagetemplate.png" /></p>
<p>Look how I assign the page template according to the file recently created.</p>
<p>And this is what you&#8217;ll get:</p>
<p><img src="/wp-content/uploads/2010/07/result.png" /></p>
<p>Your own custom contact page. It&#8217;s just a basic one, but if I receive good feedback, I can improve it with some jQuery magic&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/07/01/create-a-contact-page-in-wordpress-3-0/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>WordPress 3.0 &#8220;Thelonious&#8221; released</title>
		<link>http://www.emanueleferonato.com/2010/06/18/wordpress-3-0-thelonious-released/</link>
		<comments>http://www.emanueleferonato.com/2010/06/18/wordpress-3-0-thelonious-released/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 08:51:20 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=3044</guid>
		<description><![CDATA[WordPress new major release is here!!! Named Thelonious after the american jazz composer Thelonious Sphere Monk (October 10, 1917 – February 17, 1982), will represent a revolution in WP community. Major new features in this release include: a sexy new default theme called Twenty Ten Short links support Custom backgrounds Custom headers Custom shortlinks Custom [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress new major release is here!!!</p>
<p>Named <strong>Thelonious</strong> after the american jazz composer Thelonious Sphere Monk (October 10, 1917 – February 17, 1982), will represent a revolution in WP community.</p>
<p>Major new features in this release include:</p>
<ul>
<li>a sexy new default theme called <strong>Twenty Ten</strong></li>
<li>Short links support</li>
<li>Custom backgrounds</li>
<li>Custom headers</li>
<li>Custom shortlinks</li>
<li>Custom menus</li>
<li>Custom post types</li>
<li>Custom taxonomies</li>
<li>Multi users support</li>
<li>Contextual help in admin area</li>
</ul>
<p>And obviously&#8230; it works with <a href="http://www.emanueleferonato.com/triqui-mochiads-arcade-theme-for-wordpress-official-page/">Triqui MochiAds arcade theme</a> and <a href="http://www.emanueleferonato.com/triqui-mochiads-arcade-plugin-for-wordpress-official-page/">plugin</a>.</p>
<p>Now it&#8217;s time to dive into theme development!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/06/18/wordpress-3-0-thelonious-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>How to list all WordPress posts with the same custom field value</title>
		<link>http://www.emanueleferonato.com/2010/05/29/how-to-list-all-wordpress-posts-with-the-same-custom-field-value/</link>
		<comments>http://www.emanueleferonato.com/2010/05/29/how-to-list-all-wordpress-posts-with-the-same-custom-field-value/#comments</comments>
		<pubDate>Fri, 28 May 2010 22:16:02 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2972</guid>
		<description><![CDATA[When I celebrated my four years of blogging I also introduced a big problem this blog is facing: there is so much content it&#8217;s not easy to find what you are looking for. I received some interesting suggestions, and one of them is to link all posts of the same series. This is what a [...]]]></description>
			<content:encoded><![CDATA[<p>When I celebrated my <a href="http://www.emanueleferonato.com/2010/05/26/four-years-of-blogging/">four years of blogging</a> I also introduced a big problem this blog is facing: there is so much content it&#8217;s not easy to find what you are looking for.</p>
<p>I received some interesting suggestions, and one of them is to link all posts of the same series. This is what a reader said: &#8220;In the first post, put a link of all the steps (requires manual editing)&#8221;.</p>
<p>I found a way to put an index on each post of a series using custom fields, and I am sure you&#8217;ll find it interesting. Let&#8217;s take <a href="http://www.emanueleferonato.com/2010/05/10/create-a-flash-game-like-rebuild-chile/">Create a Flash game like Rebuild Chile</a> series as example.</p>
<p>I want, in every post of the series, to show the full list of posts of the series. Without a lot of manual editing, of course.</p>
<p>So, that&#8217;s what I did: first, for every post of the series, I added a custom field called <code>series</code> with <code>Create a Flash game like Rebuild Chile</code> value. The idea is to add a <code>series</code> custom field to every post in every series with a proper value.</p>
<p>If you don&#8217;t know how to add a custom field, here it is a little help:</p>
<p><img src="/wp-content/uploads/2010/05/series.jpg" /></p>
<p>At the end of the Post page admin, you&#8217;ll find the form to add new custom fields. That&#8217;s how I added <code>series</code> custom field. Now, a few lines of code to rule them all&#8230; this is what you have to include somewhere inside the so-called <a href="http://codex.wordpress.org/The_Loop" target="_blank">WordPress Loop</a>:<span id="more-2972"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$series</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'series'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$series</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;div id = &quot;series&quot;&gt;
		&lt;h2&gt;Read all &lt;em&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$series</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/em&gt; series&lt;/h2&gt;
		&lt;ul&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$chapters</span> <span style="color: #339933;">=</span> get_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'numberposts=-1&amp;meta_key=series&amp;orderby=date&amp;order=ASC&amp;meta_value='</span><span style="color: #339933;">.</span><span style="color: #000088;">$series</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$chapters</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$chapter</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;li&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$chapter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$post</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: #000000; font-weight: bold;">?&gt;</span>&lt;a href =&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$chapter</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: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$chapter</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;/ul&gt;
	&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>Line 1</strong>: Assigning to a variable called <code>$series</code> the value of the <code>series</code> custom field value, if any. Then, if there is a value&#8230;</p>
<p><strong>Line 5</strong>: Creating a <code>$chapters</code> array and populating it with every post (numberpost=-1) whose <code>series</code> custom field (meta_key=series) has <code>$series</code> value (meta_value=$series) ordering them by date (orderby=date) in ascending way (order=ASC). Then scanning the entire array, saving each item into <code>$chapter</code><br />
variable.</p>
<p><strong>Line 6</strong>: Adding the post title, along with a link if it&#8217;s not the current post</p>
<p>The remaining lines are just HTML to let me style the content.</p>
<p>You can see the result in the <a href="http://www.emanueleferonato.com/2010/05/10/create-a-flash-game-like-rebuild-chile/">Create a Flash game like Rebuild Chile</a> series&#8230; I have to find the right style but I think I&#8217;m on the right way.</p>
<p>Do you like this way to use custom fields?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/05/29/how-to-list-all-wordpress-posts-with-the-same-custom-field-value/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Playing with Google Font API and WordPress</title>
		<link>http://www.emanueleferonato.com/2010/05/24/google-font-api-and-wordpress/</link>
		<comments>http://www.emanueleferonato.com/2010/05/24/google-font-api-and-wordpress/#comments</comments>
		<pubDate>Mon, 24 May 2010 10:27:13 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Css]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2935</guid>
		<description><![CDATA[With new webdesign trends, standard fonts such as Arial, Times and Verdana aren&#8217;t enough to give our blog/website the loon&#038;feel we want. That&#8217;s why today we&#8217;ll discover the magic of Google Font API. The Google Font API lets you include in your pages high-quality web fonts provided by the Google Font Directory. This means you [...]]]></description>
			<content:encoded><![CDATA[<p>With new webdesign trends, standard fonts such as Arial, Times and Verdana aren&#8217;t enough to give our blog/website the loon&#038;feel we want.</p>
<p>That&#8217;s why today we&#8217;ll discover the magic of <a href="http://code.google.com/apis/webfonts/" target = "_blank"><strong>Google Font API</strong></a>.</p>
<p><a href="http://code.google.com/apis/webfonts/" target = "_blank"><img src="/wp-content/uploads/2010/05/font_api-128.gif" /></a></p>
<p>The Google Font API lets you include in your pages high-quality web fonts provided by the <a href="http://code.google.com/webfonts">Google Font Directory</a>.</p>
<p>This means you can use custom fonts in your design, and they are hosted and served by Google.</p>
<p>That&#8217;s nothing new, since services like <atarget = "_blank" href="http://typekit.com/">Typekit</a> are already on the wild for quite a while, and scripts like <a href="http://cufon.shoqolate.com/generate/" target = "_blank">cufòn</a> already enhance the beauty of most premium templates.</p>
<p>But unlike cufòn, texts rendered with the Google Font API are selectable, and there isn&#8217;t any copyright issue, and unlike Typekit, Google Font API is free.</p>
<p>So let me show you the simplest example&#8230;<span id="more-2935"></span></p>
<p>Let&#8217;s take the CSS of this blog post titles:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#content</span> h1 <span style="color: #00AA00;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Times New Roman&quot;</span><span style="color: #00AA00;">;</span>   
	<span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">24px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">10px</span> <span style="color: #933;">0px</span> <span style="color: #933;">5px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#181818</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span><span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">border-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">15px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#242424</span><span style="color: #00AA00;">;</span>
	<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>and change the first line to</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Yanone Kaffeesatz&quot;</span><span style="color: #00AA00;">,</span> <span style="color: #ff0000;">&quot;Times New Roman&quot;</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>and then just add somewhere between <code>&lt;head&gt;</code> and <code>&lt;/head&gt;</code> (normally in the header.php file located in your theme directory)</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;link href='http://fonts.googleapis.com/css?family=Yanone+Kaffeesatz' rel='stylesheet' type='text/css'&gt;</pre></div></div>

<p>and&#8230; see the difference:</p>
<p><img src="/wp-content/uploads/2010/05/googleapi.png" /></p>
<p>Nice, elegant and without any important downside, if you can bare with a small number of fonts (but don&#8217;t forget we are talking about Google, so expect the number to grow fast) and the lack of iPhone/iPad compatibility (hey&#8230; shouldn&#8217;t CSS heroes design a i/whatever specific layout anyway?)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/05/24/google-font-api-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>War to hackers &#8211; The aftermath</title>
		<link>http://www.emanueleferonato.com/2010/05/05/war-to-hackers-the-aftermath/</link>
		<comments>http://www.emanueleferonato.com/2010/05/05/war-to-hackers-the-aftermath/#comments</comments>
		<pubDate>Wed, 05 May 2010 16:59:32 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2843</guid>
		<description><![CDATA[As you should know if you are an old time reader, this blog has been hacked several times with malicious script injection. I tried to secure the blog in every possible way without any luck. Finally, I think I figured out what allowed hackers to exploit the blog. I use a custom theme built on [...]]]></description>
			<content:encoded><![CDATA[<p>As you should know if you are an old time reader, this blog <a href="http://www.emanueleferonato.com/2009/12/09/help-needed-war-to-hackers/">has been hacked several times</a> with malicious script injection.</p>
<p>I tried to <a href="http://www.emanueleferonato.com/2009/10/14/10-ways-to-secure-your-wordpress-blog/">secure the blog in every possible way</a> without any luck.</p>
<p>Finally, I think I figured out what allowed hackers to exploit the blog. I use a custom theme built on an old version of <a target = "_blank" href="http://www.briangardner.com/download/silhouette-3column.zip">Silhouette theme by Brian Gardner</a>.</p>
<p>As you can see from the link, the theme is not longer available for download, but I believe the file <code>comments.php</code> contains a vulnerability.</p>
<p>Here it is:<span id="more-2843"></span></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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">// Do not delete these lines</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comments.php'</span> <span style="color: #339933;">==</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SCRIPT_FILENAME'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
		<span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Please do not load this page directly. Thanks!'</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: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_password</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;">// if there's a password</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_COOKIE</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp-postpass_'</span> <span style="color: #339933;">.</span> COOKIEHASH<span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_password</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  <span style="color: #666666; font-style: italic;">// and it doesn't match the cookie</span>
			<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			&lt;p class=&quot;nocomments&quot;&gt;This post is password protected. Enter the password to view comments.&lt;p&gt;
&nbsp;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span>
			<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">/* This variable is for alternating comment background */</span>
	<span style="color: #000088;">$oddcomment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'alt'</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!-- You can start editing here. --&gt;
&nbsp;
&lt;div id=&quot;commentblock&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;p id=&quot;comments&quot;&gt;&lt;b&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_number<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No Responses'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'One Response'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'% Responses'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span> to &amp;#8220;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&amp;#8221;&lt;/b&gt;&lt;/p&gt;
&nbsp;
	&lt;ol class=&quot;commentlist&quot;&gt;
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$comment</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		&lt;li class=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$oddcomment</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; id=&quot;comment-<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_author_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> on
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_approved</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'0'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;em&gt;Your comment is awaiting moderation.&lt;/em&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</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> comment_date<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_time<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> <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> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			&lt;div class=&quot;commenttext&quot;&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> comment_text<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/div&gt;
&nbsp;
		&lt;/li&gt;
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #666666; font-style: italic;">/* Changes every other comment to a different class */</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'alt'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$oddcomment</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$oddcomment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #000088;">$oddcomment</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'alt'</span><span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endforeach</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">/* end for each comment */</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	&lt;/ol&gt;
&nbsp;
 <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// this is displayed if there are no comments so far ?&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;!-- If comments are open, but there are no comments. --&gt;
&nbsp;
	 <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// comments are closed ?&gt;</span>
		&lt;!-- If comments are closed. --&gt;
		&lt;p class=&quot;nocomments&quot;&gt;Comments are closed.&lt;/p&gt;&lt;/div&gt;
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</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;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'open'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comment_status</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;p id=&quot;respond&quot;&gt;&lt;b&gt;Leave a Reply&lt;/b&gt;&lt;/p&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comment_registration'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$user_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;p&gt;You must be &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'siteurl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/wp-login.php?redirect_to=<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;logged in&lt;/a&gt; to post a comment.&lt;/p&gt;&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'siteurl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/wp-comments-post.php&quot; method=&quot;post&quot; id=&quot;commentform&quot;&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;p&gt;Logged in as &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'siteurl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/wp-admin/profile.php&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$user_identity</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;. &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'siteurl'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/wp-login.php?action=logout&quot; title=&quot;Log out of this account&quot;&gt;Logout &amp;raquo;&lt;/a&gt;&lt;/p&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;p&gt;&lt;label for=&quot;author&quot;&gt;Name <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$req</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;(required)&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/label&gt;&lt;br /&gt;
&lt;input type=&quot;text&quot; name=&quot;author&quot; id=&quot;author&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$comment_author</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; size=&quot;40&quot; tabindex=&quot;1&quot; /&gt;&lt;/p&gt;
&nbsp;
&lt;p&gt;&lt;label for=&quot;email&quot;&gt;Email Address<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$req</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;(required)&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/label&gt;&lt;br /&gt;
&lt;input type=&quot;text&quot; name=&quot;email&quot; id=&quot;email&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$comment_author_email</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; size=&quot;40&quot; tabindex=&quot;2&quot; /&gt;&lt;/p&gt;
&nbsp;
&lt;p&gt;&lt;label for=&quot;url&quot;&gt;Website&lt;/label&gt;&lt;br /&gt;
&lt;input type=&quot;text&quot; name=&quot;url&quot; id=&quot;url&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$comment_author_url</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; size=&quot;40&quot; tabindex=&quot;3&quot; /&gt;&lt;/p&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;!--&lt;p&gt;&lt;small&gt;&lt;strong&gt;XHTML:&lt;/strong&gt; You can use these tags: <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> allowed_tags<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/small&gt;&lt;/p&gt;--&gt;
&nbsp;
&lt;p&gt;&lt;textarea name=&quot;comment&quot; id=&quot;comment&quot; cols=&quot;50&quot; rows=&quot;10&quot; tabindex=&quot;4&quot;&gt;&lt;/textarea&gt;&lt;/p&gt;
&nbsp;
&lt;p&gt;&lt;input name=&quot;submit&quot; type=&quot;submit&quot; id=&quot;submit&quot; tabindex=&quot;5&quot; value=&quot;Submit Comment&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;comment_post_ID&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;&lt;/p&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> do_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comment_form'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</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: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;/form&gt;
&lt;/div&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// If registration required and not logged in ?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// if you delete this the sky will fall on your head ?&gt;</span></pre></td></tr></table></div>

<p>Since I changed it, I am not having injections for a month.</p>
<p>Moreover, I found <a target = "_blank" href="http://bloggingpilots.com/news/?p=3">a couple</a> of <a href="http://richapps.de/?p=1" target = "_blank">sites</a> using the same theme reporting an hack attack.</p>
<p>Any security hero willing to tell us if I am right? Of if it&#8217;s just a coincidence and hackers simply decided to leave me alone?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/05/05/war-to-hackers-the-aftermath/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Loading WP posts with Ajax and jQuery &#8211; a real world example</title>
		<link>http://www.emanueleferonato.com/2010/04/06/loading-wordpress-posts-with-ajax-and-jquery-a-real-world-example/</link>
		<comments>http://www.emanueleferonato.com/2010/04/06/loading-wordpress-posts-with-ajax-and-jquery-a-real-world-example/#comments</comments>
		<pubDate>Tue, 06 Apr 2010 21:28:26 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2677</guid>
		<description><![CDATA[If you are looking for a real world example made with Loading WordPress posts with Ajax and jQuery or you haven&#8217;t played LineBall yet, or you played it, you loved it and you want to know who made the music, this is the right blog post. I am finishing and polishing LineBall&#8217;s official site built [...]]]></description>
			<content:encoded><![CDATA[<p>If you are looking for a real world example made with <a href="http://www.emanueleferonato.com/2010/04/01/loading-wordpress-posts-with-ajax-and-jquery/">Loading WordPress posts with Ajax and jQuery</a> or you haven&#8217;t played <a href="http://www.emanueleferonato.com/2010/03/29/lineball-flash-game-sponsored-and-released/">LineBall</a> yet, or you played it, you loved it and you want to know who made the music, this is the right blog post.</p>
<p>I am finishing and polishing <a href="http://www.lineball-game.com/" target = "_blank">LineBall&#8217;s official site</a> built with WordPress and Ajax.</p>
<p>I plan to finish it before this week ends, then release the theme next week. So if you have suggestions, feedback or want more information, this is your turn.</p>
<p>Help me to make the ultimate WordPress Flash game theme.</p>
<p>Some features already developed:</p>
<p>* Highly customizable by setup page &#8211; no need to edit the code</p>
<p>* Ajax powered to browse it without reloading the header (the game itself)</p>
<p>* Minimal theme, a very few lines of code</p>
<p>Let me know what do you think about it. And don&#8217;t pay that much attention to contents&#8230; I just wrote a couple of lines just to make some tests</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/04/06/loading-wordpress-posts-with-ajax-and-jquery-a-real-world-example/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Loading WordPress posts with Ajax and jQuery</title>
		<link>http://www.emanueleferonato.com/2010/04/01/loading-wordpress-posts-with-ajax-and-jquery/</link>
		<comments>http://www.emanueleferonato.com/2010/04/01/loading-wordpress-posts-with-ajax-and-jquery/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 21:52:41 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2650</guid>
		<description><![CDATA[After seeing how to include jQuery Ajax calls in your WordPress blog, it&#8217;s time to load posts on the fly, without reloading the page. As for the previous example I am using the standard Kubrick theme&#8230; without any plugin installed. Look how I load the posts under the header by clicking on their titles&#8230; even [...]]]></description>
			<content:encoded><![CDATA[<p>After seeing <a href="http://www.emanueleferonato.com/2010/03/30/including-jquery-ajax-calls-in-your-wordpress-blog/">how to include jQuery Ajax calls in your WordPress blog</a>, it&#8217;s time to load posts on the fly, without reloading the page.</p>
<p>As for the previous example I am using the standard Kubrick theme&#8230; without any plugin installed.</p>
<p>Look how I load the posts under the header by clicking on their titles&#8230; even the ones with &#8220;more&#8221; tag appear complete without reloading the page:</p>
<p><object width="520" height="417"><param name="movie" value="http://www.youtube.com/v/_q7tKTn_z9s&#038;hl=it_IT&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/_q7tKTn_z9s&#038;hl=it_IT&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="520" height="417"></embed></object></p>
<p>Let&#8217;s start with <code>header.php</code> modifications</p>
<p>This is the script I added under</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_head<span style="color: #009900;">&#40;</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>That is the JQuery part<span id="more-2650"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">ajaxSetup</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>cache<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;h2 a&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> post_id <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;rel&quot;</span><span style="color: #009900;">&#41;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#your_post_here&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;loading...&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#your_post_here&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;http://&lt;?php echo $_SERVER[HTTP_HOST]; ?&gt;/triqui-ajax/&quot;</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>id<span style="color: #339933;">:</span>post_id<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>I already explained the first 4 lines in the <a href="http://www.emanueleferonato.com/2010/03/30/including-jquery-ajax-calls-in-your-wordpress-blog/">previous tutorial</a>.</p>
<p><strong>Line 5</strong>: Waiting for the user to click on an hypertext over an <code>h2</code> heading. I am doing it because in Kubrick post titles are rendered this way:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;h2&gt;&lt;a href=&quot;&lt;?php the_permalink() ?&gt;&quot;....</pre></div></div>

<p>This should change from theme to theme, but this works on Kubrick</p>
<p><strong>Line 6</strong>: Retrieving the <code>rel</code> attribute of the link and saving it in a variable called <code>post_id</code>. You&#8217;ll see later in this tutorial how this attribute will contain the unique ID of the post we want to show.</p>
<p><strong>Line 7</strong>: In an element with <code>your_post_here</code> id I am writing &#8220;loading&#8230;&#8221; because I&#8217;m starting to load the post. You&#8217;ll see later in this tutorial where to place the element</p>
<p><strong>Line 8</strong>: Now thw ajax magic&#8230; in the <code>your_post_here</code> element this time I load the output of a page of the blog called <code>triqui-ajax</code>. You&#8217;ll se later in this tutorial how to create it. This will work if the permalinks of your blog aren&#8217;t the default ones. Go to <code>Settings</code> -> <code>Permalinks</code> and select <code>Day and name</code></p>
<p><img src="/wp-content/uploads/2010/04/wp_ajax_2.jpg" alt="" /></p>
<p>I am also passing in <code>POST</code> a variable called <code>id</code> with the content of <code>post_id</code> variable (the post unique id)</p>
<p><strong>Line 9</strong>: I added this line to prevent the browser to jump to the link&#8230; remember? I want to load the post in the same page.</p>
<p>Now it&#8217;s time to make some changes to <code>index.php</code></p>
<p>This is how I modified it:</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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * @package WordPress
 * @subpackage Default_Theme
 */</span>
&nbsp;
get_header<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	&lt;div id=&quot;content&quot; class=&quot;narrowcolumn&quot; role=&quot;main&quot;&gt;
	&lt;div id = &quot;your_post_here&quot;&gt;&lt;/div&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</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> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		<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: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			&lt;div <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
				&lt;h2&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;Permanent Link to <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title_attribute<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/h2&gt;
				&lt;small&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;!-- by <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> --&gt;&lt;/small&gt;
&nbsp;
				&lt;div class=&quot;entry&quot;&gt; 
					<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Read the rest of this entry &amp;raquo;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;/div&gt;
&nbsp;
				&lt;p class=&quot;postmetadata&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_tags<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Tags: '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> Posted in <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_category<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> | <span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_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> <span style="color: #000000; font-weight: bold;">?&gt;</span>  <span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_popup_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No Comments &amp;#187;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1 Comment &amp;#187;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'% Comments &amp;#187;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
			&lt;/div&gt;
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		&lt;div class=&quot;navigation&quot;&gt;
			&lt;div class=&quot;alignleft&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> next_posts_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;laquo; Older Entries'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
			&lt;div class=&quot;alignright&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> previous_posts_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Newer Entries &amp;raquo;'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
		&lt;/div&gt;
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		&lt;h2 class=&quot;center&quot;&gt;Not Found&lt;/h2&gt;
		&lt;p class=&quot;center&quot;&gt;Sorry, but you are looking for something that isn't here.&lt;/p&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_search_form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	&lt;/div&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_sidebar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> get_footer<span style="color: #009900;">&#40;</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>

<p>To tell the truth, I only added a line and changed a bit another one:</p>
<p><strong>Line 10</strong>: This is the div that will contain the post, the one I change with jQuery (remember? <strong>lines 7</strong> and <strong>8</strong> in the jQuery script)</p>
<p><strong>Line 16</strong>: Here I changed the <code>rel</code> attribute to store the unique id of the post I want to load. I used it at <strong>line 6</strong> in the jQuery script</p>
<p>And the template files do not need any other change.</p>
<p>Now it&#8217;s time to create a new page template with some code that will load the selected post.</p>
<p>In your template directory create a new php file, no matter its name&#8230; you can call it <code>example.php</code> and write this:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*
Template Name: Triqui Ajax Post
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> get_post<span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</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;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</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> setup_postdata<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;div <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
		&lt;h2&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
		&lt;small&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'F jS, Y'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;!-- by <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_author<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> --&gt;&lt;/small&gt;
&nbsp;
		&lt;div class=&quot;entry&quot;&gt; 
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Read the rest of this entry &amp;raquo;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		&lt;/div&gt;
&nbsp;
		&lt;p class=&quot;postmetadata&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_tags<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Tags: '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> Posted in <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_category<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> | <span style="color: #000000; font-weight: bold;">&lt;?php</span> edit_post_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> <span style="color: #000000; font-weight: bold;">?&gt;</span>  <span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_popup_link<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No Comments &amp;#187;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1 Comment &amp;#187;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'% Comments &amp;#187;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
	&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>As you can see it&#8217;s almost the same code you can find in <code>index.php</code> at <strong>lines 15-24</strong>&#8230; because I just want to load a post in the same way the index file does. I just removed the anchor tag in the title, because I don&#8217;t want it to be clickable. And obviously I read the <code>id</code> value passed by the jQuery script at <strong>line 8</strong></p>
<p>The only interesting lines are <strong>lines 2-4</strong>&#8230; yes, the comment&#8230; because this way I am giving the template page the name <code>Triqui Ajax Post</code>.</p>
<p>Now in your admin area create a new page, call it <code>Triqui Ajax</code> (do you remember the permalink url at <strong>line 8</strong> in the jQuery script&#8230;) and select <code>Triqui Ajax Post</code> as template</p>
<p><img src="/wp-content/uploads/2010/04/wp_ajax.jpg" alt="" /></p>
<p>And that&#8217;s it&#8230; you don&#8217;t need anything else, and the blog will work as in the video.</p>
<p>Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/04/01/loading-wordpress-posts-with-ajax-and-jquery/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Including jQuery Ajax calls in your WordPress blog</title>
		<link>http://www.emanueleferonato.com/2010/03/30/including-jquery-ajax-calls-in-your-wordpress-blog/</link>
		<comments>http://www.emanueleferonato.com/2010/03/30/including-jquery-ajax-calls-in-your-wordpress-blog/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 15:33:46 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2637</guid>
		<description><![CDATA[I want to show you how to include jQuery ajax calls in your WordPress blog. The reason is simple: sometimes you may need to update the content of a WP page without reloading the entire page. This is useful when you want the user to interact with your blog without forcing him to reload the [...]]]></description>
			<content:encoded><![CDATA[<p>I want to show you how to include jQuery ajax calls in your WordPress blog.</p>
<p>The reason is simple: sometimes you may need to update the content of a WP page without reloading the entire page.</p>
<p>This is useful when you want the user to interact with your blog without forcing him to reload the page. Or when you want some events to happen &#8220;automatically&#8221; without user interaction.</p>
<p>In this video I am changing the header at every second without reloading the page.</p>
<p><object width="520" height="420"><param name="movie" value="http://www.youtube.com/v/DbEC5qjlS8E&#038;hl=it&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/DbEC5qjlS8E&#038;hl=it&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="520" height="420"></embed></object></p>
<p>Also notice I am doing it from the default Kubrick theme with a fresh installation&#8230; I am not using any jQuery powered theme or plugin. Let&#8217;s see how can you make it.<span id="more-2637"></span></p>
<p>In this case all changes have been made in <code>header.php</code> file, adding nine lines after</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_head<span style="color: #009900;">&#40;</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>Here they are:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
	$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	$.<span style="color: #660066;">ajaxSetup</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>cache<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> refresh <span style="color: #339933;">=</span> setInterval<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>   	
		$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#description_span&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;?php bloginfo('template_url'); ?&gt;/example.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>First, I am loading jQuery using Google as content delivery network.</p>
<p>Then, when the document is ready, I disable the cache to stop jQuery <code>.load</code> response from being cached.</p>
<p>Now I just execute an ajax call to <code>example.php</code> file at every second and print the result in the element with <code>description_span</code> id</p>
<p>This is <code>example.php</code> content</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">10000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Now it&#8217;s time to locate <code>description_span</code> element&#8230; it&#8217;s in the header, next to the description of the blog.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;description&quot;&gt;&lt;?php bloginfo('description'); ?&gt; like other &lt;span id = &quot;description_span&quot;&gt;&lt;/span&gt; ones&lt;/div&gt;</pre></div></div>

<p>And that&#8217;s it. This time I changed the header without touching the content, next time (the aim of my experiment) I&#8217;ll change the content without touching the header, maybe because the header contains a Flash game called <a href="http://www.emanueleferonato.com/2010/03/29/lineball-flash-game-sponsored-and-released/">LineBall</a>&#8230; (yes, I am designing a WP theme for a game official site).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/03/30/including-jquery-ajax-calls-in-your-wordpress-blog/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>My epic fail with ClickBank</title>
		<link>http://www.emanueleferonato.com/2010/03/15/my-epic-fail-with-clickbank/</link>
		<comments>http://www.emanueleferonato.com/2010/03/15/my-epic-fail-with-clickbank/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 20:23:09 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Monetize]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2526</guid>
		<description><![CDATA[Are you tired of reading about success stories with people making over $20K a day? Here&#8217;s something new: did you notice, during this month, two ads about Farmville secrets and iPhone application development? Here they are: These two ads belong to ClickBank, an ad network which at the moment made its clients earn more than [...]]]></description>
			<content:encoded><![CDATA[<p>Are you tired of reading about success stories with people making over $20K a day?</p>
<p>Here&#8217;s something new: did you notice, during this month, two ads about Farmville secrets and iPhone application development? Here they are:</p>
<p><img src="/wp-content/uploads/2010/03/cb03.png" /></p>
<p>These two ads belong to <a href="http://www.clickbank.com/" target = "_blank">ClickBank</a>, an ad network which at the moment made its clients earn more than a billion dollars.</p>
<p>As you can see in these two pictures, I did not earn a cent.</p>
<p><img src="/wp-content/uploads/2010/03/cb02.png" /></p>
<p><img src="/wp-content/uploads/2010/03/cb01.png" /></p>
<p>Let&#8217;s see what happened:</p>
<p><strong>The reasons behind a failure</strong></p>
<p>When I signed up at <a href="http://www.clickbank.com/" target = "_blank">ClickBank</a>, I obviously decided to display ads having something to do with my blog&#8230; this means programming, gaming or monetizing.</p>
<p>The most &#8220;interesting&#8221; products I was able to find were:</p>
<p>* A couple of registry cleaners (??)<br />
* A couple of PS3 scam backup system (scam because you won&#8217;t be able to play with your backups)<br />
* A dozen ebooks about the ULTIMATE (yeah) way to make money with a blog, or with ebay, or whatsoever<br />
* Some hosting services</p>
<p>The first question was: did I really want my readers to buy a useless PS3 backup system? Come on&#8230;</p>
<p>So i opted for a FarmVille guide, even if I am not a FarmVille fan and I hate people posting on Facebook they just found a cripple blind sheep in their damned banana field. All in all FV is a great viral game and I thought a guide would be useful for some addicted players.</p>
<p>The other choice was a guide to iPhone programming&#8230; why not&#8230; I have a lot of programmers among blog readers.</p>
<p><strong>Why it did not work</strong></p>
<p>Well, every blog has its niche readers. Programmers are quite smart&#8230; unlike blogging mogul wannabes, they won&#8217;t buy anything from one-page websites claiming to sell the &#8220;Ultimate Guide to [put your favorite topic here, obviously all uppercase]&#8221;</p>
<p>People like you are looking for real deals from real companies, supported by real case studies&#8230; that&#8217;s why I was <a href="http://www.emanueleferonato.com/2008/01/29/who-refers-wins/">one of the three</a> most important <a href="https://www.mochimedia.com/r/972ae333a3c92a2a" target = "_blank">MochiAds</a> referral while I wasn&#8217;t able to sell a single ClickBank guide.</p>
<p><strong>So it was a waste of time. Wait. It wasn&#8217;t</strong></p>
<p>Thanks to my experience, if you have a programming blog you can improve your ads revenue looking for products you can really review, test and suggest, leaving &#8220;ultimate guides&#8221; to newbies.</p>
<p>This obviously is my personal story, and results may vary according to the niche you&#8217;re talking at.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/03/15/my-epic-fail-with-clickbank/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Triqui MochiAds Arcade plugin for WordPress upgraded to 1.2</title>
		<link>http://www.emanueleferonato.com/2010/02/26/triqui-mochiads-arcade-plugin-for-wordpress-upgraded-to-1-2/</link>
		<comments>http://www.emanueleferonato.com/2010/02/26/triqui-mochiads-arcade-plugin-for-wordpress-upgraded-to-1-2/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 11:03:48 +0000</pubDate>
		<dc:creator>Emanuele Feronato</dc:creator>
				<category><![CDATA[Monetize]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.emanueleferonato.com/?p=2443</guid>
		<description><![CDATA[Yesterday MochiMedia changed the games feed adding a new field called metascore that screwed the feed parsing. So I am releasing the new version, compatible with the new feed and tested with WordPress 2.9.2. You can find it at the official page. Talking about plugins, I am developing a new theme/plugin using crontables that automatically [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday <a href="https://www.mochimedia.com/r/972ae333a3c92a2a" target = "_blank">MochiMedia</a> changed the games feed adding a new field called <code>metascore</code> that screwed the feed parsing.</p>
<p>So I am releasing the new version, compatible with the new feed and tested with WordPress 2.9.2. You can find it at the <a href="http://www.emanueleferonato.com/triqui-mochiads-arcade-plugin-for-wordpress-official-page/">official page</a>.</p>
<p>Talking about plugins, I am developing a new theme/plugin using crontables that automatically feeds the games, fixes the tables if <a href="https://www.mochimedia.com/r/972ae333a3c92a2a" target = "_blank">MochiMedia</a> updates the feed, and chooses the best games to publish.</p>
<p>Everything without any interaction from the user. The ultimate &#8220;forget about it and make money with your arcade site&#8221; plugin.</p>
<p>Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.emanueleferonato.com/2010/02/26/triqui-mochiads-arcade-plugin-for-wordpress-upgraded-to-1-2/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>
