<?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/"
	
	xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Twitter&#8217;s New Tweet Button and the Count API</title>
	<atom:link href="http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/feed/" rel="self" type="application/rss+xml" />
	<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/</link>
	<description>You have to use an Ottopress to get fresh squeezed Otto.</description>
	<lastBuildDate>Mon, 20 May 2013 01:52:01 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.6-beta3-24284</generator>
	<item>
		<title>By: tweet counter</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-11813</link>
		<dc:creator>tweet counter</dc:creator>
		<pubDate>Mon, 29 Apr 2013 08:57:56 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-11813</guid>
		<description><![CDATA[how accurate is this api? i read somewhere that sometimes return wrong number of tweet count.]]></description>
		<content:encoded><![CDATA[<p>how accurate is this api? i read somewhere that sometimes return wrong number of tweet count.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Martin B.</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-11022</link>
		<dc:creator>Martin B.</dc:creator>
		<pubDate>Mon, 02 Jul 2012 16:51:48 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-11022</guid>
		<description><![CDATA[Wouldn&#039;t a site like nytimes.com for example generate tens if not hundreds of thousands of calls to that from the same IP per day (OK, less per url argument, but still..).]]></description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t a site like nytimes.com for example generate tens if not hundreds of thousands of calls to that from the same IP per day (OK, less per url argument, but still..).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Winterstein</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-10663</link>
		<dc:creator>Daniel Winterstein</dc:creator>
		<pubDate>Thu, 15 Mar 2012 12:02:20 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-10663</guid>
		<description><![CDATA[Good find - thank you for posting that!

I&#039;ve added support for this to &lt;a href=&quot;http://www.winterwell.com/software/jtwitter.php&quot; rel=&quot;nofollow&quot;&gt;Jtwitter&lt;/a&gt;, the Java library for Twitter which I maintain.]]></description>
		<content:encoded><![CDATA[<p>Good find &#8211; thank you for posting that!</p>
<p>I&#8217;ve added support for this to <a href="http://www.winterwell.com/software/jtwitter.php" rel="nofollow">Jtwitter</a>, the Java library for Twitter which I maintain.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Xia</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-10498</link>
		<dc:creator>David Xia</dc:creator>
		<pubDate>Mon, 06 Feb 2012 16:36:40 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-10498</guid>
		<description><![CDATA[This is a great find and writeup. Thanks.]]></description>
		<content:encoded><![CDATA[<p>This is a great find and writeup. Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ray</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-10151</link>
		<dc:creator>Ray</dc:creator>
		<pubDate>Tue, 15 Nov 2011 19:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-10151</guid>
		<description><![CDATA[GENIUS!! Thanks so much. I actually pasted the wrong if/else statement in the topic above. My problem was the_permalink vs. get_permalink. Thanks again!]]></description>
		<content:encoded><![CDATA[<p>GENIUS!! Thanks so much. I actually pasted the wrong if/else statement in the topic above. My problem was the_permalink vs. get_permalink. Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-10149</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Tue, 15 Nov 2011 19:44:33 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-10149</guid>
		<description><![CDATA[Yes, you&#039;re missing two things.

One is that your if and else (on the $count==0) have the same code in them.

Second is that this line of code is wrong:

[php]
&lt;?php $count = get_tweet_count(the_permalink()); ?&gt;
[/php]

The the_permalink() function echo&#039;s the permalink to the output. It does not return it as a string to be passed to another function. Change that line to this:

[php]
&lt;?php $count = get_tweet_count(get_permalink()); ?&gt;
[/php]]]></description>
		<content:encoded><![CDATA[<p>Yes, you&#8217;re missing two things.</p>
<p>One is that your if and else (on the $count==0) have the same code in them.</p>
<p>Second is that this line of code is wrong:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php $count = get_tweet_count(the_permalink()); ?&gt;
</pre>
<p>The the_permalink() function echo&#8217;s the permalink to the output. It does not return it as a string to be passed to another function. Change that line to this:</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php $count = get_tweet_count(get_permalink()); ?&gt;
</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ray</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-10148</link>
		<dc:creator>Ray</dc:creator>
		<pubDate>Tue, 15 Nov 2011 19:39:09 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-10148</guid>
		<description><![CDATA[Thanks for the reply and feedback.

This is the code I have for my Wordpress loop and function:

LOOP
[php]
&lt;!-- TWEET BUTTON - HIDE COUNT IF THE COUNT IS 0 --&lt;
&lt;?php $count = get_tweet_count(the_permalink()); ?&gt;
&lt;?php if ($count == 0){ ?&gt;
	&lt;script src=&quot;http://platform.twitter.com/widgets.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
	&lt;a href=&quot;http://twitter.com/share&quot; class=&quot;twitter-share-button&quot;
	  data-url=&quot;&lt;?php the_permalink(); ?&gt;&quot;
	  data-via=&quot;TITLE&quot;
	  data-text=&quot;&lt;?php the_title(); ?&gt;&quot;
	  data-related=&quot;&quot;
	  data-count=&quot;horizontal&quot;&gt;Tweet&lt;/a&gt;							
&lt;?php } else { ?&gt;
	&lt;script src=&quot;http://platform.twitter.com/widgets.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
	&lt;a href=&quot;http://twitter.com/share&quot; class=&quot;twitter-share-button&quot;
	  data-url=&quot;&lt;?php the_permalink(); ?&gt;&quot;
	  data-via=&quot;TITLE&quot;
	  data-text=&quot;&lt;?php the_title(); ?&gt;&quot;
	  data-related=&quot;&quot;
	  data-count=&quot;horizontal&quot;&gt;Tweet&lt;/a&gt;							
&lt;?php } ?&gt;
[/php]

FUNCTION
[php]
function get_tweet_count($url) {
	$count = 0;
	$data = wp_remote_get(&#039;ht&#039;.&#039;tp://urls.api.twitter.com/1/urls/count.json?url=&#039;.urlencode($url) );
	if (!is_wp_error($data)) {
		$resp = json_decode($data[&#039;body&#039;],true);
		if ($resp[&#039;count&#039;]) $count = $resp[&#039;count&#039;];
	}
	return $count;
}
?&gt;
[/php]

It always returns 0. Am I missing something?]]></description>
		<content:encoded><![CDATA[<p>Thanks for the reply and feedback.</p>
<p>This is the code I have for my WordPress loop and function:</p>
<p>LOOP</p>
<pre class="brush: php; title: ; notranslate">
&lt;!-- TWEET BUTTON - HIDE COUNT IF THE COUNT IS 0 --&lt;
&lt;?php $count = get_tweet_count(the_permalink()); ?&gt;
&lt;?php if ($count == 0){ ?&gt;
	&lt;script src=&quot;<a href="http://platform.twitter.com/widgets.js&#038;quot" rel="nofollow">http://platform.twitter.com/widgets.js&#038;quot</a>; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
	&lt;a href=&quot;<a href="http://twitter.com/share&#038;quot" rel="nofollow">http://twitter.com/share&#038;quot</a>; class=&quot;twitter-share-button&quot;
	  data-url=&quot;&lt;?php the_permalink(); ?&gt;&quot;
	  data-via=&quot;TITLE&quot;
	  data-text=&quot;&lt;?php the_title(); ?&gt;&quot;
	  data-related=&quot;&quot;
	  data-count=&quot;horizontal&quot;&gt;Tweet&lt;/a&gt;							
&lt;?php } else { ?&gt;
	&lt;script src=&quot;<a href="http://platform.twitter.com/widgets.js&#038;quot" rel="nofollow">http://platform.twitter.com/widgets.js&#038;quot</a>; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;
	&lt;a href=&quot;<a href="http://twitter.com/share&#038;quot" rel="nofollow">http://twitter.com/share&#038;quot</a>; class=&quot;twitter-share-button&quot;
	  data-url=&quot;&lt;?php the_permalink(); ?&gt;&quot;
	  data-via=&quot;TITLE&quot;
	  data-text=&quot;&lt;?php the_title(); ?&gt;&quot;
	  data-related=&quot;&quot;
	  data-count=&quot;horizontal&quot;&gt;Tweet&lt;/a&gt;							
&lt;?php } ?&gt;
</pre>
<p>FUNCTION</p>
<pre class="brush: php; title: ; notranslate">
function get_tweet_count($url) {
	$count = 0;
	$data = wp_remote_get('ht'.'tp://urls.api.twitter.com/1/urls/count.json?url='.urlencode($url) );
	if (!is_wp_error($data)) {
		$resp = json_decode($data['body'],true);
		if ($resp['count']) $count = $resp['count'];
	}
	return $count;
}
?&gt;
</pre>
<p>It always returns 0. Am I missing something?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-10146</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Tue, 15 Nov 2011 19:32:26 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-10146</guid>
		<description><![CDATA[Tested, and the function works correctly as far as I can see.]]></description>
		<content:encoded><![CDATA[<p>Tested, and the function works correctly as far as I can see.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ray</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-10145</link>
		<dc:creator>Ray</dc:creator>
		<pubDate>Tue, 15 Nov 2011 15:51:59 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-10145</guid>
		<description><![CDATA[This is so cool! However, when I use your function in Wordpress it returns a count of 0 every time. I can check it manually and see that I have a count but the function always returns 0. What am I missing?]]></description>
		<content:encoded><![CDATA[<p>This is so cool! However, when I use your function in WordPress it returns a count of 0 every time. I can check it manually and see that I have a count but the function always returns 0. What am I missing?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Lorensson</title>
		<link>http://ottopress.com/2010/twitters-new-tweet-button-and-the-count-api/comment-page-1/#comment-9316</link>
		<dc:creator>Chris Lorensson</dc:creator>
		<pubDate>Tue, 26 Jul 2011 08:39:22 +0000</pubDate>
		<guid isPermaLink="false">http://ottopress.com/?p=225#comment-9316</guid>
		<description><![CDATA[Hi mate, I&#039;m using Wordpress and I pasted your function into my functions.php file, then your &lt;code&gt;$count = get_tweet_count(get_the_permalink())&lt;/code&gt; but it gave an error: &lt;code&gt;Fatal error: Call to undefined function get_the_permalink()&lt;/code&gt; so I google&#039;d it and got &lt;a href=&quot;http://wordpress.org/support/topic/get_the_permalink-not-working&quot; rel=&quot;nofollow&quot;&gt;this post&lt;/a&gt;, which says to use &lt;code&gt;$permalink = get_permalink($post-&gt;ID);&lt;/code&gt; instead, but I&#039;m not much of a PHP guru and don&#039;t know where to put that. At the moment I&#039;ve got &lt;code&gt;&lt;/code&gt; inside the loop in index.php but it&#039;s not returning anything.

Can you help?]]></description>
		<content:encoded><![CDATA[<p>Hi mate, I&#8217;m using WordPress and I pasted your function into my functions.php file, then your <code>$count = get_tweet_count(get_the_permalink())</code> but it gave an error: <code>Fatal error: Call to undefined function get_the_permalink()</code> so I google&#8217;d it and got <a href="http://wordpress.org/support/topic/get_the_permalink-not-working" rel="nofollow">this post</a>, which says to use <code>$permalink = get_permalink($post-&gt;ID);</code> instead, but I&#8217;m not much of a PHP guru and don&#8217;t know where to put that. At the moment I&#8217;ve got <code></code> inside the loop in index.php but it&#8217;s not returning anything.</p>
<p>Can you help?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Object Caching 429/476 objects using xcache

 Served from: ottodestruct.com @ 2013-05-21 02:41:27 by W3 Total Cache -->