Integrating Twitter search into your WordPress blog

Follow Me on Pinterest

Integrating Twitter search into your WordPress postRecently we had to add a Twitter stream to one of our Facebook tabs for a campaign for the forthcoming Horrible Bosses movie.

I thought I would share with you php code that uses a short code in your wordpress post and dynamically creates a twitter search panel based on a search term you specify.

All WordPress enthusiasts may think that this is extremely easy but I thought I would share this for any who is not familiar with WordPress and how shortcodes work.

Short codes are used in WordPress to allow the user to insert content into their blog posts or pages by just adding one line of text amongst their html. WordPress then breaks up this short code and calls a function your specify to execute your code and inject the content into your WordPress post.

Below shows how to embed this twitter search into your blog. Add this to your functions.php page in your theme directory.

The short code below will add a twitter stream for Substance Movies once inserted into your html or design view:

[twitter-search term="@SubstanceMovies" num="50"]

This will then add the stream below which you can then style to suit your needs.

Twitter Stream using a WordPress Short code

You can now place this inside any post or page!

I hope this helps.

Filed Under: Blog, Code Share, Social, Wordpress
Tags: , , , , .
Bookmark: permalink.

Let me know what you think:

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>