Updated WordPress Twitter Functions

Since the retirement of version 1.0 of Twitter’s API is underway, I’ve been updating the Twitter integration code in the Techozoic Fluid theme. I don’t agree with all the changes to the API, especially the requirement that all API requests, even for public info, must be signed. Luckily someone has already done the hard work creating a library for signing the requests with the proper oAuth signatures. The tmhOAuth library can be found on Github. It will be required for the new functions.

The first step is to register a new Twitter application. After signing into Twitter visit the Applications area of Twitter, and create a new application. After creating the application make sure create the access token at the bottom of the Application screen, this will authorize the application to access your account. You will now need 4 separate keys to properly sign the API requests. You’ll need the Consumer key, Consumer secret, Access token, and Access token secret. These will be added to an array and passed to the function and in turn passed to the oAuth library to sign the request.

These two functions below can be used to pull your Twitter timeline and automatically convert all links, hashtags, usernames, and media to the proper format using entities. The same function can also be used to pull a follower count. Examples of how to use are included in the code below.

About Jeremy Clark

Small town IT worker with interests in all things technological and technical. Biggest interests are in web development especially the WordPress publishing platform and the community supporting it. Currently developing and maintain the free WordPress theme Techozoic. I'm also always available for hire.
This entry was posted in Development, Internet, tech, wordpress and tagged , , , , . Bookmark the permalink.

8 Responses to "Updated WordPress Twitter Functions"

Leave a replyLeave a Reply to Jeremy Clark

Comments will be sent to the moderation queue.