PSD to HTML PSD to HTML

10 Twitter Hacks For Your Wordpress Blog

InstantShift - 10 Twitter Hacks For Your Wordpress Blog

Twitter has grown exponentially in the past few months and Still, It’s growing like crazy. Twitter has surpassed Facebook and others to become the fastest-growing site in the “Member Communities” category. Twitter is a powerful marketing and promotion tool that no active blogger can ignore.

The “Twitter effect” is on the rise day by day. For all those who haven’t yet heard of it, Twitter is a free social networking and micro-blogging service that allows its users to send and read “updates” (otherwise known as tweets) to their webpage using SMS,IM or other 3rd part applications, which are text-based posts of up to 140 characters in length.

In this article, we have compiled 10 most useful Twitter hacks and tips for your WordPress blog to help you get the most out of Twitter.


You may be interested in the following related articles as well.

Please feel free to join us as you are always welcome to share your thoughts even if you have more reference links that our readers may like.

Don’t forget to Subscribe to our RSS-feed subscribe to our RSS-feed and Follow us on Twitter follow us on Twitter — for recent updates.

10 Twitter Hacks For Your WordPress Blog

 



01. Create a “Twitter This” Button for WordPress Posts


InstantShift - Twitter Hacks For Your WordPress Blog

Creating a “Tweet This” button for your blog posts are fairly very easy. Use this following code on your single.php file, within the loop to create a button. This is the basic code for a typical “Twitter This” Button, you can use some images or CSS styling to make it more attractive. Possibilities are endless.

<a href="http://twitter.com/home?status=Currently reading <?php the_permalink(); ?>" title="Send this page to Twitter!" target="_blank">Spread on Twitter</a>

 

02. Automatically Create TinyUrls for Your Tweets


InstantShift - Twitter Hacks For Your WordPress Blog

You have to use a URL shortening services when tweeting URLs because of 140 characters restriction in Twitter. For that purpose you can use tinyurls, because tinyurl provides an API, which takes over this task easily and generates unique tinyurls for your blog posts automatically.

To use tinyurl API, edit your functions.php file and paste the following function code:

function getTinyUrl($url) {
  $tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
  return $tinyurl;
}

Now in your single.php file, paste the following within the loop:

<?php
  $turl = getTinyUrl(get_permalink($post->ID));
  echo 'Tiny Url for this post: <a href="'.$turl.'">'.$turl.'</a>'
?>

 

03. Displaying Total Number Twitter Followers on WordPress


InstantShift - Twitter Hacks For Your WordPress Blog

You are actively using Twitter from last few weeks and the numbers of followers are increasing regularly. So you are looking for way to display total number of your Twitter followers on your blog and update automatically. You can use this piece of code to display your followers anywhere you want, may be you want to display this number in author info in your blog posts.

Open functions.php and paste this php function there.

function string_getInsertedString($long_string,$short_string,$is_html=false){
  if($short_string>=strlen($long_string))return false;
  $insertion_length=strlen($long_string)-strlen($short_string);
  for($i=0;$i<strlen ($short_string);++$i){
    if($long_string[$i]!=$short_string[$i])break;
  }
  $inserted_string=substr($long_string,$i,$insertion_length);
  if($is_html && $inserted_string[$insertion_length-1]=='<'){
    $inserted_string='<'.substr($inserted_string,0,$insertion_length-1);
  }
  return $inserted_string;
}

function DOMElement_getOuterHTML($document,$element){
  $html=$document->saveHTML();
  $element->parentNode->removeChild($element);
  $html2=$document->saveHTML();
  return string_getInsertedString($html,$html2,true);
}

function getFollowers($username){
  $x = file_get_contents("http://twitter.com/".$username);
  $doc = new DomDocument;
  @$doc->loadHTML($x);
  $ele = $doc->getElementById('follower_count');
  $innerHTML=preg_replace('/^< [^>]*>(.*)< [^>]*>$/',"\\1",DOMElement_getOuterHTML($doc,$ele));
  return $innerHTML;
}

Now simply use this code to display total number of your Twitter followers. Just replace our username (instantshift) with yours.

<?php echo getFollowers("instantshift")." followers"; ?>

Of course you can further style it with CSS. You can also try some fancy background images or twitter bird. For example.

<span style="background:#C00;border:#FFF 1px solid;color:#FFF;font-family:'Myriad Pro',Helvetica,Arial,sans-serif;font-size:28px;padding:10px 20px;font-weight:bold;width:auto;">Proudly Followed by <?php echo getFollowers("google"); ?> Followers</span>

 

04. Use Twitter Avatars in Comments


InstantShift - Twitter Hacks For Your WordPress Blog

Thousands of blogs show avatars next to their user’s comments. The avatars are a great way to make things more personal and create some variety between the different comments. You can display Twitter avatars in your WordPress comments, instead of gravatars. Smashing Magazine provided fairly easy way to integrates Twitter avatars on your comments.

The first thing you need to do is to get the functions file here. Once you downloaded the file, unzip the archive and open the twittar.php file. Select all its content and paste it into functions.php. Finally you will need to enable Twitter avatars in your comments.php file. Edit comments.php and past this code in comments loop. Now you are ready with Twitter avatars.

<?php twittar('45', 'default.png', '#e9e9e9', 'twitavatars', 1, 'G'); ?>

 

05. Display Your Most Recent Twitter Entry


InstantShift - Twitter Hacks For Your WordPress Blog

Here is a small script for WordPress blog that allows us to pull the latest tweet from a Twitter user via the RSS feed that is produced by Twitter. We are also able to set a prefix and a suffix for the tweet for further customization.

<?php
$username = "TwitterUsername"; // Your twitter username.
$prefix = ""; // Prefix - some text you want displayed before your latest tweet.
$suffix = ""; // Suffix - some text you want display after your latest tweet.
$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=1";

function parse_feed($feed) {
$stepOne = explode("<content type=\"html\">", $feed);
$stepTwo = explode("</content>", $stepOne[1]);
$tweet = $stepTwo[0];
$tweet = str_replace("&lt;", "<", $tweet);
$tweet = str_replace("&gt;", ">", $tweet);
return $tweet;
}

$twitterFeed = file_get_contents($feed);
echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);
?>

 

06. Display X Number of Your Latest Twitter Entries


InstantShift - Twitter Hacks For Your WordPress Blog

Now we are going to introduce the ability to pull numerous tweets. With limits set in the Twitter API, we can pull anywhere from 1 to 100. Though it is nice to be able to pull so many, we have to remember that the more we pull, the longer it will take for this script to generate its content.

<?php
$username = "TwitterUsername"; // Your twitter username.
$limit = "5"; // Number of tweets to pull in.

/* These prefixes and suffixes will display before and after the entire block of tweets. */
$prefix = ""; // Prefix - some text you want displayed before all your tweets.
$suffix = ""; // Suffix - some text you want displayed after all your tweets.
$tweetprefix = ""; // Tweet Prefix - some text you want displayed before each tweet.
$tweetsuffix = "<br>"; // Tweet Suffix - some text you want displayed after each tweet.

$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&rpp=" . $limit;

function parse_feed($feed, $prefix, $tweetprefix, $tweetsuffix, $suffix) {

$feed = str_replace("&lt;", "<", $feed);
$feed = str_replace("&gt;", ">", $feed);
$clean = explode("<content type=\"html\">", $feed);

$amount = count($clean) - 1;

echo $prefix;

for ($i = 1; $i <= $amount; $i++) {
$cleaner = explode("</content>", $clean[$i]);
echo $tweetprefix;
echo $cleaner[0];
echo $tweetsuffix;
}

echo $suffix;
}

$twitterFeed = file_get_contents($feed);
parse_feed($twitterFeed, $prefix, $tweetprefix, $tweetsuffix, $suffix);
?>

 

07. Display Tweets From Multiple Users


InstantShift - Twitter Hacks For Your WordPress Blog

Now what you are looking for? Maybe you want to pull multiple tweets from multiple user accounts and display them. With the code below, you are able to define what you want before the Twitter block, after the Twitter block, before and after each individual tweet, and after the displayed user name. You can also turn off the displayed user names if you are looking to show all of your own personal tweets from multiple accounts!

<?php
$usernames = "Username Username Username"; // Pull from accounts, separated by a space
$limit = "5"; // Number of tweets to pull in, total.
$show = 1; // Show username? 0 = No, 1 = Yes.

$prefix = ""; // This comes before the entire block of tweets.
$prefix_sub = ""; // This comes before each tweet on the feed.
$wedge = ""; // This comes after the username but before the tweet content.
$suffix_sub = "<br>"; // This comes after each tweet on the feed.
$suffix = ""; // This comes after the entire block of tweets.

function parse_feed($usernames, $limit, $show, $prefix_sub, $wedge, $suffix_sub) {

$usernames = str_replace(" ", "+OR+from%3A", $usernames);
$feed = "http://search.twitter.com/search.atom?q=from%3A" . $usernames . "&rpp=" . $limit;
$feed = file_get_contents($feed);
$feed = str_replace("&", "&", $feed);
$feed = str_replace("<", "<", $feed);
$feed = str_replace(">", ">", $feed);
$clean = explode("<entry>", $feed);
$amount = count($clean) - 1;

for ($i = 1; $i <= $amount; $i++) {

$entry_close = explode("</entry>", $clean[$i]);
$clean_content_1 = explode("<content type=\"html\">", $entry_close[0]);
$clean_content = explode("</content>", $clean_content_1[1]);
$clean_name_2 = explode("<name>", $entry_close[0]);
$clean_name_1 = explode("(", $clean_name_2[1]);
$clean_name = explode(")</name>", $clean_name_1[1]);
$clean_uri_1 = explode("<uri>", $entry_close[0]);
$clean_uri = explode("</uri>", $clean_uri_1[1]);

echo $prefix_sub;
if ($show == 1) { echo "<a href=\"" . $clean_uri[0] . "\">" . $clean_name[0] . "</a>" . $wedge; }
echo $clean_content[0];
echo $suffix_sub;

}
}
echo $prefix;
parse_feed($usernames, $limit, $show, $prefix_sub, $wedge, $suffix_sub);
echo $suffix;
?>

 

08. Display Latest Tweet as an Image


InstantShift - Twitter Hacks For Your WordPress Blog

TwitSig is a twitter signature service provider that allows you to get an auto-updating image that displays your latest Twitter entry. You can use this image as your forum signatures, in WordPress posts, in blog sidebars or may be even in emails.

Go to Twitsig.com and enter your Twitter username. And you are good to go with your Twitsig image displaying your latest tweet. The image is automatically updated when you update your Twitter status. Now you can show your latest tweet using following code wherever you want.

<a href="http://twitter.com/instantshift"><img src="http://twitsig.com/instantshift.jpg"/></a>

 

09. Detect Visitors From Twitter


InstantShift - Twitter Hacks For Your WordPress Blog

If you have significant visitor base from Twitter then will it not be a great idea to detect Twitter visitors and offer them a warm welcome, remind them that their re-tweets are appreciated. You might also want them to point towards some specific blog posts or some freebies that they might interested in.

For that you can add following code in your single.php file and add your welcome message.

<?php if (strpos("twitter.com",$_SERVER[HTTP_REFERER])==0) {
echo "Welcome, Twitter visitor! If you enjoy this post, don't hesitate to retweet!";
} ?>

 

10. Your Twitter Feed on a Separate WordPress Page


InstantShift - Twitter Hacks For Your WordPress Blog

You might want to create a separate page on your WordPress blog for displaying your latest tweets and updates. For that Smashing Magazine suggested a solution using “Page template” feature in WordPress. First you will need to create a Twitter page template “twitter-page.php” (you can use different name) to display Twitter feed, paste the following code and add it to your blog. Simple enough, huh!

<?php

/* 
Template Name: Twitter page 
*/

get_header();

include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('http://twitter.com/statuses/user_timeline/16906892.rss', 20);

get_sidebar();
get_footer();
?>

 

Find Something Missing?

Please feel free to share any hack that you think would be a great addition in this collection and that has not been listed already.




Author : Anders Ross

I'm a co-founder of iShift as well as a freelance designer and a web addict in Frankfurt, Germany. I spend too much time in front of the computer and when I actually manage to get away for more than 10 minutes, I am usually reading books, traveling or shooting photos. Check the latest updates of iShift @instantShift or You can catch me on twitter @indusLogic

32 Articles posted by Anders Ross.
gravatar

If you enjoyed reading, consider sharing it on one of these social bookmarking sites.


RSS Enjoy this Post? Subscribe to InstantShift.

RSS Feed   RSS Feed     Email Feed  Email Feed



Leave a Comment Subscribe to RSS Feed Subscribe by Email
  1. Gravatar Kees Kluskens May 25, 2009

    Comment Arrow

    Thanks for the list. I’m getting a error with number 6, ‘Display X number of Your Latest Twitter Entries’.
    It says: Parse error: syntax error, unexpected ‘=’ in *file* on line *line*
    The problem goes about this line:
    for ($i = 1; $i < = $amount; $i++) {


  2. Gravatar Haris May 25, 2009

    Comment Arrow

    I have created a plugin called twounter which displays the total number of followers and has cache support enabled (for sites with large number of visitors otherwise you will burst the api limit of twitter).

    The plugin can be found at http://themesphere.com/twitter-counter-wordpress-plugin.html


  3. Gravatar Rishil May 25, 2009

    Comment Arrow

    Everyone is twittering… Ever wondered how twitter works ? Here is a simple english video explaining it and also shared top twitter tool list. Hey by the way check out the cool twitter dance song video too.. enjoy

    http://askwiki.blogspot.com/2009/05/twitter-explained-in-plain-english.html

    Good Day


  4. Gravatar Roseli A. Bakar May 25, 2009

    Comment Arrow

    For retweeting, I still vote the tweetmeme plugin. Good list here though.


  5. Gravatar Wayne Sutton May 25, 2009

    Comment Arrow

    Thanks for the list, very useful for wordpress/twitter fans.

    @WayneSutton on twitter


  6. Gravatar Daniel Adams May 25, 2009

    Comment Arrow

    @Kees, Can you try it again now.

    It’s working on me. Just tested.


  7. Gravatar Silas May 25, 2009

    Comment Arrow

    Cool, very useful post, thanks a lot..


  8. Gravatar Michael Zehrer May 25, 2009

    Comment Arrow

    I wrote the plugin Tweetly Updater that sends a new Twitter message when you publish a post. It uses bitly for short urls, so you can see the click statistics. See: http://bit.ly/8Rj


  9. Gravatar George May 25, 2009

    Comment Arrow

    Hello, thanks for sharing these twitter hacks :)

    By the way, does anyone know where can I get avatars like the ones in this post at “04. Use Twitter Avatars in Comments” ? Or they are created by their authors?

    Thanks!


  10. Gravatar Danny Brown May 25, 2009

    Comment Arrow

    Useful list, although there is are Wordpress plugins for every feature you mentioned, if you don’t like coding.

    Cheers!


  11. Gravatar WordPress Dite May 25, 2009

    Comment Arrow

    Great list. Just love the third one. Thanks


  12. Gravatar Steve Patterson May 25, 2009

    Comment Arrow

    @friendlyknoxguy (What I am wondering is how can you integrate Twitter ID in your comments. For example, like your page here when you go to post a comment, it gives Name, E-mail and Web address. How can you add one for Twitter and then have that id linked to their Twitter account? Thanks for your help and great hacks here! I have done a hack for the welcoming Twitter visitors.


  13. Gravatar Jason May 25, 2009

    Comment Arrow

    AWESOME list, been looking for some of this functionality and a lot of the plugins just don’t cut it… nice to see most of my needs covered by simple scripts!


  14. Gravatar Patternhead May 26, 2009

    Comment Arrow

    Nice collections of tips and tricks, thanks for sharing :)


  15. Gravatar jaybranch May 26, 2009

    Comment Arrow

    Nice list! :)


  16. Gravatar Web Design News May 26, 2009

    Comment Arrow

    Very helpful post

    Thanks


  17. Gravatar Daniel Adams May 26, 2009

    Comment Arrow

    Yes, most of these can be found as plugins but plugin doesnot offer much customizations if you want to style your tweets.

    These hacks/code is further customizable and you can style these to match your website/blog styles. That is what I like about hacks. Last but not least, you learn new stuff. :)


  18. Gravatar srdha May 26, 2009

    Comment Arrow

    i gust want to say some thing “great job”

    Update your Twitter randomly according to your intrest Or, from Rss Feed Or, from your own tweet message list Or, Any combination of the above three http://feedmytwitter.com


  19. Gravatar HIPs May 26, 2009

    Comment Arrow

    Very helpful, i especially liked the Google insights heads up. Not seen it before and I am sure that it will have its uses. Many, many thanks.


  20. Comment Arrow

    thanks for this, im going to test out the twitsig now…


  21. Gravatar Daniel Adams May 27, 2009

    Comment Arrow

    Twitsig is a cool service. Very easy to use and lots of exposure. Isn’t it?

    Well, it’s not very hard to develop such a service for yourself, you just need to use latest tweet script we posted and use GD library to create a image for that. Simple enough. :)


  22. Gravatar Joe May 27, 2009

    Comment Arrow

    Have yet to fully incorporate twitter into my blog at WunderCreative.com. Having some trouble with a wordpress plugin that posts a weekly list of your tweets. Mine seems to make two posts. Any thoughts?


  23. Gravatar Daniel Adams May 27, 2009

    Comment Arrow

    Joe,

    I think you have 3 tweets right now. I am sure you can increase tweet count in plugin settings.


  24. Gravatar XIII May 27, 2009

    Comment Arrow

    I love little snippets like these and personally prefer them over plugins. Keep ‘em coming!


  25. Gravatar Elizabeth K. Barone May 27, 2009

    Comment Arrow

    Wow, this is a really awesome set of “hacks”! I got some good ideas from these, especially for my Freaking Bookworm site, which uses a Twitter account as a means for updates. Great post!


  26. Gravatar Elizabeth K. Barone May 27, 2009

    Comment Arrow

    Looks like my comment got eaten! :D

    Anyway, this is a great list and I got a lot of ideas from it! Thanks a bunch!


  27. Comment Arrow

    Great list! I myself prefer NOT to include my tweets in my professional blog (as sometimes they’re quite bizarre and non-business related) but I can see how that ability would be good in others.


  28. Gravatar Oncle Tom May 28, 2009

    Comment Arrow

    I strongly disagree with the method employed for the hack #2 (and the followings dealing with real time values).

    It’s a real bad habbit: if you call a page 100 times, the TinyURL will be calculated … 100 times. But the URL is unique.

    It’s better to store the value in a custom field.

    So many hacks (in general, not yours especially) are so ugly and bloats WP installs for so tiny details.


  29. Gravatar Nicholi May 29, 2009

    Comment Arrow

    Oncle Tom,

    I’m pretty sure TinyURL will return the same URL every time the tinyurl is requested. I don’t see why it needs to be requested every time the page is loaded.


  30. Gravatar Aneslin May 29, 2009

    Comment Arrow

    very interesting an very easy to understand tutorials with images.
    thanks a lot


  31. Gravatar Daniel Adams May 29, 2009

    Comment Arrow

    Tom,

    Nicholi is right. TinyURL returns the same URL every time because of use of their API. The URL generation request is not some random TinyURL function.

    TinyURL API make sure that only one URL has to be generated for a particular page regardless of how many times your reload your page.

    We are also using same API for twitter just below author info (in this post). Please check and try it yourself.


  32. Gravatar Kevin May 31, 2009

    Comment Arrow

    Hi there! This is an awesome page, and I want to really thank you for providing this code, however, there seemed to be a problem with your “07. Display Tweets From Multiple Users”. When I entered in two different Twitter usernames to test out the program, it only returned the first one, in terms of Twitter feeds. I’m thinking it has something to do with these lines:

    $usernames = str_replace(” “, “+OR+from%3A”, $usernames);
    $feed = “http://search.twitter.com/search.atom?q=from%3A” . $usernames . “&rpp=” . $limit;

    and I am trying to debug this for you, but just wondering if anyone else got this same problem, and what your thoughts were on how to fix it?

    Thanks so much again, and keep up the great work!

    Sincerely,
    - Kevin Pajak, Web/Graphic Designer
    http://www.twitter.com/kevinpajak


  33. Gravatar Nicholi June 1, 2009

    Comment Arrow

    Kevin,

    I tried the code and it works. It shows the last 5 total from the usernames. I suspect the second username you are using hasn’t been updated since before the 5th tweet of the first account?

    Go to search.twitter.com and search for (using your own usernames) “from:YourFirstUsername OR from:YourSecondUsername” and see what the first 5 tweets are. Are those the 5 tweets you see when you use the code above? If so, it’s working.


  34. Gravatar Kevin Pajak June 2, 2009

    Comment Arrow

    Nicholi, you know you are absolutely right, I noticed that in a test too last night. I think the thing that threw me off before was that I was thinking this app would produce the last 5 (”x”) posts from EACH of the Twitter users you specify, but in fact it seems to list the last x MOST RECENT feeds, from any of the users you specify (just as you said). So what I want to do next is make it show last X no. of tweets from EACH OF THE Twitter users. I will work on that.

    Also, one big thing though, the app does display the hyperlinks correctly for the USER NAMES, but for LINKS IN THE ACTUAL FEED ITEMS, it is printing out the <A HREF.. tags as text.

    Ex: Pete Cashmore 7 Technologies Shaping the Future of Social Media – http://bit.ly/jCY00
    The HTML code is rendering as:
    Pete Cashmore 7 Technologies Shaping the Future of Social Media – <a href=”http://bit.ly/jCY00″>http://bit.ly/jCY00</a>

    Something about the original code I think was maybe done incorrectly, but I’m trying to figure that out too.

    And a follow-up note: I plan on developing some code that will allow the user to enter in Twitter name(s), along with no. of tweets desired (like in a form or input boxes), and display that back for the user as well! If anybody has any comments on that, please feel free to let me know!

    Thanks a lot for the comment though, appreciate, and still I think this is a fantastic page/code, that is great for us developers who use Twitter! Thanks to the author for posting it up, and keep up the great work everybody…

    - Kevin


  35. Gravatar Nicholi June 2, 2009

    Comment Arrow

    Kevin,
    To fix the links you can add
    $clean_content[0] = str_replace(”<”, “”, $clean_content[0]);


  36. Gravatar Daniel Adams June 2, 2009

    Comment Arrow

    Nicholi is right, tweets are in order of posted time. Please use larger number for total tweets and you will see the difference.

    I also checked code and it’s working but as Nicholi explain, there might be some issues with chars.

    Thanks Nicholi for helping him :) Really appreciated.


  37. Gravatar Daniel Adams June 2, 2009

    Comment Arrow

    Kevin,

    If it still does not work, please post here. I will send you working php file attached with email. ;)


  38. Gravatar Nick June 3, 2009

    Comment Arrow

    I just found this article, what a great start for me, as I am just getting to grips with twitter and integrating it into my site as a whole.

    Will have to put some of these into my site as soon as I get a chance!


  39. Gravatar Kevin Pajak June 3, 2009

    Comment Arrow

    Hey Nicholi and Daniel, thanks a lot for your help, but I did try Nicholi’s fix suggestion, and it still didn’t seem to work. You see, what is happening is the links (” render fine (i.e. linkable) for the Twitter user name, but for the list item entries that have links, the left brackets (”") in the HTML are listed as “>”. So basically what it’s doing is rendering all links in the item entries just as text (I’ll try to demonstrate: RT @creattica is what is outputted on the page, rather than the links being linkable).

    Anyway, I will keep working to try to figure this out, and your help would be much appreciated too. Thanks so much! (And Daniel, sure, please feel free to email the code too if you like at: kevin@kevinpajak.com) Thanks a lot!


  40. Gravatar Kevin Pajak June 3, 2009

    Comment Arrow

    Actually, I thought it would be even better to include a link to show you exactly how the feed items are rendering:

    http://www.kevinpajak.com/mycustomtweetfeeds.php

    Thanks again for your help and suggestions guys.


  41. Gravatar Nicholi June 3, 2009

    Comment Arrow

    Kevin,

    I’m sorry, the comments ate some of the code I posted. :)

    Take a look at the code here. http://falith.com/wp-content/uploads/multitweets.phps

    I commented the two lines that I added to make the links work. Hope that helps.


  42. Gravatar Kevin Pajak June 4, 2009

    Comment Arrow

    Nicholi, you rock man! That did the job! Thank you so much! As soon as I saw those lines of code, I thought it would work. (Seems the trick, exactly as you have done here, is forcing the program to replace the ” & lt; ” and “& gt;” with the left and right brackets, and also, I think it was essential that you put it in the for loop, before the “echo $clean_content[0];”. Great job!

    .Now I’m working on extending it a bit further to replace stuff like double quotes (”) – which the code currently is displaying as like, for example: I like this article, & quot ; What the hell am I doing?, & quot ; instead of I like this article, “What the hell am I doing?” but I will solve that.

    This page is fantastic as a possible base for so many things!

    I will be sure and post some stuff here after I make some customizations to it later. Thanks again you guys, great stuff. :-)


  43. Gravatar Kevin Pajak June 4, 2009

    Comment Arrow

    Hey guys! I got two things for you that I developed. First one is a resolution to that pesky double-quotes display problem with the feed item content (as well as the left and right arrow characters, in addition to the arrows used in A HREF tags). Here’s the fix, just add this code into what Nicholi posted last time:

    [code]
    // Make the links clickable
    $clean_content[0] = str_replace("<", "", $clean_content[0]);
    $clean_content[0] = str_replace("&quot;", """, $clean_content[0]);
    $clean_content[0] = str_replace("&lt", "", $clean_content[0]);
    echo $clean_content[0];
    echo $suffix_sub;
    [/code]

    Also, I set up a little app that will allow the user to enter in the Twitter name and desired number of most recent posts from that user, I will post the code for that next time. Seems though that this is restricted (from Twitter itself looks like) to posts only from the last 1-2 weeks. (This is one of those things about Twitter I have read complaints about: how they only turn up results within a 1-2 week time period in their search engine). Oh well, we’ll try to work with it I guess


  44. Gravatar Kevin Pajak June 4, 2009

    Comment Arrow

    Ah, looks like it ate some of the code. Well anyway, here is the code to replace the double quotes back (”). I am adding spacing in to allow it to render here, just make sure you type ALL CHARACTERS between the ” and ” marks with NO SPACES, I’m only adding in the extra spaces here to get the code to render properly:

    $clean_content[0] = str_replace(” & amp ; quot ; “, ” & quot ; “, $clean_content[0]);


  45. Gravatar Mike June 4, 2009

    Comment Arrow

    Does anyone know of a plugin that will publish your Twitter updates once per day as a blog post, rather than a widget?


  46. Gravatar aliplanning June 14, 2009

    Comment Arrow

    Thank you to share


  47. Gravatar tasarhane June 21, 2009

    Comment Arrow

    nice post.. thanks.


  48. Gravatar Ken June 26, 2009

    Comment Arrow

    Awesome post. Definitely going in my tutorial bookmarks folder. I have a quick question however.

    I’m using: [ 01. Create a “Twitter This” Button for WordPress Posts ] and I’ve run into a problem.

    It seems to break whenever I have a post that includes a hashtag (#). For example, if the post ends with “#s$1″ the button sends me to http://twitter.com/s$1, which isn’t anything at all, just an error page. Any suggestions on how to fix this?


  49. Gravatar Ken June 26, 2009

    Comment Arrow

    Ha, I just figured out how to fix it.

    For those of you who have this problem, I used:
    str_replace(”#”,”%23″,$variable);
    which replaces all pound signs with that lovely encode.


  50. Gravatar Pat June 27, 2009

    Comment Arrow

    this is super tools i am looking for! thanks!


  51. Gravatar Jean-Baptiste Jung June 28, 2009

    Comment Arrow

    Great article, though you should have given credits to the original sources. For example, the “03. Displaying Total Number Twitter Followers on WordPress” came from my blog WpRecipes.com. Some other hacks comes from a post I wrote a while ago at Smashing Magazine.

    There’s nothing bad to republish content from other blogs, but you should definitely include a link to the source.


  52. Gravatar Erik July 1, 2009

    Comment Arrow

    Hi!

    I think it would be sweet if there was a hack/plugin for wordpress blogs where at the bottom of each article, you could include a twitter feed around a specific company, such as ‘Kiva’ or a hashtag #microfinance. I see it similar to the TechCrunch company templates at the bottom of a post, but include the latest 5 tweets.

    I know there are apps like monitter and open brands, but I haven’t found exactly what I’m looking for. I think an app like this would be extremely helpful for all bloggers and bring the ’stream’ into every story. Not simply bringing the story into the stream.

    If anyone knows of such an app, please email me at erik at socialearth dot org.
    Thanks!


  53. Gravatar Brent July 12, 2009

    Comment Arrow

    Holy good advice…

    I will b e re-reading this again, and again, and again….


  54. Gravatar Mr Mim July 31, 2009

    Comment Arrow

    Very Helpful


  55. Gravatar Smashing Themes August 16, 2009

    Comment Arrow

    Pretty useful and original hacks, specially the twitter avatar and tweets as image is really awesome.


  56. Gravatar Suntry August 19, 2009

    Comment Arrow

    I tried the script to “Display Tweets From Multiple Users” but it doesn’t show up anything. I get a blank page without any error. I put the usernames separated by space as directed.

    please help


  57. Gravatar Tracy August 23, 2009

    Comment Arrow

    Display X number of your latest twitter entries is not working either.


  58. Gravatar Tracy August 24, 2009


  59. Gravatar AIR August 27, 2009

    Comment Arrow

    Thanks! Works great for me!


  60. Gravatar noRm September 1, 2009

    Comment Arrow

    Hi guys,

    Nicholi has posted a fix for “Display Tweets From Multiple Users” to render the links correctly, but the link http://falith.com/wp-content/uploads/multitweets.phps doesn’t work anymore.

    Could anyone post the code, please?


  61. Gravatar Kevin Pajak September 2, 2009

    Comment Arrow

    OK Nicholi, Norm and eveyone! Finally, here is the code for my enhanced Twitter Hack #7 (from above) : “Display Tweets From Multiple Users”.

    VIEW THE SOURCE CODE ON THIS PAGE:
    http://www.kevinpajak.com/blog/code-repository/customized-tweet-feed-display/

    *NOTE: I’m still working on enhancing the app further, and I will likely add some notes for developers on this page as well! Please everyone share your thoughts, code, your intended/possible uses for this code, and other feedback. Thanks, and happy coding everybody!


  62. Gravatar noRm September 2, 2009

    Comment Arrow

    Yeah, thanks man! :)


  63. Gravatar snetErz September 4, 2009

    Comment Arrow

    Hey,

    Great hacks for twitter. I have the #6 hack working fine for my site, however, I want to have an alternate color for every other twitter that gets posted. I can read and understand most php, however I am not sure how to use the for loop in order to produce this effect properly. My idea was to create a $tweetprefixalt = etc. and use the for loop to alternate between that and the $tweetprefix, however I’m not quite sure how to do it properly.

    Any help would be great.

    http://www.sneterz.com is my site, I have the code running on the sidebar as well as an example of what I want it to look like.


  64. Gravatar sravkum September 14, 2009

    Comment Arrow

    How about our “Tweet Us at wittysparks custom Twitter Widget” – http://www.wittysparks.com/2009/08/24/tweet-us-at-wittysparks-custom-twitter-widget/


  65. Gravatar Modified Car Forum September 28, 2009

    Comment Arrow

    Twitter now worth 1 billion yet its always to busy to fulfill your request whats going on >?

    great post dude implemented a few on my modified car forums / blog / club today after reading this


  66. Gravatar Jenna October 12, 2009

    Comment Arrow

    I’m looking for a simple WP Twitter hack. Would anyone be able to take a look at http://www.valleyprblog.com and tell me what they’re using for their Tweetroll at the bottom of their sidebar? I just want a simple Twitter sidebar plug-in that just lets me link to 5-10 of my favorite Tweeps that I’m following. That’s all I want.

    Everything I’ve found goes beyond that, and shows who’s following me, what I just tweeted, shows icons, etc…overkill. I just want text links, and something that I could easily edit from the wp-admin panel to switch out who I’m following. Thank you! – Jenna


  67. Gravatar El3ments October 13, 2009

    Comment Arrow

    Nice write up. This will definitely become handy when my site gets more users.


  68. Gravatar Tim October 23, 2009

    Comment Arrow

    I tried all the fixes that were mentioned for #7 (Display Tweets From Multiple Users) but I’m still running into problems with the links not showing correctly. This is what shows:

    Shane Carwin: @switchbladejake He already got beat up once so 1 new fight and a rematch.


  69. Gravatar Tim October 23, 2009

    Comment Arrow

    Edit to the post above, it doesn’t show the link like that it just shows the etc…


  70. Gravatar remote car starters November 10, 2009

    Comment Arrow

    Very helpful and informative. I will be implementing this into a few sites of my own. Thanks for the time put into this.


  71. Gravatar J November 11, 2009

    Comment Arrow

    I tried using number 7 to display my twitter feed.
    I changed the ‘limit’ to 50, but it still only shows 5.
    Yes I have more than 5 tweets.
    Could there be some mysterious caching going on somewhere?


  72. Gravatar Unbelieveable Stuff November 11, 2009

    Comment Arrow

    Nice One……


  73. Gravatar Honey Singh November 20, 2009

    Comment Arrow

    Thankyou guys.
    I have the same issue of and i resolve that after reading the comments.

    @Andress
    Why don’t you change the code in the post with the error free code for displaying tweets.


  74. Gravatar Bilgiyukle December 19, 2009

    Comment Arrow

    Very helpful and informative. I will be implementing this into a few sites of my own. Thanks for the time put into this.


  75. Gravatar Haber December 23, 2009

    Comment Arrow

    Good list here though.


  76. Gravatar Sikis izle December 29, 2009

    Comment Arrow

    Good list here though.


  77. Gravatar diwhflq January 4, 2010

    Comment Arrow

    Wordpress Blog Services – How To Display Your Latest Twitter Entries on WordPress


  78. Gravatar Ziaix January 10, 2010

    Comment Arrow

    Does anyone know a way to inculde twitter tweets into my blog posts?

    By this i mean my page would show in order:
    Blog post
    Blog post
    Twitter tweet
    Twitter tweet
    Twitter tweet
    blog post
    Twitter tweet
    etc


  79. Gravatar yusuf14 January 27, 2010

    Comment Arrow

    thx nice list


  80. Gravatar yusuff January 27, 2010

    Comment Arrow

    thxxxxxx


  81. Gravatar yusufkara January 27, 2010

    Comment Arrow

    thx for sharing


  82. Gravatar yusuf February 6, 2010

    Comment Arrow

    thx


  83. Gravatar angela February 8, 2010

    Comment Arrow

    Twitter is not bigger than Facebook. At this point Facebook is now above Yahoo in traffic, and the #2 visited site (after Google). Twitter is not even in the top 10.



  Leave a Trackback
  1. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift « Netcrema - creme de la social news via digg + delicious + stumpleupon + reddit
  2. popurls.com // popular today
  3. WordPressのためのTwitterツール10個 | KGRAND World Tech News Reader
  4. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift |
  5. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift
  6. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift | Twitter Kid
  7. 10 Twitter Hacks For Your Wordpress Blog : Tech List Report
  8. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift | eWebsite.biz
  9. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift | thewordpresssecrets
  10. 10 Twitter hacks voor jouw WordPress blog : WordCamp NL
  11. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift
  12. Mail Web - Actualité Internet » Blog Archive » Twitster, application php pour suivre vos tweets
  13. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift | Digital Journal
  14. Mungkee » Blog Archive » 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift
  15. Blog | Pixeldreher André Nitz - Webdesigner aus Leipzig
  16. The Great Geek Manual » Link Round-Up: May 25, 2009
  17. links for 2009-05-25 at DeStructUred Blog
  18. jardenberg kommenterar - 2009-05-26 — jardenberg unedited
  19. INTERACTIVE *TORTURE* GAME (1) | Computers-Technology
  20. Link Backup from Delicious.com » Blog Archive » links for 2009-05-25
  21. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift - MyClickSense.com
  22. 10 Twitter Hacks para un blog echo con WordPress | Codigo Geek
  23. links for 2009-05-28 | Links | WereWP
  24. Punto Delta » Blog Archive » 10 Twitter Hacks para un blog hecho con WordPress
  25. BuddyPress Links #14 · Buddypress Links
  26. Whoopi In The Middle » Blog Archive » Hacks for WP blog
  27. Daily Links | AndySowards.com :: Professional Web Design, Development, Programming, Hacks, Downloads, Math and being a Web 2.0 Hipster?
  28. Il meglio della settimana #19 | BigThink
  29. 10 Twitter Hacks For Your Wordpress Blog
  30. #WDNDL For 5/31/2009 - Weekend Web Update! | AndySowards.com :: Professional Web Design, Development, Programming, Hacks, Downloads, Math and being a Web 2.0 Hipster?
  31. WordPress Articles for June 02 2009 | WPStart.org - WordPress themes, plugins and news
  32. Cheap Wordpress Blog Hosting « Best Web Hosting Package
  33. (Anti) Social Lists 6/7/09 | (Anti) Social Development
  34. links for 2009-05-25 .:: [aka щямукюшт] Ozver.in | Озверин
  35. [CLOSED] CONTEST OVER!!!!!!!!!! Huge YouTube Guru Contest | Open-a-Boutique.com
  36. Phriday Links | Search Optimised
  37. 31 Useful Twitter Plugins For Wordpress To Choose From | 1stwebdesigner - Love In Design
  38. 22 Mixed Quality Wordpress Hacks | KolayOnline
  39. Wordpress plugins for twitter | Golden Blogging
  40. RT @SharonMcP: 10 Twitter Hacks For Your Wordpress Blog. www.instantshift.com [Many on this list require adding code. Good resource.] - Twitoaster
  41. Mail Web - Actualité Internet » Blog Archive » Twitter Hacké !
  42. 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift
  43. Twitter & Wordpress | Darlanne.com
  44. Twitter Meets Wordpress | Darlanne.com
  45. 30 Incredibly Useful WordPress Hacks | Tutorial9
  46. 30 Incredibly Useful WordPress Hacks | huibit05.com
  47. NamrouD | Upgrade Your Mind ! » 30 Incredibly Useful WordPress Hacks
  48. 30 Incredibly Useful WordPress Hacks « AnaConda 4 Photoshop Blog
  49. 22 Latest Exceptional WordPress Hacks | Programming Blog
  50. Wordpress Blog Services - How To Display Your Latest Twitter Entries on WordPress
  51. Link Daddy Free Link Directory
  52. link test
  53. thebadtiming.com » Blog Archive » 10 Twitter Hacks For Your Wordpress Blog | Tutorials | instantShift
  54. 30 Twitter Hacks and Plugins to Spice Up Your Wordpress Blog

  • Gravatar

    Your NameFebruary 8, 2010

Arrow
Spam protection: Sum of 3 + 4 ?



If you face problem with captcha and it says the sum is incorrect. Make sure...

1. Browser is javascript enabled and accepting cookies.
2. Clear browser cache and try again.



http://www.instantshift.infohttp://www.instantshift.orghttp://www.instantshift.net