Adding ‘send to’ links to WordPress posts

Posted on December 3rd, 2006 at 8:35 pm is one of a new generation of community sites that handle your links, posts and articles in interesting ways. prides itself on being the most popular social bookmarking website allowing users to keep their favourite links or bookmarks online, rather than on their PCs. Nothing too remarkable about that you may say but the clever bit comes when they combine this information to use it in other ways. Then you can see if other people have similar links to you, just how popular your bookmarks are and you may find some links that are more useful than your current ones.

Today I decided to add the ‘send to’ links to the bottom of my posts to allow people to automatically add them to the network. This should have been easy as the Save Buttons page has some code there I could use specifically for the the WordPress files which run this website. Unfortunately it didn’t work.

I’ve never programmed JavaScript before so I was stuck on how to make this work. So after around four hours of reading JavaScript primers and some pointing in the right direction online, I managed to fix the code myself.

So for anybody wishing to put a pop-up javascript link on their WordPress posts then please try this code:

<a href="" onclick="'<?php the_permalink() ?>&title=< ?php the_title() ?>','delicious', 'toolbar=no,width=700,height=400'); return false;">Save to</a>

The reasons the original code wasn’t working were the encodeURIComponent functions in combination with the apostrophes. I removed them, as they’re both url encoded anyway, and it seems to have worked. So if you come across this page from a search engine or one of the other new social/community/network sites then please save it to as this could help some more people out.

I may be adding links to the other popular sites such as Digg and Reddit but I’ll need a long rest first.

This entry was posted on Sunday, December 3rd, 2006 at 8:35 pm and is filed under Information, Technology, Web Design. You can follow any responses to this entry through the RSS 2.0 feed.

Please add a comment