<?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>inditetheweb.com&#187; WordPress Tips and Tricks | Indite the Web | Web Development Tips, Tricks, and Tutorials</title>
	<atom:link href="http://www.inditetheweb.com/category/tips-and-tricks/wordpress-tips-and-tricks/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.inditetheweb.com</link>
	<description>Web Development Tips, Tricks, and Tutorials</description>
	<lastBuildDate>Wed, 11 Nov 2009 17:57:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Displaying Ads After Selected Number of Posts In WordPress</title>
		<link>http://www.inditetheweb.com/2009/04/displaying-ads-after-selected-number-of-posts-in-wordpress/</link>
		<comments>http://www.inditetheweb.com/2009/04/displaying-ads-after-selected-number-of-posts-in-wordpress/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 14:15:53 +0000</pubDate>
		<dc:creator>Kate</dc:creator>
				<category><![CDATA[WordPress Tips and Tricks]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.inditetheweb.com/?p=131</guid>
		<description><![CDATA[At wphacks.com, I found a solution for displaying ads after the first post only.  I had thought about using it, as it would&#8217;ve worked fine for the project I needed it on.  But, I decided to use a counter instead as I thought it would be more flexible.  For instance, what if [...]]]></description>
			<content:encoded><![CDATA[<p>At <a href="http://wphacks.com/how-to-insert-ads-only-after-the-first-post/" onclick="window.open('http://wphacks.com/how-to-insert-ads-only-after-the-first-post');return false;">wphacks.com</a>, I found a solution for displaying ads after the first post only.  I had thought about using it, as it would&#8217;ve worked fine for the project I needed it on.  But, I decided to use a counter instead as I thought it would be more flexible.  For instance, what if you want the ad to appear after the second post&#8230; or after the third post?  The following code worked good for me, and I hope it does the same for you:</p>
<p><code></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">/*Code to initiate counter goes above the loop*/
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #666666; font-style: italic;">/*Initiate counter for post ads*/</span>
    <span style="color: #000088;">$counterAd</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
/*Start of loop followed by post content here*/
&nbsp;
/*Before the end of the loop, insert the ad code and counter incrementation:*/
<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;">$counterAd</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #666666; font-style: italic;">/*If $counterAd = 1 that means this is just after the first post.  If so, print ad.*/</span>
<span style="color: #666666; font-style: italic;">/*NOTE: Alternatively you could change the one to be whichever post you'd like the ad to display after.*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
	 &lt;!-- Ad Code Goes Here --&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>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/*Increment counter*/</span>
<span style="color: #000088;">$counterAd</span> <span style="color: #339933;">++;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.inditetheweb.com/2009/04/displaying-ads-after-selected-number-of-posts-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
