Implementing custom HTML in WordPress

As you will know from the last post, I’m working on getting Lincoln’s election data into the Open Election Data project. RDFa-ifying the content on our website was fairly straightforward involving me having to add funky attributes to the HTML pages. The next step, however, was a bit tougher as links to the pages had to be discoverable. Again, this involved adding some custom RDFa attributes to the HTML – this was not possible in our admin system without some severe jiggery-pokery, so I turned to the recently launched data.lincoln.gov.uk.

What should have been straightforward, however, still proved problematic. I set up this post initially and grit my teeth upon the first publish when I realised that WordPress had filtered out all the RDFa goodness. This is down to the built in kses filter which ensures that no ‘dodgy’ code is put into posts and comments. Comments I’m more than happy to have protected but, as I’m the one who controls the posts, I was more than a little grumpy that I was being denied free regin.

I did some digging, came up with a number of people having the same problem, tried editing the kses file, hit head on wall and then eventually came across this plugin. It’s a beauty of a plugin and does exactly what I needed – allows you free reign to add whatever HTML you want to your WordPress posts. Installed, activated and now the ward list on data.lincoln.gov.uk is fully RDFa-ified. Simples.

So, if you need to fiddle the HTML, maybe adding some RDFa or microformats, on your WordPress blog, make sure you fire that plugin up.

Advertisements

2 thoughts on “Implementing custom HTML in WordPress

  1. Unfortunately, I think this solution only applies if you’re hosting WordPress yourself. For us poor WordPress.com users, we are still slaves to whatever WP have installed — and they still forbid Javascript! 😦

  2. You make a very good point there however I can also see why WP.com restricts itself in such ways – total open-ness leads to opening yourself (WordPress.com) up to malicious attacks which is not good for the customers. If you’re in a situation where you’re controlling your own environment you can start to be a bit more open about what you do with the technology you’re using.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s