Easier TopicExchange Trackbacks for WordPress [en]

A WordPress hack which makes it quicker to add TopicExchange channels to trackback, and makes them visible (like categories) in the weblog. (Sorry for the duplicate postings, trying to fix it.)

[fr] Ce 'hack' pour WordPress permet d'ajouter facilement des trackbacks vers les canaux de TopicExchange, et liste sur le weblog les canaux concernés pour chaque billet.

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).

Also in post.php, after the line add_meta($post_ID);, insert the following code:

// add topic exchange channels
	if(isset($_POST['ite-topic']))
	{
		$_POST['metakeyselect'] = 'ite_topic';
		foreach($topics as $topic)
		{
    		$_POST['metavalue'] = $topic;
    		add_meta($post_ID);
    	}
    }

In 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"
tabindex="8" /></p>';
	$form_trackback.=$form_ite;

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 my-hacks.php.

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 behas been 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.

Similar Posts:

9 thoughts on “Easier TopicExchange Trackbacks for WordPress [en]

  1. The plugin “Kitten’s Quick Trackbacks” does something similar to my hack, but not identical. My solution works only with ITE trackbacks (whereas Kitten’s works for any trackback), but takes the whole thing one step further by displaying the trackbacked topics in the weblog posts.

    Any help to wrap my quick hack into a proper plugin would be very much welcome, as I’m a bit lost when it comes to creating plugins.

  2. Pingback: mtl3p
  3. Any people interested in making this into a plugin should definitely go for it and get in touch.

  4. I’m currently using a different blog software called Serendipity, I’m truing to get soometing like this to work for me but its starting to give me a headache.

    I don’t consider myself a newbie but this XML APIs have been very tricky for me. If anyone has worked with s9y and done this (automate trakback to topicexchange), I would appreciate any help you can provide me.

  5. I'm currently using a different blog software called Serendipity, I'm truing to get soometing like this to work for me but its starting to give me a headache.

    I don't consider myself a newbie but this XML APIs have been very tricky for me. If anyone has worked with s9y and done this (automate trakback to topicexchange), I would appreciate any help you can provide me.

  6. Pingback: Smarking

Comments are closed.