A Wordpress Plugin to Enrich the Content of your Post

Bookmark/Share » Post A Wordpress Plugin to Enrich the Content of your Post to digg. bookmark on del.cio.us Add TheLiveWeb.net to Technorati. add to stumbleupon Post A Wordpress Plugin to Enrich the Content of your Post to Reddit Google Bookmark

I wrote a Wordpress plugin to enrich the content of the post in a configurable manner. This plugin is generic enough to be used in wide variety of situations so I am sharing this with all of you.

Here is the problem that I was trying to address. Many a times, we want to link to certain sites so that the reader can get more information about the topic, e.g. if the post talks about Google stock, then bloggers would like to create a link pointing to something like Google finance site that shows current price of Google. One way to do this, of course, is to link all such occurrences to http://finance.google.com/finance?q=Google manually. However this can better be handled by adding the link using a plugin since it gives you the option of deciding which link to show (e.g. Google Finance vs. Yahoo Finance etc) without altering the post content.

The same idea can be used to create a link to wikipedia, search on Google news, find photos for the given subject on flickr, letting user search a term on web and so on.

Following is how this plugin works. When you’re writing the post, use the following structure to tell the plugin that you want the content to be auto-linked. If you write the following:

"..The <enrich type="stock">Google</enrich> stock has been doing
 very good recently..."

The plugin parses and replaces the above sentence by this:

"..The Google stock has been doing very good recently..."

As you see, the word “Google” is now linked to the Google Finance site.

Similarly

"... Read more about <enrich type="wiki"> Web2.0 </enrich>
on wikipedia..."

is rendered as

"... Read more about Web2.0 on wikipedia..."

If you’re familiar with Facebook application development, you’d notice the idea is very similar to the way FBML transforms the content like <fb:user id=”x” /> by a html link showing user’s name and linking to user’s profile. This plugin applies similar idea in the context of blog posts.

Currently, it uses a config file to map the types like stocks, news, wiki etc to the url pattern. Following is how enrich-content.ini file looks like:

stock=http://finance.google.com/finance?q={v}
news=http://news.google.com/news?hl=en&ned=us&q={v}&btnG=Search+News
wiki=http://en.wikipedia.org/wiki/{v}

The {v} is the placeholder for the value that’s replaced in the url. You can add as many type to url mapping here as you want.

Installation

  • Download the plugin : Enrich Content Plugin
  • Extract both enrich-content-0.1.php and enrich-content.ini under wp-content/plugins directory
  • Go to Plugins admin page and activate “Content Enricher Plugin”
  • Add/modify the entries in enrich-content.ini file

Future Enhancements

I am thinking of adding the following features when I get time.

  • Ability to comment the mappings in file
  • Add support for specifying the mapping using Admin page
  • Ability to specify different values for the text used in urls and the text that actually gets shown to the user

Hope you find it useful. Comments/Feedbacks Welcome!

If you liked this post or find this website useful, please consider subscribing to the full feed RSS. You can also subscribe by Email and have new posts sent directly to you.
Share » Post A Wordpress Plugin to Enrich the Content of your Post to digg. bookmark on del.cio.us Add TheLiveWeb.net to Technorati. add to stumbleupon Post A Wordpress Plugin to Enrich the Content of your Post to Reddit Google Bookmark

Next Steps »

6 Responses to “A Wordpress Plugin to Enrich the Content of your Post”

  1. [...] in most cases I can add new features to it by either using existing plugins or writing my own like this one and then optionally sharing it with the [...]

  2. Good blog

  3. Thanks for the post,

  4. I really love to try it out. This is something new

  5. Hmmm, I am tempted to try this.

  6. Hmm. Good post.

Leave a Reply

Related Posts from the Past: