Tag Archives: twitter

How to Add Twitter’s Official Tweet Button in WordPress using TinyUrl

It’s very simple to just add the official tweet button to your site, but if you have very long Search engine friendly URLs (see any post URL on this site) it can be a bit difficult!

To implement the tweet button with a short URL I used tinyurl, as unlike bit.ly you don’t need to create an account and the only data it sends back to you is the shortened URL.

The code should be implemented within the loop, you can even include it if you want to keep file sizes low.

//the url you want to make tiny
$maketiny = 'http://tinyurl.com/api-create.php?url='.get_permalink();

/*Initialise and set options for cURL
(this lets you transfer data between URLs)*/
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $maketiny);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);

//execute and close cURL
$data = curl_exec($ch);
curl_close($ch);

//You now have the tinyurl stored in $tinyurl
$tinyurl = $data;

Now that you have the tinyurl stored in the $tinyurl variable, you can use it in the twitter button!

You have two choices about how to code the button, either use JavaScript or an iFrame.

For JavaScript you need the following code:

<script src="http://platform.twitter.com/widgets.js"
type="text/javascript"></script>
<div>
   <a href="http://twitter.com/share" class="twitter-share-button"
      data-url="<?php echo $tinyurl; ?>"
      data-count="<?php the_permalink(); ?>">Tweet</a>
</div>

For an iFrame you need this code:

<iframe allowtransparency="true" frameborder="0" scrolling="no"
src="http://platform.twitter.com/widgets/tweet_button.html?
url=<?php echo $tinyurl; ?>&amp;counturl=<?php the_permalink(); ?>"
style="width:130px; height:50px;"></iframe>

The following attributes and query strings can be used:

Query String Attribute Description Default
url data-url URL of the page to share HTTP Referrer
via data-via Screen name of the user to attribute the Tweet to none
text data-text Default Tweet text Content of the <title> tag
related data-related Related accounts None
count data-count Count box position (can be horizontal, vertical or none) horizontal
lang data-lang The language for the Tweet Button en
counturl data-counturl The URL to which your shared URL resolves to (only needs to be used if a short url is used in for the other url) the url being shared

For more information on the tweet button see the Official Twitter Tweet Button Page.

Police Restricted To 140 Characters

If you were to log onto twitter on Thursday 14th of October you might be surprised to find that one of the trending topics is #gmp24, you might be wondering just what this means.

In an attempt to show the greater public just how tough it is to be a cop Greater Manchester Police have been Tweeting every 999 call they receive in the space of 24 hours.

So far they have made over 1200 tweets since 5:30AM and had three of their accounts temporarily suspended due to ‘spamming’ the micro-blogging site.

However this has not been without any controversy. Fake accounts were made by pranksters which featured tweets such as;

Call 025 – Reported burglary by man with lettuce on his head.#gmp24

Call 36 Police officer down. Police officer down. Ambulance with box of donuts required stat #gmp24

GMP responded quickly threatening the pranksters to remove the official GMP logo.

Although some of the official tweets were just as humorous;

Call 384 report of man holding baby over bridge – police immediately attended and it was man carrying dog that doesn’t like bridges #gmp24

While the whole thing may seem trivial to some Chief constable Peter Fahy claims the point is to let the general public as well as the politicians see what police have to deal with every day, and possibly re-consider budget cuts that have been proposed in the Government’s upcoming spending review.

Google Algorithm and Impact on WWW size

Since Google’s policy (and Google Algorithm) has drastically changed last year regarding paid links WWW had another great reason to grow in volume (Of course Google’s decision is just another reason for having another social media account). Everyone seems to have twitter accounts, links on blogs and works hard on all kinds of forums to get the link in either form out there.
I tried to get a sensible clue out of this and finally I thought about Google Algorithm.
Google Algorithm is not longer brilliant because of its relevancy. Google Algorithm is great because this is a very powerful business engine behind one of the biggest companies in the world. Google’s Algorithm task is to deliver results not to us but to Google’s boardroom and not in the form of horribly looking text links which they recently try to make it more attractive but in the form of
money,
more money
and more money.

My lovely cheeky Google Giant makes money out of AdWords platform which is working well only because of Google brilliant algorithm.
AdWords need more users and publishers to make money so the key success will be to adjust Algorithm always the way that it will produce more users and publishers and will help to get rid of competition buy simply telling everyone – You know AdWords is the only way to go if you want online presence (very clever).

- Among other stuff Google owns: Blogger, Orkut etc – These services are unlikely to bring money back unless they have AdSense publishers and/or traffic
- New Content = New Pages – paid linking doesn’t usually bring new www. Link publisher gets all the money with no contribution to Google he is very unlikely to introduce AdSense online.
- This is simple the more pages is out there the bigger job search engines have and the bigger money are going to their pockets (they all know that not only Google)

I like everything what makes web growing – so lets make it even bigger – I just did my bit – did you?