Share On Facebook Widget
I have added a small ‘Share On Facebook’ widget to the bottom of my posts. You can see an example of it here :
The code for the widget on this page is :
<p class="sharefb"><a href="http://www.facebook.com/share.php?u=http://theimpossibleprincess.wordpress.com/2008/09/30/kylie-films-comedy-cameo/" target="_blank">Share On Facebook</a></p>
Each time I use the widget I have to manually change the URL of the post in the above code. Is there a way to dynamically (if that’s the right word) generate the post URL in the code?
No, you will have to do it manually.
You don’t have to do it manually. Go to addthis.com, sign on, the take some html code, put it in a sidebar widget, and when people are viewing a post or the homepage, they can save the post or homepage to facebook or many other sites. If you want to see how it works, try it out on my bog first. The code is really simple and doesn’t contain js which isn’t allowed here. The code I use is this:
<a title="Bookmark and Share" href="http://www.addthis.com/bookmark.php" target="_blank"> <img src="http://filipspagnoli.files.wordpress.com/2008/09/addb1.png" width="16" height="16" border="0" alt="Bookmark and Share" /> Bookmark/share a post</a>
Thanks for the advice.
I’ve had addthis in my sidebar in the past but didn’t realise it could be used to share specific posts, I always assumed it was just a bookmarking tool. When the new version of WordPress.com was rolled out earlier in the year a bug (which is now fixed) caused me to loose all of the text widgets in my sidebar and I forgot to put addthis back.
I’ve looked into addthis overnight and it is actually quite easy to customise using my WordPress stylesheet so hopefully I should be able to create a nice looking universal widget which I can insert at the bottom of each post.
But you can’t use the addthis.com function to a wordpress.COM blog, right? Only to a wordpress.ORG?
@uepibooks, I think it looks like you can use it at wordpress.com. There’s nothing in the code that filipspagnoli posted which wouldn’t work here, and it certainly seems to be working fine on his blog. Try it and see!
Nevermind, I get it. Thanks a lot!
The topic ‘Share On Facebook Widget’ is closed to new replies.