Here is a solution to make it a little quicker to trackback TopicExchange channels with WordPress, and make those channels visible in your weblog.
I love TopicExchange. When I asked Suw what they had talked about during BlogWalk, she mentioned trackbacks. I asked if anything had been discussed about trackback etiquette. For example, I’m often tempted to trackback people who have written posts related to mine, but which I haven’t linked to. Well, the consensus is that this is not what trackback is for. Trackback is really for making a “backlink”. TopicExchange is the answer to the “related posts” issue.
I’ve been using TopicExchange a lot during the last weeks, but nobody has noticed it, apart from those people who already use TopicExchange as a source of information. As Seb Paquet notes, TopicExchange needs to be made more viral. It needs visibility. What follows is my interpretation of “making ITE easier to use, and more visible.”
This WordPress hack creates an extra field in the posting form where ITE channel ID’s (e.g. “wordpress”, “multilingual_blogging”) can be entered (I was tired of typing the whole trackback URL’s all the time). It then stores these channel ID’s as post meta data (in the
postmeta table), so that it can retrieve them and display links to the corresponding channels along with the post, just as is usually done with categories.
First of all, add the following code to
my-hacks.php. Then, edit
post.php (in your
wp-admin directory) and add this code where indicated (the comment at the top of the file explains where to insert the code).
post.php, after the line
add_meta($post_ID);, insert the following code:
// add topic exchange channels
$_POST['metakeyselect'] = 'ite_topic';
foreach($topics as $topic)
$_POST['metavalue'] = $topic;
edit-form.php, add this code to create an extra input field for ITE trackbacks:
$form_ite = '<p><label for="ite-topic"><strong>Trackback</strong> TopicExchange:</label>
(Separate multiple channel ID's with spaces.)<br />
<input type="text" name="ite-topic" style="width: 360px" id="ite-topic"
It goes near the top of the file, after the line which defines
$form_trackback (do a search for that and you’ll find it).
Finally, in your
index.php template, you can use
<?php the_ite_channels(); ?> to display a paragraph containing a comma-separated list of channels trackbacked for each post. If you want to change the formatting, play around with the function definition in
If, like me, you have old posts with trackbacks to TopicExchange, and you would also like these to appear on your posts, use this patch from inside
wp-admin. The patch will tell you what meta data it is adding — just load it once in your browser and check the result in your weblog. (Don’t load it twice — it’s supposed to be able to check the existing channels in the database to avoid duplicate entries, but I haven’t got it to work. Read instructions and debug notes at the top of the patch file.)
In future, it will also be possible to use the TopicExchange API to return the “nice title” for the channels listed — so we sould have “Multilingual blogging” instead of “multilingual_blogging”. (I’ve asked, it
will be added to the API.)
Good luck with this if you try it, and as always, comments most welcome!
Note: as far as I have tested, the code seems to work now.