How To Create A Twitter Widget

Advertisement

Twitter needs no introduction. It has become the way to reach audiences for some people and companies and a place to hang out for others. Placing a Twitter feed on one’s website has almost become compulsory. Embedding a feed isn’t all that difficult if you are comfortable with Twitter’s default widget, but making your own will enable you to blend it into your website seamlessly.

photodune-4052663-twitter-on-keyboard-xs

The Result

The result of our effort will be a WordPress widget that can be placed in a widgetized sidebar. It will display the user’s details on top and the latest few items from the user’s feed. You can see it in action in our Musico theme, although the screenshot below says it all.

finished_widget

About The Twitter Terms Of Service

Because this is a custom widget, you control what and how elements are displayed. Make sure to read Twitter’s “Developer Display Requirements” to find out what you need to display. I will be breaking some of the rules for simplicity’s sake, but bolting on stuff will be a trivial matter once you’ve finished this article.

Note that conforming to the requirements is a must. If you do not, you run the risk of your ID being banned which means that your widget will not display any tweets.

First Step: Create A Twitter App

Before writing any code, we’ll have to get our hands on a Twitter app or, more appropriately, Twitter API credentials. The process is explained in a video that I made:

In case you prefer reading to watching a video, here are the basic steps:

  1. Log into Twitter’s developers section.
  2. Go to “My Applications,” and click “Create a new application.”
  3. Fill out the required fields, accept the rules of the road, and then click on the “Create your Twitter application” button. You will not need a callback URL for this app, so feel free to leave it blank.
  4. Once the app has been created, click the “Create my access token” button.
  5. You’re done! You will need the following data later on:
    • consumer key,
    • consumer secret,
    • access token,
    • access token secret.

Add Our App’s Details

To add some options to our theme quickly, we’ll be using the theme customizer, introduced in WordPress 3.4. Smashing Magazine has an exhaustive article on it, if you’re interested to learn more. For now, we’ll just add the bare necessities.

To enable quick access to the theme customizer, I like to use the following snippet:

add_action ('admin_menu', 'my_theme_customizer');
function my_theme_customizer() {
	add_theme_page(
		__( 'Customize Theme Options', THEMENAME ),
		__( 'Customize Theme', THEMENAME ),
		'edit_theme_options',
		'customize.php'
	);
}

Adding the code above to your theme’s functions.php file will generate a link to the customizer in the “Appearance” section of the admin area. To add some options, we’ll need to create a class. Add a file named MyCustomizer.class.php to the theme’s directory, and paste the following code in it:

<?php
class MyCustomizer {
	public static function register ( $wp_customize ) {

		/** Sections **/
		$wp_customize->add_section( 'twitter_api' , array(
			'title'    => __( 'Twitter API Details', 'mytextdomain' ),
			'priority' => 10,
		));

		/** Settings **/
		$wp_customize->add_setting( 'twitter_consumer_key' );
		$wp_customize->add_setting( 'twitter_consumer_secret' );
		$wp_customize->add_setting( 'twitter_access_token' );
		$wp_customize->add_setting( 'twitter_access_token_secret' );

		/** Controls **/
		$wp_customize->add_control(
			'twitter_consumer_key',
			 array(
				'label' => __( 'Consumer Key', 'mytextdomain' ),
			 	'section' => 'twitter_api',
				'priority' => 10,
			 )
		);
		$wp_customize->add_control(
			'twitter_consumer_secret',
			 array(
				'label' => __( 'Consumer Secret', 'mytextdomain' ),
			 	'section' => 'twitter_api',
				'priority' => 20,
			 )
		);
		$wp_customize->add_control(
			'twitter_access_token',
			 array(
				'label' => __( 'Access Token', 'mytextdomain' ),
			 	'section' => 'twitter_api',
				'priority' => 30,
			 )
		);
		$wp_customize->add_control(
			'twitter_access_token_secret',
			 array(
				'label' => __( 'Access Token Secret', 'mytextdomain' ),
			 	'section' => 'twitter_api',
				'priority' => 40,
			 )
		);
   }
}
add_action( 'customize_register' , array( 'MyCustomizer' , 'register' ) );
?>

There are a couple of things to note about the code above. All of the details we need to add to the customizer are encapsulated in a class. The class is registered at the bottom of the code block, using a hook.

We need to do three things with the class to get our options to show up:

  • Create a new section to house these options in one logical group. We use the add_section() function to do this; all we need to add is a title.
  • We need to tell WordPress that we are adding particular settings. The function used is add_setting, which can take a default parameter as well, but we don’t really need it here.
  • Finally, we tie a control to the setting so that the user can manipulate it. A number of controls are available; here, we need a simple text box. Using the add_control() function, we specify the setting to be modified, the label of the control and the section it is in. The type of control is not specified because the default is the usual input box.

apisettings

Notice the “priority” setting for some elements. This determines the order they show up in. The reason they are multiples of 10 is that, if you realize later that you need to add something between two settings, you won’t need to rewrite all of the priorities; you would just use “15” for the new element.

Don’t forget to include this class in functions.php so that the code is executed.

include( 'MyCustomizer.class.php' );

Once all that is done, you can fill out the details. You will be able to access the values using the get_theme_mod( 'option_name' ) function (more on that below).

Integrate The API

We now have a way to retrieve our API details, but we are not in contact with the API just yet. Doing that is a bit difficult; luckily, others have done the grunt work for us. For this tutorial, I’ll use Codebird, a PHP class for interacting with the Twitter API.

Download the codebird.php file from Codebird, put it in your main theme folder, and set it up like so:

add_action( 'init', 'my_twitter_api' );
function my_twitter_api() {
	global $cb;
	$consumer_key = get_theme_mod( 'consumer_key' );
	$consumer_secret = get_theme_mod( 'consumer_secret' );
	$access_token = get_theme_mod( 'access_token' );
	$access_secret = get_theme_mod( 'access_secret' );

	include( 'codebird.php' )
	Codebird::setConsumerKey( $consumer_key, $consumer_secret );
	$cb = Codebird::getInstance();
	$cb->setToken( $access_token, $access_secret );
}

Now you’ll be able to use Codebird by invoking the $cb instance. Let’s set this aside for now; we’ll get back to it later!

Create A Widget

I like to separate widgets into individual files. So, before we do anything else, create a widgets directory and put a file in it named MyTwitterWidget.class.php. Include this file in functions.php just as we did above:

include( 'widgets/MyTwitterWidget.class.php' );

Add the following PHP code to the file. This is the general starting point for widgets.

<?php
class MyTwitterWidget extends WP_Widget {
	/** Widget setup **/
	function MyTwitterWidget() {
		parent::WP_Widget(
			false, __( 'My Twitter Widget', 'mytextdomain' ),
			array('description' => __( 'Displays a list of tweets from a specified user name', 'mytextdomain' )),
			array('width' => '400px')
		);
	}
	/** The back-end form **/
	function form( $instance ) {

	}
	/** Saving form data **/
	function update( $new_instance, $old_instance ) {

	}
	/** The front-end display **/
	function widget( $args, $instance ) {

	}
}
register_widget('MyTwitterWidget');
?>

There are four functions here, each with a particular role in creating the widget.

  • The first function is the constructor. The widget’s title and description may be specified here.
  • The form function takes care of the back-end form. Putting a few functions in there makes it very easy to assemble a form. WordPress takes care of the rest.
  • The update function enables you to add any special code to the saving process.
  • The widget function handles the front-end display of the widget.

As we build the widget, you’ll see that we’ll need some custom functions. But until then, let’s go function by function.

The Back-End Form

We want to give the user the option to change the title of the widget, to specify how many tweets to show, and to specify their Twitter user name. The basic pattern for creating these options is as follows:

<p>
	<label for='<?php echo $this->get_field_id( 'option_name' ); ?>'>
		<?php _e( 'Title:', 'mytextdomain' ); ?>
		<input class='widefat' id='<?php echo $this->get_field_id( 'option_name' ); ?>' name='<?php echo $this->get_field_name( 'option_name' ); ?>' type='text' value='<?php echo $values['option_name']; ?>' />
	</label>
</p>

The $values array is a list of all of this widget’s options, which are specified elsewhere. All of our options will follow the pattern below. Here are the functions to look out for:

  • get_field_id()

    Outputs the ID of the field for your option.

  • get_field_name()

    Outputs the name of the field for your option.

Using these functions is crucial because the name and ID of these fields can get pretty funky when multiple widget instances are in multiple sidebars.

The complete code for our form looks something like this:

<?php
	$defaults = array(
		'title'    => '',
		'limit'    => 5,
		'username' => 'bonsaished'
	);
	$values = wp_parse_args( $instance, $defaults );
?>
<p>
	<label for='<?php echo $this->get_field_id( 'title' ); ?>'>
		<?php _e( 'Title:', 'mytextdomain' ); ?>
		<input class='widefat' id='<?php echo $this->get_field_id( 'title' ); ?>' name='<?php echo $this->get_field_name( 'title' ); ?>' type='text' value='<?php echo $values['title']; ?>' />
	</label>
</p>

<p>
	<label for='<?php echo $this->get_field_id( 'limit' ); ?>'>
		<?php _e( 'Tweets to show:', 'mytextdomain' ); ?>
		<input class='widefat' id='<?php echo $this->get_field_id( 'limit' ); ?>' name='<?php echo $this->get_field_name( 'limit' ); ?>' type='text' value='<?php echo $values['limit']; ?>' />
	</label>
</p>

<p>
	<label for='<?php echo $this->get_field_id( 'username' ); ?>'>
		<?php _e( 'Twitter user name:', 'mytextdomain' ); ?>
		<input class='widefat' id='<?php echo $this->get_field_id( 'username' ); ?>' name='<?php echo $this->get_field_name( 'username' ); ?>' type='text' value='<?php echo $values['username']; ?>' />
	</label>
</p>

The only addition made to this code is the retrieval of the values. The function is passed the current values in the $instance parameter. I’ve added a defaults array in case no values have been set. The defaults and the instance data arrays have been merged, resulting in the final $values array.

Save The Form’s Data

I’m sure you’ll be relieved by the simplicity of this. Here’s the complete code in the update() functions.

return $new_instance;

The $new_instance parameter has all of the new data in it. All we need to do is return it. The purpose of the update function is to allow for some validation or manipulation.

Display The Tweets

Now for the hard part! Retrieving the tweets is not that difficult, but if we do it on every page load, we’ll be rate-limited by Twitter in no time. We’ll need to find a way to cache the results so that we only bother Twitter, say, every five minutes. The way I like to handle these problems is to side-step them altogether and code as if the solution were already in place. Let’s assume that we’ve already written the functions that we need for this and proceed to create the front end:

First, let’s look at the general template needed to display widgets:

echo $args['before_widget'];
echo $args['before_title'] . $instance['title'] .  $args['after_title'];
echo $args['after_widget'];

The $args parameter holds some structural information from the sidebar you created. We just output these to make sure that this widget conforms to all of your other widgets.

Now, let’s list some tweets:

$tweets = $this->get_tweets( $args['widget_id'], $instance );
if( !empty( $tweets['tweets'] ) AND empty( $tweets['tweets']->errors ) ) {

	echo $args['before_widget'];
	echo $args['before_title'] . $instance['title'] .  $args['after_title'];

	$user = current( $tweets['tweets'] );
	$user = $user->user;

	echo '
		<div class="twitter-profile">
		<img src="' . $user->profile_image_url . '">
		<h1><a class="heading-text-color" href="http://twitter.com/' . $user->screen_name . '">' . $user->screen_name . '</a></h1>
		<div class="description content">' . $user->description . '</div>
		</div>	';

	echo '<ul>';
	foreach( $tweets['tweets'] as $tweet ) {
		if( is_object( $tweet ) ) {
			$tweet_text = htmlentities($tweet->text, ENT_QUOTES);
			$tweet_text = preg_replace( '/http://([a-z0-9_.-+&!#~/,]+)/i', 'http://$1', $tweet_text );

			echo '
				<li>
					<span class="content">' . $tweet_text . '</span>
					<div class="date">' . human_time_diff( strtotime( $tweet->created_at ) ) . ' ago </div>
				</li>';
		}
	}
	echo '</ul>';
	echo $args['after_widget'];
}

Let’s dissect this to understand what’s going on.

  • Line 1

    We’re assuming that we have a get_tweets() function that will return a list of tweets in some form. We haven’t written this yet, but by assuming that we have done so, we’ll know what to include in the function’s code.

  • Line 2

    If the tweets list is not empty and there are no errors, we can display the widget.

  • Lines 7–8

    All tweets are from the same user, and each tweet contains the user’s data. In line 7, we’re just grabbing the first tweet. In line 8, we’re pulling the user’s details into the $user variable.

  • Lines 10–16

    We use data from the $user object to build a simple display for the user’s account. It includes the image, short description and user name.

  • Lines 18–29

    Using data in the $tweets['tweets'] variable, we build a list of tweets. The preg_replace() in there is needed to convert links (which arrive as plain text) into clickable elements.

All that’s left is to figure out how the get_tweets() function should work. We already know that it can’t directly get the tweets from Twitter, so we’ll need to use some trickery!

To pull this off, our get_tweets() function will need to do the following:

  1. Get the list of tweets from our own database.
  2. If no list is there or the list is more than five minutes old, then it needs to grab the list from Twitter.
  3. Once we get results from Twitter, we save them to our database and add a timestamp to make sure we don’t grab it again before the five minutes is up.

To make things more modular, we’ll create three functions.

  • get_tweets()

    Pulls a list of tweets from our database.

  • retrieve_tweets()

    Pulls a list of tweets from Twitter.

  • save_tweets()

    Saves a list of tweets from Twitter to our database.

Retrieve Tweets From Twitter

In the MyTwitterWidget class, let’s create this function and make it retrieve some tweets:

function retrieve_tweets( $widget_id, $instance ) {
	global $cb;
 	$timeline = $cb->statuses_userTimeline( 'screen_name=' . $instance['username']. '&count=' . $instance['limit'] . '&exclude_replies=true' );
 	return $timeline;
}

As you can see, this is pretty easy, thanks to the Codebird class. We simply use one of its functions, statuses_userTimeline(), to retrieve our list. Our own functions receive the widget’s ID and the instance data, which we use to tell Codebird which user’s tweets we want and how many to retrieve.

Save Tweets to the Database

To save the tweets to the database, we’ll need to use the ID of the widget and the actual tweets, and we’ll need to store the time when we last updated them.

function save_tweets( $widget_id, $instance ) {
	$timeline = $this->retrieve_tweets( $widget_id, $instance );
	$tweets = array( 'tweets' => $timeline, 'update_time' => time() + ( 60 * 5 ) );
	update_option( 'my_tweets_' . $widget_id, $tweets );
	return $tweets;
}

This widget also receives the widget’s ID and the instance data. We use these to retrieve the tweets, using the retrieve_tweets() function that we created above. We’ll add that to our $tweets array, which contains the data returned from Twitter and the time of update.

The time of update is five minutes from now. When we display our tweets, we’ll use this value to determine whether to display the tweets in the database or to grab the list from Twitter again (to ensure we have the most recent ones).

We use the widget’s ID to save the list to the database, using WordPress’ options table. This ensures that we can save the proper Twitter details for each instance of our Twitter widget.

Get Tweets From the Database

We’ve finally arrived at the get_tweets() function. Let’s take a look. Explanation ensues!

function get_tweets( $widget_id, $instance ) {
	$tweets = get_option( 'my_tweets_' . $widget_id );
	if( empty( $tweets ) OR time() > $tweets['update_time'] ) {
		$tweets = $this->save_tweets( $widget_id, $instance );
	}
	return $tweets;
}

First, we retrieve the tweets from the database using the options table. If the options table is empty or the update time has past our limit, then we use the save_tweets() function. This will retrieve the tweets from Twitter and save them to the database (and also return them so that we can use them right away).

Conclusion

While this methodology does not lack complexity, it has a tight and clear logic to it, which arises from the thoughtful way that WordPress implements widgets and the new theme customizer.

Once you grasp the basic idea behind how this widget is created, you can add many of your own and customize them to your (or your client’s) delight.

(al) (ea)

↑ Back to top

I am a web developer in love with WordPress. I have a company called Bonsai Shed where we make webapps and premium themes like Musico and Estatement.

  1. 1

    Love the post, specially the “trickery” part.

    0
  2. 2

    This script is in violation with the Twitter Display Requirements and might get your app blocked:

    https://dev.twitter.com/terms/display-requirements

    EDIT: Oops… missed the line about this in de article… still… might want to add the Tweet Actions.

    1
    • 3

      Hi Ruurd,

      I expanded on the notice section a bit after reading your comment, we should have emphasized this more. The main goal of the article is to teach the method. Once the method has been learned, pulling a user image and adding the Twitter logo and so on is trivial :)

      Thanks for the notice though. hopefully now it is more clear,

      Daniel

      0
    • 4

      @Ruurd de Boer : Hi, this is a great comment. Display requirements are quite clear about the fact tweets MUST ” be shown in a way that meets the user’s expectation – whether on a mobile phone, on a web site, in a desktop application, or anywhere else. ”

      @Daniel Pataki: Hi thanks for this article. However I do not see why you do not use the transient API which is would be recommanded in this case (I mean tweets are temporary).

      I’ve noticed that datas are not sanitized (input and output). I think it should be.

      Hope that helps.

      1
  3. 5

    Be careful with this. Twitter changed requirements with how tweets must be displayed on third party websites, and I think you’re in violation of a few of their terms. This could result in your API key being blocked.

    More info: https://dev.twitter.com/terms/display-requirements

    0
  4. 6

    Jakub Jasiulewicz

    June 27, 2013 1:40 am

    Instead of using a Settings API and saving tweets as an option, you can use a WP Object Cache built in WordPress to fetch and store tweets. http://codex.wordpress.org/Class_Reference/WP_Object_Cache

    2
    • 7

      Hi Jakub,

      That’s a great way to do it as well! I didn’t want to go there, I was afraid the article would be a bit too technical and it would loose focus. We used a quick and dirty time detection to make sure we aren’t pulling tweets every second but the object cache is a better solution for sure.

      Daniel

      0
    • 8

      Good point!

      Most of the widget twitter-crawler are doing this on every page refresh. If you have more than houndrets of visitors/day, you’re in trouble.

      Well, you will not come around to the cache the whole content and take the caching and crawling-functionality out of wordpress. An external script can be called by a cronjob and a fixed interval.

      @Daniel
      Nice Article! :)

      #mario

      1
  5. 9

    Its great – but easier way is use some for wordpress plugin or just page given plugin embed like https://dev.twitter.com/docs/embedded-timelines or http://twitterforweb.com/

    1
    • 10

      Hi Peter,

      The goal is not “the easiest” method, its to show how this can be done DIY. There are many readily available solutions and better way of doing things, but this is the first step if you want to do it on your own :)

      2
  6. 11

    Thanks for the detailed article. I created a non-widgeted, functions.php-based Twitter ‘widget’ cribbed from a number of articles I’d seen online, and this would have been of help too.

    To get around the ‘rate-limit’ issue of requesting the Twitter feed on every page load I used WordPress’ TRANSIENTS API to cache the results every five minutes instead of your database method.

    I’m wondering if you or any other developers have thoughts on what the most efficient method would be?

    0
  7. 13

    If it ain’t broke, don’t fix it. Twitter feeds were easy to implement until recently. A developer could much more easily customize the look of the feed and it was easily edited with one variable to pull in another twitter account. Then, twitter killed it all. I wonder how many millions of development dollars were wasted this year due to twitter killing off the previous feed script and forcing everyone into their feed lot.

    12
  8. 15

    “…Placing a Twitter feed on one’s website has almost become compulsory…”
    Really?
    This is *almost* totally false. Not only could this slow down operations of the site, but people are going to go to the source (Twitter) – Not some third party site, that’s regurgitating content already on Twitter.

    Regardless, the post is nice (although the result *might* be in violation of some Twitter requirements). Of particular credit, is that the author took the time to ease up on the technical aspects as much as possible (ostensibly to help those who are not as technically involved).

    From personal experience (we surveyed clients several months back) and the overwhelming feedback regarding Twitter (and other like feeds), was that Twitter feeds were annoying and didn’t serve a “real” purpose. When we asked why, the response was that if they’re interested they would go to Twitter and follow the appropriate feed (person) directly. That being the site content should provide the call to action (to follow the author on Twitter).

    3
    • 16

      It’s just me, but when I see a company blindly follow Facebook and Twitter, I just get the feeling that they enjoy going with the herd rather than standing out from it.

      It’s one thing when a luxury car omits its own OFFICIAL website URL in a commercial in place of a Twitter account; that definitely shows that Twitter is at the forefront of trends, but from a business standpoint, which will do more for you? A Twitter site? Or your corporate website that integrates Twitter functionality?

      These things are fads, they will pass, as unlikely as it seems today. There was a time when people thought Geocities was the greatest thing. Times change, why not lead the charge in doing so, and make a left while everyone else makes a right? :)

      1
  9. 17

    I would love to see an up-to-date tutorial like this that is not WordPress-centric and is streamlined for Rails.

    I’m bookmarking this anyway because it’s a good tutorial and may help me to architect the widget I need on my own… thank you!!

    2
  10. 19

    There’re places where there’s no such thing as Twitter.

    0
  11. 20

    Old twitter logo, eww

    3
  12. 21

    i found this which is much simpler but they used different API function than codebird. didn’t work well with caching plugin like wp-super-cache. they empty up after the transient expired.

    0
  13. 22

    Why no javascript API examples?! Seriously?

    1
  14. 23

    Really dissapointed Twitter killed the old API, I was using the XML feed for my widget plugin across a bunch of my themes — was a complete hassle to go through and make updates. Any chance you can post the completed code up on Github?

    0
  15. 25

    Hi there,

    Just found this today, apparently, Twitter has its own tool for creating widgets—making your own could have bad results with the company becoming all stingy with its API:

    https://twitter.com/settings/widgets

    0
  16. 26

    The codebird section kills my site. Every time I put the code into my functions file, I get a 500 server error?

    0
  17. 27

    Hi Daniel,

    Thank you for the great tutorial. This is honestly the best tutorial utilizing Codebird and WP I have come across. And believe me, I did quite the extensive search on this topic.

    I do have a couple of questions.

    1. Looking at the live widget on your Musico theme, it looks like some characters are not being displayed correctly.

    2. For me, all of the links are just being displayed as text, and they are not hyper-linked. Any reason why that would be? I pretty much copied your exact code.

    0
  18. 28

    Great article, although I am not sure if using Twitter API on the backend would be the best solution for styling the tweets.

    Probably the easiest way to do the same thing without using any plugins would be to simply use Twitters embedded timeline, which inserts an iframe into the page. And then just get the content of the iframe (for example with jQuery: $(‘#twitter-widget-0′).contents().find(“body”) )

    Once you’ve got the content – you can style it however you prefer.

    This way nothing is done on your server – just twitter server and client’s machine.

    1
    • 29

      If anybody is looking for a solution to this problem that doesn’t involve any coding, I’ve just installed this plugin and it’s worked like a dream: http://wordpress.org/plugins/oauth-twitter-sidebar-widget/

      1
      • 30

        This was the best link of all here. Download the widget from Twitter, upload it to your root, go to your dashboard and activate the widget in your plugins, and then add the widget onto appearance in the widgets tab!!!
        I tried to follow the directions of the original article and it threw me some bad “headers” returns….I tried at the various bad return files and could find nothing that would indicate where the bad “headers” line originated to no avail. I tried the codebird dealio and that was pretty much not good.

        Anyway, for people who are just copying and pasting the commands and whom do not know exactly what the various coding means, the link to the twitter sidebar widget is the way to go.

        And, I do thank you Daniel. You article was very informative, it is just a tad over my head and I couldn’t figure out the various coding issues with my header bar. The code actually froze my wordpress page before I erased the line “” include( MyCustomizer.class.php’ ); “”.
        That one line killed the deal for me.
        Anyway, thank you again.

        0
  19. 31

    What about the following Tutorial : akashchakrawarti.com/twitter-api/

    0
  20. 32

    great article i was wondering how this was done

    0
  21. 33

    I seem to be getting an error ‘Fatal error: Class ‘Codebird’ not found’ in my functions.php on the following line:

    ‘Codebird::setConsumerKey( $consumer_key, $consumer_secret );’

    Even though I have included codebird with include( ‘codebird.php’ );
    codebird.php is in the root of my theme directory. Any ideas?

    0
    • 34

      You are now required to use Namespaces. So you have to change that function contents for this:

      function my_twitter_api() {
      global $cb;
      $consumer_key = get_theme_mod( ‘consumer_key’ );
      $consumer_secret = get_theme_mod( ‘consumer_secret’ );
      $access_token = get_theme_mod( ‘access_token’ );
      $access_secret = get_theme_mod( ‘access_secret’ );

      include( ‘codebird.php’ );
      CodebirdCodebird::setConsumerKey( $consumer_key, $consumer_secret );
      $cb = CodebirdCodebird::getInstance();
      $cb->setToken( $access_token, $access_secret );
      }

      By the way, the original contents is missing a semicolon after “include(‘codebird.php’)”. It is fixed here.

      0
  22. 36

    How to post <?php in the post?

    0
  23. 37

    Great article thnks :)

    0
  24. 38

    Great trick. Thanks for your this awesome post/

    0

Leave a Comment

Yay! You've decided to leave a comment. That's fantastic! Please keep in mind that comments are moderated and rel="nofollow" is in use. So, please do not use a spammy keyword or a domain as your name, or else it will be deleted. Let's have a personal and meaningful conversation instead. Thanks for dropping by!

↑ Back to top