How to attach Facebook comment and "Like" button to WordPress
Since I attached without using plug-in for a Wordpress (blog) for Facebook Comment and "Like" button, I introduce it.
Facebook comment, and "Like" button installation method
Facebook comment and "Like" button can be attached not only to the page of Facebook but to an ordinary web page (homepage).
Since WordPress was a blog which can be installed by yourself, it had "Comment" from the first, but since the comment was also attached by the time and effort which attaches Facebook "Like" button, both were attached.
Although it was made to usually indicate that it is a comment and it is "Like" using plug-in, since I do not want to use plug-in, the script was described to the PHP file of the theme.
Comment and "Like" information are displayed on newsfeed (app_id).
If there is no app_id or admins information, it cannot display "Like" etc. on newsfeed. It is a very important thing whether it is made to display on newsfeed.
In order to display a comment etc. on the newsfeed of Facebook, the Facebook account information of the owner of a web site, etc. are required. ID information (app_id) on a website is acquired using this account information. This is carrying out string attachment of the Facebook account information (admins) and the ID information (app_id) on a website.
How to acquire app_id
First, the Facebook application creation of developer's site of Facebook is accessed. A site name and URL are inputted on this screen. If a security check ends, the completion screen of creation of application ID of "Create an App" will be displayed. A note of this application ID (app_id) is made.
W3C error of Facebook comment, etc. is avoided if possible, and is created.
If Facebook comment and a "Like" code are acquired by an ordinary method on the Facebook plug-in creation of Facebook, The tag portions of fb:like or fb:comments become an error with the check of W3C Markup Validation Service XHTML1.0.
<meta property="og:image" content="http://hogehoge.jp/image.jpg" /> <meta property="fb:app_id" content="123456789012345" /> <meta property="fb:admins" content="123451234567890" />
Although it becomes W3C error in the place of the above-mentioned meta-tag, probably, the meta-tag of a picture and application ID at least will be required. Please add, if other meta-tags are required. There may not be any fb:admins information.
The URL portion is made into the permalink "<?php the_permalink();?>" in the WordPress.Then, the same code can be used with all the reports.The above-mentioned code is installed in a head tag.classic of the theme of a WordPress describes in header.php.
The following code is installed in the setting position of a comment and "Like" button. in a body tag classic of the theme of a WordPress describes in index.php. It is the neighborhood just after displaying a report.
When an editorial well was displayed in great numbers in a page, it was made to be displayed only after the first report, since id in the div tag used for a comment and a "Like" display part was used only once within the page. At least one independent page of a report is satisfactory.
class="np" is a thing for making it not display by printing. Moreover, the place of "ja_JP" is made into "en_US" when making it an English display "Like" and Comment.
OGP is specified with a html tag.
OGP (Open Graph Protocol) is specified with a html tag. The next description is added to a html tag. (xmlns:og="http://ogp.me/ns#" xmlns:fb="http://ogp.me/ns/fb#")
In XHTML it is as follows .
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://ogp.me/ns/fb#" xml:lang="ja" lang="ja">
The check of whether to be set up well
Let's check whether it is well set up using the debugger which Facebook is preparing. How to use a debugger enters URL in form, and clicks "debugging."
It was able to make it display it on the newsfeed of Facebook as a comment well by this method "it is good."Moreover, with the check of W3C Markup Validation Service, an error was able to be made the minimum and was able to be displayed.