Skip navigation

5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com

by engtech of Internet Duct Tape

As a reader of Lorelle On WordPress you might already know there is more than one type of WordPress blogging software, but most people who know what WordPress is have no idea there are different flavours of it.

  1. WordPress
    • also called self-hosted WordPress, or WordPress.org
    • has one blog that you have full control over
    • you have to find somewhere to host it yourself
  2. WordPress MU
    • also called WordPress Multi-user, it’s what WordPress.com, edublogs.org, blogsome.com run
    • is a very limited multi-blog platform (more than one person has a blog on it)
    • it’s much easier to sign up for an account, but you have fewer options for customization
  3. WordPress.com VIP
    • WordPress blogs hosted on WordPress.com for higher than average hosting fees
    • (Confused yet?)
    • they have the similar customization options to self-hosted WordPress (I think — I’ve never had one :) )

Creating a plugin for WordPress is usually done with PHP code that gets installed with the blog software. Adding a widget is a matter of inserting some Javascript or an embedded Flash object. I’m one of the very few people who create plugins and widgets that work with WordPress Multi-user blogs and self-hosted WordPress blogs. Creating plugins and widgets that work with WordPress Multi-user sites like WordPress.com is a Hack with a capital H and smart people don’t do it.

This post won’t explain how to do things step by step. My intention is to make people aware of some of the black magic voodoo that is at your disposal if you want to write a custom plugin or widget for WordPress.com. The intended audience is people who already have programming skills, because things can get hairy.

Understanding the Constraints

Creating a plugin or widget for WordPress.com is much different than creating a plugin for self-hosted WordPress because of all of the things that are restricted on WordPress Multi-user blogs.

  • Can’t modify blog theme
  • Can’t modify PHP code
  • Can’t add Javascript code
  • Can’t embed other pages using the IFrame tag
  • Can’t embed Flash
  • Can’t embed CSS styles (need to buy the CSS upgrade)

You’re beginning to see why there aren’t more people writing plugins or widgets for WordPress.com. Any sane person would look at that list of restrictions and realize that all the easy and clean ways of customization are removed. I’m too stubborn to take the easy way out, or else this blog post wouldn’t exist.

Voodoo Trick #1: The RSS Widget and Yahoo Pipes

The only way to put dynamic information into a sidebar widget is using RSS. Building your own application to create an RSS feed can be complicated (plus you’d need your own server — so why are you using WordPress.com?) Thankfully, Yahoo provides a service called Yahoo Pipes that let you merge, mash, filter, and combine other RSS feeds into a new feed. It even has the ability to use XML / JSON responses as inputs so you can use APIs from other sites. The interface is GUI based and it has support for regular expressions.

Here are a few pipes I’ve created that might be of general interest:

Here is a complete list of all of my pipes.

This trick can also be used to build a blog maintenance start page on RSS homepage sites like Netvibes.

Voodoo Trick #2: Creating Custom Images

This one only works if you have a webpage where you can host the image files. The image file will dynamically change independently of your WordPress.com blog.

I haven’t tried this myself, but this is how MyBlogLog supports WordPress.com.

Voodoo Trick #3: Firefox and Greasemonkey

Firefox is your best friend if you want to customize web pages on the fly. Greasemonkey is an extension that lets you include any one of thousands of custom scripts people have created for interacting with websites. I’ve written a great guide on how to install a Firefox extension and another guide on why you would want to use Greasemonkey and how to install it. I really recommend reading the Greasemonkey guide — I am quite proud of it.

This is one of the most userfriendly ways to create plugins for WordPress.com because they run in the Firefox web browser. It’s also trivial to create a script that will work with WordPress.com *and* self-hosted WordPress. Knowledge of Javascript, CSS, XPath and Firebug are essential for creating Greasemonkey scripts.

(they are plugins for the user’s web browser, not for the blog server software)

Akismet Auntie Spam will automatically download all of your spam

Examples of WordPress.com “plugins” using Greasemonkey:

A complete list of all of my Greasemonkey scripts

Voodoo Trick #4: XML-RPC

WordPress.com and self-hosted WordPress both have an interface for creating blog posts called XML-RPC. As a matter of fact, XML-RPC even works with other blog platforms like MoveableType. Blog editing programs like Windows Live Writer use XML-RPC to interact with your blog.

I have used XML-RPC to do things like turn off comments on all posts older than two months. If you do write XML-RPC based programs, be sure to created a copy of your blog for development since they usually involve editing posts.

Voodoo Trick #5: Webscraping

Now that you know that you can use RSS feeds as a widget, and you can automatically post to your blog using the XML-RPC interface, I hope you begin to see the possibilities. The next technique in your bag of tricks is webscraping. The idea is that you can write a script that retrieves a web page, pulls information out of it, and then puts that information up on your blog using XML-RPC or RSS.

I like to use Perl with WWW::Mechanize for web scraping. I’ve written a few programs using it for interacting with web sites:

Instead of being a program that runs on the server, these are programs people run on their computers.

tag cloud generator for wordpress.com - example flowchart

Summary

Writing plugins and widgets for WordPress.com can be more trouble than it is worth because you have both hands tied behind your back, you are blindfolded and there’s someone standing in front of your getting ready to trip you. But there are ways to do it with Greasemonkey, RSS and XML-RPC. What I hope you take from this post is that it is possible. Then maybe there will be another crazy sucker out there doing it.


Internet Duct Tape logoengtech blogs regularly at Internet Duct Tape. His latest posts were 7 Tips for Learning the Declutter Habit, Blog Tip: Creating a Blog Maintenance Start Page with Netvibes, and Do You Make These Mistakes with Wikis?Subscribe to Internet Duct Tape by RSS or by email

8 Comments

  1. Posted September 27, 2007 at 8:55 am | Permalink

    :D i was smiling when i saw my picture while i’m reading this :D hehe…

    but then again, great post !

  2. Posted September 27, 2007 at 9:34 am | Permalink

    OMG! Engtech, you’ve shared the secret ingredients in your secret special sauce from your WordPress.com blog! Wow! I’m honored, and greedy. I can’t wait to try some of these myself. This is brilliant! Thank you!

  3. Posted September 27, 2007 at 12:19 pm | Permalink

    This is very impressive! Pretty shocking to be scrolling along in my feed reader and see my face, too ;) .

  4. Posted September 27, 2007 at 12:50 pm | Permalink

    Great post! I was surprised to see my own icon in the image up there though! ;)

  5. Posted March 23, 2008 at 7:02 pm | Permalink

    I see myself! (I’m the fish.)

  6. 203Σ270
    Posted June 10, 2008 at 2:13 pm | Permalink

    Wow!!! I was totaly lost, I had no idea that there was a difrence between WordPress.org and WordPress.com here I was pulling out my hair, wondering why none of the options stated on the plugin instructions were showing up on my dashboard or anywhere else.

    Thanks!!!

  7. Posted June 10, 2008 at 7:46 pm | Permalink

    @ 203Σ270:

    There is a huge difference between the two, which is stated on their websites. I’m glad you now understand the difference.

  8. dsullivan9026
    Posted January 31, 2009 at 9:07 am | Permalink

    Lorelle, Not only are you knowledgeable about WordPress widgets, you also share a rather unique first name with my oldest daughter! My question is this, is there any simple way to add a scrolling banner widget to my WordPress blog? I fear I already know the answer, but will ask anyway.


13 Trackbacks/Pingbacks

  1. [...] 5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com  [...]

  2. [...] 5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com (Lorelle on WordPress) [...]

  3. [...] read more | digg story [...]

  4. [...] 5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com [...]

  5. [...] 5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com from Lorelle on WordPress [...]

  6. [...] 5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com from Lorelle on WordPress [...]

  7. [...] It’s the last one I want to talk about. I’ve gotten tired of using Yahoo Pipes + Pipe Cleaner to build digest posts. It’s kind of a pain in the butt. So I want something that can take an rss feed, convert it to html so that I can use another program for automatically posting it to the blog. I’m not going the plugin route because of WordPress.com’s inability to support javascript or PHP plugins. [...]

  8. [...] 5 Advanced Techniques for Creating Plug-ins and Widgets for WordPress.com [...]

  9. [...] 5个高级技巧教像如何为WordPress.com博客创建插件和Widget [...]

  10. [...] 5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com « Lorelle on WordPress [...]

  11. […] 5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com by Engtech of Internet Duct Tape lists five great tips and techniques for pushing WordPress.com beyond its limits with Firefox Greasemonkey scripts and so much more. If you think WordPress.com blogs are for the blog-illiterate, his article will turn your head around and please geeks and teckies alike. […]

  12. […] 5 Advanced Techniques for Creating Plugins and Widgets for WordPress.com by Engtech of Internet Duct Tape lists five great tips and techniques for pushing WordPress.com beyond its limits with Firefox Greasemonkey scripts and so much more. If you think WordPress.com blogs are for the blog-illiterate, his article will turn your head around and please geeks and techies alike. […]

  13. […] 5个高级技巧教像如何为WordPress.com博客创建插件和Widget […]

Post a Comment

Follow

Get every new post delivered to your Inbox.

Join 20,972 other followers

%d bloggers like this: