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.
- 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
- 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
- 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🙂 )
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 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:
- Create a Digest Post
- Switch title and description in any RSS feed
- Remove older results from a feed
- Get a list of post titles and links (no description) from a Google Reader shared items feed
- Get your Technorati Rank as an RSS feed with a link to Add to Favorites
- You will need your Technorati API key
- Filtered Technorati Recent Mentions – shows the blog urls of the recent links to your blog
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.
(they are plugins for the user’s web browser, not for the blog server software)
Examples of WordPress.com “plugins” using Greasemonkey:
- Akismet Auntie Spam
- WordPress Comment Ninja
- WordPress Category Resizer
- WordPress.com Stats for Pages
- Random WordPress.com Blogs
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.
- More information on XML-RPC on Wikipedia
- XML-RPC docs for MovableType (best API docs I could find)
- Using Perl to post to a WordPress blog via XML-RPC
- XPL-RPC API for Blogger
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:
- Tag Cloud Generator – build tag clouds or heat maps (this was before there was a tag cloud sidebar widget)
- Technorati Favorite Your Fans – Add everyone who has favorited you on Technorati to your list of favorites
Instead of being a program that runs on the server, these are programs people run on their computers.
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.
engtech 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