This article will show you how to include a Facebook Embedded Comment into a WordPress post or page with shortcode.
Embedding a comment is one of those features that's becoming more and more popular - particularly in the news-starved world of traditional media where they'll often use social posts as an alternative to genuine editorial content. If you're looking to add social proof or feedback from a conversation, or you would simply like to include the input of others in your own editorials, the Facebook plugin works very well.
The comments plugin will have the effect of increasing engagement with your Facebook post... although it does (at times) compromise on page-load times.
The Result
Here's a comment of us whinging about Telstra's crappy ADSL broadband speeds. Shortcode used is [fbcomment url="https://www.facebook.com/beli (snip) 239792483&comment_tracking=%7B%22tn%22%3A%22R%22%7D"]
.
In this second example I'll include a single comment I made on Facebook some time ago, and I'll include the parent comment (note that you can't include the parent post). Our shortcode uses the additional parameter of parent="1"
to include the parent comment.
The Comment Link
To obtain the required comment URL, copy the link associated with the date published below a comment.
You may optionally click on this link and copy the resulting browser URL to your shortcode.
Shortcode Attributes
url
width
width="400"
.parent
parent="1"
) to include the parent comment (if the URL is a reply). You cannot include the parent post.WordPress Shortcode
Usage of the function requires the Facebook SDK code be copied to your website.
Copy and paste the WordPress function into your theme's functions.php
file or, if you sensibly have one installed, your custom functions plugin.
If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.
Embedding iFrames
As with most of Facebook's content, you can simply copy embed code and paste it directly into your post. As with all Facebook features, the comment plugin functionality changes as often as Oprah does drive-through McDonald's so we'd suggest always using shortcode so you can globally alter all embedded occurrences should the need present itself. That said, if you were to use the iframe option, you would simply copy the code as detailed below.
Click embed and Facebook will launch a modal with your embed code. Copy it directly into your WordPress website.
The iframe option negates the need to have the Facebook SDK code copied to your webiste.
Considerations
- If you make an attempt to embed a copy when privacy restricts it, a message will be rendered advising of such.
- See also: "Embed Facebook Posts into Your WordPress Post or Page with Shortcode" and "Replace WordPress Comments With Facebook Comments".
- Facebook documentation available here
Download
Title: Facebook Comment Plugin (WordPress Shortcode)
Description: Embed A Facebook Comment In WordPress With Shortcode. Optionally include parent comment.
Download • Version 0.1, 670.0B, zip, Category: WordPress Shortcodes
PHP Code & Snippets, (5.1K)