{"id":440,"date":"2023-03-22T11:56:33","date_gmt":"2023-03-22T11:56:33","guid":{"rendered":"http:\/\/basicwebsitesolutions.com\/blog\/?p=440"},"modified":"2023-03-22T11:56:35","modified_gmt":"2023-03-22T11:56:35","slug":"php-code-for-fb-plugin","status":"publish","type":"post","link":"https:\/\/basicwebsitesolutions.com\/blog\/2023\/03\/22\/php-code-for-fb-plugin\/","title":{"rendered":"PHP Code for FB Plugin"},"content":{"rendered":"\n<p>Here is the code I used in integrating the fb plugin using iframe into the website. <\/p>\n\n\n\n<p>Please replace the fields that require your actual account. <\/p>\n\n\n\n<p>I also included an html tag .<\/p>\n\n\n\n<p>Enjoy,<\/p>\n\n\n\n<p>Coffee Cup<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\r\nhttps:\/\/developers.facebook.com\/docs\/plugins\/like-button\r\n\r\n\r\nJavaScript SDK\r\n\r\n\r\nStep 1: Include the JavaScript SDK on your page once, ideally right after the opening body tag.\r\n&lt;div id=\"fb-root\">&lt;\/div>\r\n&lt;script async defer crossorigin=\"anonymous\" src=\"https:\/\/connect.facebook.net\/en_US\/sdk.js#xfbml=1&amp;version=v14.0\" nonce=\"F1YcA0n6\">&lt;\/script>\r\nStep 2: Place this code wherever you want the plugin to appear on your page.\r\n&lt;div class=\"fb-like\" data-href=\"https:\/\/www.facebook.com\/PoshMotorcycleShop\" data-width=\"200\" data-layout=\"standard\" data-action=\"like\" data-size=\"small\" data-share=\"true\">&lt;\/div>\r\n\r\n\r\nIFrame\r\n\r\n&lt;iframe src=\"https:\/\/www.facebook.com\/plugins\/like.php?href=https%3A%2F%2Fwww.facebook.com%2FPoshMotorcycleShop&amp;width=200&amp;layout=standard&amp;action=like&amp;size=small&amp;share=true&amp;height=35&amp;appId\" width=\"200\" height=\"35\" style=\"border:none;overflow:hidden\" scrolling=\"no\" frameborder=\"0\" allowfullscreen=\"true\" allow=\"autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share\">&lt;\/iframe>\r\n\r\n\r\n\r\n\r\nFor Android the URL schema is:\r\n\r\nfb:\/\/page\/page_id\r\nFor iOS the URL schema is:\r\n\r\nfb:\/\/page?id=page_id\r\n\r\n\r\n\r\n\r\n\r\n\r\nhttps:\/\/developers.facebook.com\/docs\/plugins\/like-button\r\n\r\n&lt;html>\r\n&lt;head>\r\n  &lt;title>Your Website Title&lt;\/title>\r\n    &lt;!-- You can use open graph tags to customize link previews.\r\n    Learn more: https:\/\/developers.facebook.com\/docs\/sharing\/webmasters -->\r\n  &lt;meta property=\"og:url\"           content=\"https:\/\/www.your-domain.com\/your-page.html\" \/>\r\n  &lt;meta property=\"og:type\"          content=\"website\" \/>\r\n  &lt;meta property=\"og:title\"         content=\"Your Website Title\" \/>\r\n  &lt;meta property=\"og:description\"   content=\"Your description\" \/>\r\n  &lt;meta property=\"og:image\"         content=\"https:\/\/www.your-domain.com\/path\/image.jpg\" \/>\r\n&lt;\/head>\r\n&lt;body>\r\n\r\n  &lt;!-- Load Facebook SDK for JavaScript -->\r\n  &lt;div id=\"fb-root\">&lt;\/div>\r\n  &lt;script async defer crossorigin=\"anonymous\" \r\n        src=\"https:\/\/connect.facebook.net\/en_US\/sdk.js#xfbml=1\r\n             &amp;version={graph-api-version}\r\n             &amp;appId={your-facebook-app-id}\r\n             &amp;autoLogAppEvents=1\" \r\n        nonce=\"FOKrbAYI\">\r\n  &lt;\/script>\r\n\r\n  &lt;!-- Your like button code -->\r\n  &lt;div class=\"fb-like\" \r\n       data-href=\"https:\/\/www.your-domain.com\/your-page.html\" \r\n       data-width=\"\"\r\n       data-layout=\"standard\" \r\n       data-action=\"like\" \r\n       data-size=\"small\"  \r\n       data-share=\"true\">\r\n  &lt;\/div>\r\n\r\n&lt;\/body>\r\n&lt;\/html>\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PHP Code for FB Plugin<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,1,11],"tags":[250,248,42,249],"class_list":["post-440","post","type-post","status-publish","format-standard","hentry","category-day-to-day-life","category-life-as-a-programmer","category-php-and-mysql","tag-facebook","tag-fb","tag-php","tag-plugin"],"_links":{"self":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=440"}],"version-history":[{"count":1,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/440\/revisions"}],"predecessor-version":[{"id":441,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/posts\/440\/revisions\/441"}],"wp:attachment":[{"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/basicwebsitesolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}