What? No crappy pun? Ah well...
So Del.icio.us recently released a new widget that allows you to make adding pages to del.icio.us even easier. Naturally, I wanted to add it here. What's more, it gave me a chance to poke around in the code and discover a few things.
First a few words about Wordpress. If you haven't created a custom theme yet, you really need to. It's not hard, and it makes things like this not disappear when you upgrade next time.
Ok, now that you've done that, the bits you need to add are pretty straight forward. In your brand new theme directory, you need to modify index.php and single.php.
Near the top of the file add:
<script type="text/javascript">
if (typeof window.Delicious == "undefined") window.Delicious = {};
Delicious.BLOGBADGE_DEFAULT_CLASS = 'delicious-blogbadge-line';
/* Set manual mode so that we can have multiple badges */
Delicious.BLOGBADGE_MANUAL_MODE = 1;
</script>
See that last line? That's kinda key. That's what keeps the script from running instantly.
Inside the post loop, add:
<script type="text/javascript">
Delicious.BlogBadge.writeBadge('delicious-blogbadge-<?php the_ID(); ?>',
'<?php print get_permalink(); ?>',
'<?php print preg_replace('/\'/',"/\\'/",get_the_title()); ?>', {});
</script>
and then, near the end of the page add:
<script>
Delicious.BlogBadge.onload();
</script>
That sets things in motion.
So, what's it do? Well, it adds that thing at the bottom, and customizes it to point to the specific post's URL and use the right title.
Easy? You betcha! Thanks Del.icio.us folks!
And if you don't want to do that,
Ivan Uzunov has created an easy Wordpress plugin.