<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Using a Functions file</title>
	<atom:link href="http://www.bloggingtips.com/2009/01/04/using-a-functions-file/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/</link>
	<description>Blog Themes, Blog Design &#38; Daily Blog Tips</description>
	<lastBuildDate>Wed, 08 Feb 2012 15:16:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Sarah</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316262</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Tue, 06 Jan 2009 16:33:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316262</guid>
		<description>Glad to hear it worked :)  As for code in comments, with the code tag you can&#039;t insert blank lines, else WordPress automatically decides it&#039;s a paragraph and it all falls apart! </description>
		<content:encoded><![CDATA[<p>Glad to hear it worked <img src='http://www.bloggingtips.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   As for code in comments, with the code tag you can&#39;t insert blank lines, else WordPress automatically decides it&#39;s a paragraph and it all falls apart!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316261</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 06 Jan 2009 16:20:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316261</guid>
		<description>(I can&#039;t figure out how to make code appear in the comments) </description>
		<content:encoded><![CDATA[<p>(I can&#39;t figure out how to make code appear in the comments)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316260</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 06 Jan 2009 16:19:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316260</guid>
		<description>Sarah, You are a rock star!! 
 
This works great: 
 
&lt;code&gt; 
function under_first_post_ad() {  
 
global $count; 
 
if ($count == 0) : { ?&gt;  
Adsense Code Goes Here 
&lt;?php } endif; $count++ ; } 
&lt;/code&gt; </description>
		<content:encoded><![CDATA[<p>Sarah, You are a rock star!!</p>
<p>This works great:</p>
<p>&lt;code&gt;</p>
<p>function under_first_post_ad() { </p>
<p>global $count;</p>
<p>if ($count == 0) : { ?&gt; </p>
<p>Adsense Code Goes Here</p>
<p>&lt;?php } endif; $count++ ; }</p>
<p>&lt;/code&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarah</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316259</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Tue, 06 Jan 2009 16:04:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316259</guid>
		<description>Have you got the counter set outside the function? It needs to be along the lines of 
 
&lt;code&gt;$count = 0; 
global $count; 
function under_first_post_ad() { 
if ($count == 0) : 
// adsense code here 
endif; 
$count++; 
}&lt;/code&gt; 
 
If that doesn&#039;t work that way, move the global $count into the function before the if statement. </description>
		<content:encoded><![CDATA[<p>Have you got the counter set outside the function? It needs to be along the lines of</p>
<p>&lt;code&gt;$count = 0;</p>
<p>global $count;</p>
<p>function under_first_post_ad() {</p>
<p>if ($count == 0) :</p>
<p>// adsense code here</p>
<p>endif;</p>
<p>$count++;</p>
<p>}&lt;/code&gt;</p>
<p>If that doesn&#39;t work that way, move the global $count into the function before the if statement.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316257</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 06 Jan 2009 15:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316257</guid>
		<description>Hi Sarah, 
 
Sorry to bother you again.  I went with your counter idea.  The following code works it I place it in the INDEX.PHP file before ENDWHILE.  But if I use it as a function it displays under every post.  Why would it behave differently as a function? 
 
&lt;code&gt; 
function under_first_post_ad() {  
 
if ($count == 0) : { ?&gt;  
Adsense Code Goes Here 
&lt;?php } endif; $count ; } 
&lt;/code&gt; </description>
		<content:encoded><![CDATA[<p>Hi Sarah,</p>
<p>Sorry to bother you again.  I went with your counter idea.  The following code works it I place it in the INDEX.PHP file before ENDWHILE.  But if I use it as a function it displays under every post.  Why would it behave differently as a function?</p>
<p>&lt;code&gt;</p>
<p>function under_first_post_ad() { </p>
<p>if ($count == 0) : { ?&gt; </p>
<p>Adsense Code Goes Here</p>
<p>&lt;?php } endif; $count ; }</p>
<p>&lt;/code&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316250</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 06 Jan 2009 08:57:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316250</guid>
		<description>Hi Sarah, 
 
The counter is a good idea.  Thank you so much for your help!!  Really great article. 
 
Thanks 
Steve </description>
		<content:encoded><![CDATA[<p>Hi Sarah,</p>
<p>The counter is a good idea.  Thank you so much for your help!!  Really great article.</p>
<p>Thanks</p>
<p>Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarah</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316235</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Mon, 05 Jan 2009 17:14:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316235</guid>
		<description>Hi Steve, 
 
As far as I&#039;m aware this can&#039;t be done via a div class as you need to use rely on a WP tag to attach the content to. What you could do is create a global counter and then if the counter is equal to 0 you attach the bookmark output, then increment the counter, then on the second post the counter will be 1 and you can then ignore the bookmark data after that. 
 
However, bear in mind, using the_content will also add the bookmark data to the single post pages too, however that&#039;s where you usually have it anyway. 
 
So in your functions file, outside of the function, create a counter and make it equal to zero, then set it as global. Then you can use this within the function. 
 
That&#039;s just a guess, sorry, it&#039;s a bit late here to start testing the code! Let me know if it works, if not I&#039;ll work out a better solution tomorrow :) </description>
		<content:encoded><![CDATA[<p>Hi Steve,</p>
<p>As far as I&#39;m aware this can&#39;t be done via a div class as you need to use rely on a WP tag to attach the content to. What you could do is create a global counter and then if the counter is equal to 0 you attach the bookmark output, then increment the counter, then on the second post the counter will be 1 and you can then ignore the bookmark data after that.</p>
<p>However, bear in mind, using the_content will also add the bookmark data to the single post pages too, however that&#39;s where you usually have it anyway.</p>
<p>So in your functions file, outside of the function, create a counter and make it equal to zero, then set it as global. Then you can use this within the function.</p>
<p>That&#39;s just a guess, sorry, it&#39;s a bit late here to start testing the code! Let me know if it works, if not I&#39;ll work out a better solution tomorrow <img src='http://www.bloggingtips.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316233</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 05 Jan 2009 16:51:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316233</guid>
		<description>Hi Sarah, 
 
Thank you for your quick response... your code worked perfectly!! 
 
However, I was wondering if this can be done on a div class?  I only want to show information under the first post in index.php.  Sandbox automatically assigns each post a numbered class; the first post is assign a &quot;p1&quot; class.  
 
How can I show something only under the p1 class? 
 
Thank you so much! 
Steve </description>
		<content:encoded><![CDATA[<p>Hi Sarah,</p>
<p>Thank you for your quick response&#8230; your code worked perfectly!!</p>
<p>However, I was wondering if this can be done on a div class?  I only want to show information under the first post in index.php.  Sandbox automatically assigns each post a numbered class; the first post is assign a &quot;p1&quot; class. </p>
<p>How can I show something only under the p1 class?</p>
<p>Thank you so much!</p>
<p>Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarah</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316230</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Mon, 05 Jan 2009 15:36:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316230</guid>
		<description>Hi Steve, you would need to use a filter hook as explained in the second section. I would say to use the_content as the hook as you want to insert your code right after this, so you would get the output from the_content and then just add the social bookmarks output to the end of it and then return the final output ie. in a nutshell: 
 
&lt;code&gt;add_filter (&#039;the_content&#039;, &#039;add_socialbm&#039;); 
function add_socialbm ($output) { 
    $socialbm_output = &quot;&quot;; // sort out your bookmark html 
    $new_output = $output . $socialbm_output; 
    return $new_output; 
}&lt;/code&gt; 
 
You&#039;d then just need to modify the code to create your social bookmark html code. 
 
Hope that makes sense, if not then post up in the forum where it&#039;s easier to write code! </description>
		<content:encoded><![CDATA[<p>Hi Steve, you would need to use a filter hook as explained in the second section. I would say to use the_content as the hook as you want to insert your code right after this, so you would get the output from the_content and then just add the social bookmarks output to the end of it and then return the final output ie. in a nutshell:</p>
<p>&lt;code&gt;add_filter (&#39;the_content&#39;, &#39;add_socialbm&#39;);</p>
<p>function add_socialbm ($output) {</p>
<p>    $socialbm_output = &quot;&quot;; // sort out your bookmark html</p>
<p>    $new_output = $output . $socialbm_output;</p>
<p>    return $new_output;</p>
<p>}&lt;/code&gt;</p>
<p>You&#39;d then just need to modify the code to create your social bookmark html code.</p>
<p>Hope that makes sense, if not then post up in the forum where it&#39;s easier to write code!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316229</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 05 Jan 2009 14:54:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316229</guid>
		<description>Hi Sarah, 
 
Great article.  I have a question for you: 
 
I want to use your social bookmarking code in a child theme for Sandbox.  Because it&#039;s a child I don&#039;t want to touch the Index.php file to add , I just want to make an additionally functions.php file.   
 
Sandbox automatically assigns the class &quot;post&quot; to each post div. How can I automatically add your code after a div with the class &quot;post&quot;, by only adding code to the functions.php file? 
 
Any help you can provide would be appreciated. 
 
Thanks 
Steve </description>
		<content:encoded><![CDATA[<p>Hi Sarah,</p>
<p>Great article.  I have a question for you:</p>
<p>I want to use your social bookmarking code in a child theme for Sandbox.  Because it&#39;s a child I don&#39;t want to touch the Index.php file to add , I just want to make an additionally functions.php file.  </p>
<p>Sandbox automatically assigns the class &quot;post&quot; to each post div. How can I automatically add your code after a div with the class &quot;post&quot;, by only adding code to the functions.php file?</p>
<p>Any help you can provide would be appreciated.</p>
<p>Thanks</p>
<p>Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sarah</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316205</link>
		<dc:creator>Sarah</dc:creator>
		<pubDate>Mon, 05 Jan 2009 03:28:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316205</guid>
		<description>Hi Dan, no problem. Yes I&#039;d use an id over a class, I think I was just sticking with class as the div was a class, but it&#039;s easily changed as you say :) </description>
		<content:encoded><![CDATA[<p>Hi Dan, no problem. Yes I&#39;d use an id over a class, I think I was just sticking with class as the div was a class, but it&#39;s easily changed as you say <img src='http://www.bloggingtips.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Schulz</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316193</link>
		<dc:creator>Dan Schulz</dc:creator>
		<pubDate>Sun, 04 Jan 2009 17:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316193</guid>
		<description>Thanks for letting me know about the update via DM on Twitter, Sarah.  (Of course, I prefer using an ID for the menu instead of a class, but that&#039;s a dead easy change to make.) </description>
		<content:encoded><![CDATA[<p>Thanks for letting me know about the update via DM on Twitter, Sarah.  (Of course, I prefer using an ID for the menu instead of a class, but that&#39;s a dead easy change to make.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WordPress: Using a Functions file :: Stuff by Sarah</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316185</link>
		<dc:creator>WordPress: Using a Functions file :: Stuff by Sarah</dc:creator>
		<pubDate>Sun, 04 Jan 2009 17:15:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316185</guid>
		<description>[...] the full post at Using a Functions file on [...]</description>
		<content:encoded><![CDATA[<p>[...] the full post at Using a Functions file on [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blog Expert</title>
		<link>http://www.bloggingtips.com/2009/01/04/using-a-functions-file/#comment-316184</link>
		<dc:creator>Blog Expert</dc:creator>
		<pubDate>Sun, 04 Jan 2009 11:47:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.bloggingtips.com/?p=5033#comment-316184</guid>
		<description>Really enjoyed the article.  I love great tutorials like this. </description>
		<content:encoded><![CDATA[<p>Really enjoyed the article.  I love great tutorials like this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

