X

Facebook Share outside loop

Use Facebook share link outside the WordPress loop.

It might be difficult to show Facebook share link outside the WordPress loop, since you can’t retrieve post information the usual way. To show a Facebook share link in the sidebar of single post, this snippet will be useful. This will also show how many time the url was shared on Facebook.

The last snippet is the short code ( it only works with single posts, so use conditional if statement ).

NOTES :

1. This is useful to show text link only, If you want to show buttons then you must use ready made script from Facebook.

2. Make sure you have page.php and single.php template otherwise it won’t work

3. To show facebook share link into the wordpress loop use this snippet By Filip Stefansson

Comments  Leave a Reply

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

WordPress Launch Checklist

The Ultimate WordPress Launch Checklist

We've compiled all the essential checklist items for your next WordPress website launch into one handy ebook.
Yes, Send Me the Free eBook!