Singpolyma

Technical Blog

Picoformats for WordPress

Posted on

This plugin is totally an experiment inspired in part by @techcrunch, and in part by how useful I have found some of this stuff to be on @Twitter, and also just to see the different ways one can use WordPress. (Update: this plugin seem to only work on WP2.5, so I’ve upgraded.)

If you haven’t guessed already, you soon will. Yes, I’ve implemented @ replies for WordPress. It looks in the local users (usernames and nicknames, like @singpolyma) first, then in the names and descriptions on blogroll links, the it checks if you are trying to use a URL (like @singpolyma.net) and, finally, if none of those yield a result it checks if the string is a valid Twitter username. It produces semantic markup for an @ reply and “person tag”:

<span class="reply vcard tag">@<a class="url fn" href="URL">NICKNAME</a></span>

Then, the plugin sends trackback pings to the URLs, to let the people know you’re talking about them. The plugin also implements trackback receiving on the WordPress main page so that users can receive these pings.

Not to stop so short, the plugin also implements #. What that does should be fairly obvious.

These features work in posts *and* comments.

Download the plugin

# # #

7 Responses

Aditya Mukherjee

Ah, looks like you find the trackback function as well 🙂

Going through the code, I see it will only work if both [A] && [B] have the plug-in. Maybe if you got the latest post (from the feed?) and sent a ping to that in case you couldn’t find the RDF info on the home page?

Broadens the scope a little more 🙂

Geekaholic

Picoformats for WordPress…

While the discussions continue about decentralizing Twitter, developer-friend Stephen has gone ahead and implemented the symbolic feature of Twitter – @replies – in a plug-in that allows its users to have cross blog conversations. Awesome. (!)
……

Aditya Mukherjee

Another thing. Currently, you’re altering the post content before saving to the database. It’ll be better if made the necessary changes to the text as a filter for ‘the_content’, while just sending the trackbacks on publish.

I am a little fussy about my post content not changing, but also because I use Markdown to write my posts, which *will* interfere with this.

Stephen Paul Weber

@aditya – It basically only works if both have the plug-in — I’m not even doing RDF auto detection just now (WordPress won’t do it for me because @ma.tt hates trackback). Pinging their latest post seems like a hack… but I’ve been having trouble thinking of a better way…

On changing before saving – I went back and forth on that myself… one thing is that it can be an expensive operation, and so I only wanted to do it once. I’ll benchmark it as a filter and see.

Aditya Mukherjee

You actually *do* need to do it just once. Capture and ping the links on publish, just don’t change it just then. The major hurdle is getting the correct link to ping, not the change, which is just regexp. That can be filtered on ‘the_content’ when the post is being displayed.

You’ll need to change your regexps, but it’ll work properly with other plugins that affect the post content. Maybe give this a higher priority so that it’s the first thing to affect the content.

(This is based on what I understand from your code … could be WAY off :P)

bluematt

Any chance of modifying this slightly to have a setting that allows you to switch users/nicknames/links on or off so that you’ve just got the Twitter and hashtags functionality?

If you’re happy about it, I’m happy to take some time out to try and hack this in and feed back any changes.

Stephen Paul Weber

@bluematt what, specifically, do you wish you could turn off? If you feel confortable doing it, I would probably accept a patch 🙂

Leave a Response