Dec
15
2008

Adding Social Bookmarking Links to WordPress

by   |  Posted in Tutorials  |  6 comments

There are plugins that do this but once again, I’m a code junky and I love being able to go in and manipulate the code to get what I want. I just recently added some social bookmarking links at the top of this site, as you can see.

Here is the code I used in my header.php file to make them all work.

<a href="http://technorati.com/faves?add=<?php bloginfo('url'); ?>" target="_blank"><img src="<?php bloginfo('url'); ?>/images/technorati.png" alt="Add to Technorati" /></a>
<?php if(is_home()) {?>
<a href="http://digg.com/submit?phase=2&url=<?php bloginfo('url'); ?>&title=<?php bloginfo('name'); ?>&bodytext=<?php bloginfo('description'); ?>" title="Digg this story" target="_blank">
<?php } else { ?>
<a href="http://digg.com/submit?phase=2&url=<?php the_permalink() ?>&title=<?php the_title(); ?>&bodytext=<?php the_excerpt_rss() ?>" title="Digg this story" target="_blank">
<?php } ?>
<img src="<?php bloginfo('url'); ?>/images/digg.png" alt="Digg this story" />
</a>
<?php if(is_home()) {?>
<a href="http://del.icio.us/post?url=<?php bloginfo('url'); ?>&title=<?php bloginfo('name'); ?>" target="_blank">
<?php } else { ?>
<a href="http://del.icio.us/post?url=<?php the_permalink() ?>&title=<?php the_title(); ?>" target="_blank">
<?php } ?>
<img src="<?php bloginfo('url'); ?>/images/delicious.png" alt="Add to del.icio.us" />
</a>
<a href="<?php bloginfo('url'); ?>/?feed=rss2"><img src="http://bavotasan.com/images/subscribe.png" alt="Subscribe to <?php bloginfo('name'); ?>'s RSS Feed" /></a>

You can copy the images from my header and then change the bavotasan.com/images folder to point to your own.

About the author:

A freelance web developer living in Montreal who spends most of his time writing for this site and building Premium themes for WordPress. You can find him on Twitter @bavotasan.

Site5 Affiliate Link
If you liked this, please share it.

Tags: , , , , , , , , , ,

Short URL: http://bit.ly/cM4fFq

Discussion 6 Comments

  1. Liz on July 13, 2009 at 6:38 am

    It’s great to know those codes and design your page the way you want it to. It’s pain instructing someone how you want it to look and then not getting what you really want. I remember putting on those social bookmarking plug ins crowding at the bottom of my every post. I wish I can be like you.

  2. bob on October 4, 2009 at 4:37 pm

    Thanks for the information,it will come in quite handy for my site. Keep the info hot this helps people with business websites.

  3. Andrew Peltzer on December 12, 2009 at 4:47 pm

    Visiting your Blog today. Thanks for this information. Pleased to meet you.

  4. Isolant mince on March 21, 2011 at 5:31 am

    Thank you for this code. It’s very useful.

  5. Rebecca Wolf on May 15, 2011 at 5:48 pm

    I was wondering how the WP template I have managed to add that to the header. Now I can experiment with different themes and still have my social bookmarking links highly visible. Thank you for sharing!

  6. Irmgard Lindsey on May 17, 2011 at 6:08 pm

    I am a freelance Internet marketing and I am a newbie in the business. Thanks so much for sharing this tutorial. I will surely apply it with my business. Do you have any other blog sites discussing stuffs like this? Please let me know.