Add StumbleUpon to WordPress Blog
StumbleUpon News announced that now we can integrate StumbleUpon with our blogs. It allows visitors directly submit your posts to StumbleUpon(SU).
Here is the tutorial for adding StumbleUpon link to WordPress.
StumbleUpon integration code for WordPress
By referring to the SU integration code, here is the SU integration code for WordPress blogs:
<a href=”http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>”><img src=”http://www.stumbleupon.com/images/stumbleit.gif“/> Stumble it!</a>
The code will create something like this: Stumble it!
Hint: Feel free to change the icon by replacing the filename(stumbleit.gif) with other StumbleUpon icons.
Install StumbleUpon code for WordPress
- Edit “single.php” of your WordPress theme
- Find the following line(or similar, depends on your theme file) in “single.php”
<?php the_content(‘<p class=”serif”>Read the rest of this entry »</p>’); ?>
- Immediate after the line, add the SU integration code for WordPress.
- Now, your code should look like this:
<?php the_content(‘<p class=”serif”>Read the rest of this entry »</p>’); ?>
<a href=”http://www.stumbleupon.com/submit?url=<?php the_permalink(); ?>&title=<?php the_title(); ?>”><img src=”http://www.stumbleupon.com/images/stumbleit.gif”/> Stumble it!</a>
- Save and upload “single.php” back to your WordPress theme folder. Done!
My two cents
I hope you like this little WordPress hack. Why not a plugin? Well, I do not create another WordPress plugin for a simple link.
If you have difficulty to implement this, feel free to Contact Me. :)
By the way, this is My StumbleUpon Page. Please add me as your SU friend. :)
Thanks for the mini tutorial Liew, i’m sure a lot of us will find it handy.
Allen.H
yup, must say, it is pretty useful, maybe you should list them with all other code like del.ico.us, my yahoo, google reader, boing boing and etc. so we can add them one shot
There is a plugin that no need to edit any of your wordpress default php file.
Give it a try.
Social Bookmarks – http://www.dountsis.com/
hey i just found out stumble upon is available as an extension for firefox. using it as an extension and intergrating it in blogs is different? what will the extension do i wonder?
cool stuff!
@Malaysian Food Review: you might want to install somekind of social links wordpress plugin such as sociable.
@lucia: In short, StumbleUpon extension is for YOU, and StumbleUpon link on your blog is for your READERs.
liew, i sent you an email seeking your help on how to do this (integrate SU in my blog). did you received it?
@lucia: yes, received and replied.
Liew, thank you very much for this guide, but what should I do if my theme doesn’t have a single.php file.
I’m using Vistered Little 1.6 from http://scarylittlemonkey.com/
@Dennis: your theme has combined index.php with single.php. You need to edit “index.php” file.
Thank you for your help. It semi-worked ;)
The text got there but not the button and nothing happens except an error when you follow the link.
Again thank you very much for your time and help :-)
@Dennis: I don’t see the SU code on your blog now. I guess you removed it. Please mail your previous code to me, and I try to help again. :)
Hi Liew,
I follow your tips but it doesn’t work. There’s a link without an icon. When I press the link, it gives me the following error.
There’s been a problem finding the page you’re looking for. Apologies. Perhaps . . .
* the page your looking for was moved
* your referring site gave you an incorrect address
* something went terribly wrong
Use the search box and see if you can’t find what you’re looking for.
Appreciate your help. Thanks.
@Jojo: I have no way to help if you.. 1. remove the code on your blog. 2. do not send me the code you used.
Thanks for this. I just added the code to the links for digg and delicious that I somehow (don’t remember how) added to my WP template.
Someone wrote a plugin here. But now that I use WordPress Widgets I can’t use it. That’s really what I’d love to do on my sidebar. Something similar to recently posted delicious links.
Added this on my site as well. Thanks for the code.
If you guys are looking to integrate Digg, Del.icio.us, Yahoo, Google, Stumble Upon (code from this site) on your wordpress installation, click my name here or go to :
http://www.evsionlab.com/2007/04/05/how-to-digg-it-delicious-it-google-it-yahoo-it-and-stumble-it-on-wordpress/
Thanks,
Eugene
Hi
I don’t have the required line in single.php so put it in page template where found the line. But there is nothing showing up at all, what am I doing wrong?
Thanks
Lola
Hello again
I’ve just changed my theme and have put the line of code in the right place. The stumble icon is in my “share it” list, is there a way for it to display with clicking on “share it”?
Sorry!
Ignore previous 2 posts managed to sort out, but can’t get the icon to appear under my posts. Help, keep getting the red cross.
Thanks
Lola
i made a widget for stumbleupon to show icons to your last favourite sites, you can see it at
http://www.fiddyp.co.uk/2007/09/06/stumbled-a-stumbleupon-widget-for-wordpress-22-released/
also a plugin to detect an incoming stumbler and encourage them to give you a thumbs up
http://www.fiddyp.co.uk/2007/09/06/hello-stumbler-wordpress-plugin-for-stumbleupon-visitors/
I hope you like them!
Thanks so much!
I just added that to my site!
Thank you for this. I’ve been looking for it for a while.
I didnt manage to get code from stumble page so hope yours will work! Thanks! I need it for my blog about turkey