{"id":790,"date":"2012-03-16T13:53:19","date_gmt":"2012-03-16T13:53:19","guid":{"rendered":"http:\/\/dpscomputing.com\/wordpress\/?p=790"},"modified":"2012-03-22T11:20:22","modified_gmt":"2012-03-22T11:20:22","slug":"facebook-development-for-websites-like-buttons","status":"publish","type":"post","link":"https:\/\/www.dpscomputing.com\/blog\/2012\/03\/16\/facebook-development-for-websites-like-buttons\/","title":{"rendered":"Facebook Development for Websites &#8211; Like Buttons"},"content":{"rendered":"<p><a href=\"http:\/\/dpscomputing.com\/wordpress\/wp-content\/uploads\/2009\/10\/facebook.jpg\"><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"169\" data-permalink=\"https:\/\/www.dpscomputing.com\/blog\/2009\/10\/14\/facebook\/facebook\/\" data-orig-file=\"https:\/\/www.dpscomputing.com\/blog\/wp-content\/uploads\/2009\/10\/facebook-e1343000923652.jpg\" data-orig-size=\"400,150\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Facebook\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/www.dpscomputing.com\/blog\/wp-content\/uploads\/2009\/10\/facebook-e1343000923652.jpg\" data-large-file=\"https:\/\/www.dpscomputing.com\/blog\/wp-content\/uploads\/2009\/10\/facebook-e1343000923652.jpg\" tabindex=\"0\" role=\"button\" class=\"alignright  wp-image-169\" title=\"Facebook\" src=\"http:\/\/dpscomputing.com\/wordpress\/wp-content\/uploads\/2009\/10\/facebook.jpg\" alt=\"\" width=\"288\" height=\"109\" \/><\/a>This article assumes that you have followed and completed our <a href=\"http:\/\/dpscomputing.com\/wordpress\/2012\/03\/16\/facebook-development-for-websites-getting-started\/\">Getting Started<\/a> tutorial successfully.<\/p>\n<p>So, whats next? \u00a0Well there&#8217;s no point loading the JavaScript SDK and not using it! \u00a0So in this article we are going to go through one of the more simpler Facebook Development tasks &#8211; adding a like button to our website.<\/p>\n<p>&#8216;Like&#8217; buttons are extremely popular and having one on your site is instantly recognisable, useful and not too taxing coding wise.<\/p>\n<p>To make our task easier there is also a nice little <a href=\"http:\/\/developers.facebook.com\/docs\/reference\/plugins\/like\/\" target=\"_blank\">&#8216;Like&#8217; button generator<\/a> on the Facebook Developer site &#8211; great!<\/p>\n<p>So, firstly, you need to open the Facebook Like generator page linked above.<\/p>\n<p>Now, we need to customise our like button so that people can &#8216;Like&#8217; our website.<\/p>\n<p>The first piece of information required by the generator is easy. \u00a0It&#8217;s the domain that we want people to &#8216;Like&#8217;, which is also the domain that we are hosting our webpage on. \u00a0If you are using a local development server then this needs to be &#8220;http:\/\/localhost&#8221;. \u00a0For a website which is hosted online it needs to be your website domain (for example, http:\/\/www.yourdomain.com).<\/p>\n<p>The rest of the information that we need to add to configure our &#8216;Like&#8217; button is all down to personal preference. \u00a0The &#8216;Like&#8217; button will now work for your website no matter what we add now (assuming that you have entered the correct domain above of course!).<\/p>\n<p>We&#8217;ll now go through these extra options:<\/p>\n<p>Send Button &#8211; Well for this one, do we want people who use our website to be able to suggest that one of their Facebook friends also &#8216;Like&#8217; your website. \u00a0Tick if you would like there to be a send button next to your like button or untick if you don&#8217;t want the send button to appear. \u00a0For the purposes of being &#8216;social&#8217; I would suggest that you do have the send button option ticked (which is the default setting).<\/p>\n<p>Layout Style &#8211; This can either be &#8216;standard&#8217;, &#8216;button count&#8217; or &#8216;box count&#8217;. \u00a0Standard is the way that you will have probably seen on many websites. \u00a0It&#8217;s longer than the other two styles but it doesn&#8217;t display a count of how many people currently &#8216;Like&#8217; your website. \u00a0In the early stages of your website development (or if on Facebook your website isn&#8217;t very popular at the moment) it may be advantageous to choose &#8216;standard&#8217; so as not to give your visitors the impression that your site is not popular!! \u00a0However, as I have said previously, this is down to personal preference! \u00a0The &#8216;button count&#8217; and &#8216;box count&#8217; styles are basically the same style apart from button count is landscape and box count is portrait (and in a box). \u00a0These styles consist of the &#8216;Like&#8217; button but also a count of how many people currently &#8216;Like&#8217; your website.<\/p>\n<p>Width &#8211; this is quite simply, the width of your &#8216;Like&#8217; button. \u00a0You can customise this so that it fits neatly into your website. \u00a0The value you choose here will depend on the design of your website. \u00a0The width value is measured in pixels (even though this not obviously indicated on the generator!).<\/p>\n<p>Show Faces &#8211; this is either ticked or unticked. \u00a0If you have ticked this option it will show the faces (small profile pictures) of a random selection of people that have liked your website. \u00a0If this is unticked, the faces will not be shown.<\/p>\n<p>Verb to display &#8211; this is whether you want you &#8216;Like&#8217; button to say &#8216;Like&#8217; or &#8216;Recommend&#8217;. \u00a0Seen as though this like button is going to be for our website in general I would recommend choosing &#8216;Like&#8217;. \u00a0If you subsequently make a like button for, for example, a product, then you may wish to choose &#8216;Recommend&#8217;. \u00a0This doesn&#8217;t change the functionality of the &#8216;Like&#8217; button in any way.<\/p>\n<p>Colour Scheme &#8211; this can be either &#8216;light&#8217; or &#8216;dark&#8217;. \u00a0These options basically translate to &#8216;white background&#8217; and &#8216;black background&#8217; respectively. \u00a0Your choice will obviously depend on the colour scheme of your site, but in most cases the &#8216;light&#8217; (white background) will be the most suitable.<\/p>\n<p>Font &#8211; there are a number of different font styles that you can choose from so that the font style of your like button fits in with your websites design.<\/p>\n<p>Having completed all the fields we are now ready to retrieve the code using the &#8216;Get Code&#8217; button. \u00a0Click it now.<\/p>\n<p>When the dialog pops up you need to select the app that you have created for your website (this will already be selected if you only have one app). \u00a0You need to change the drop down box after &#8220;This script uses the app ID of your app:&#8221; to the required value.<\/p>\n<p>As we have already initialised our page to use the Facebook JavaScript SDK we can ignore the first dialog box of code.<\/p>\n<p>The code for the like button is in the 2nd box (&#8220;2:&#8221;) and this needs to be added to the section of your HTML code where you would like (;)) your &#8216;Like&#8217; button to appear.<\/p>\n<p>The code for our example (using yourdomain.com) is shown below:<\/p>\n<p><span style=\"font-family: 'courier new', courier;\">&lt;div data-href=&#8221;http:\/\/www.domain.com&#8221; data-send=&#8221;true&#8221; data-layout=&#8221;box_count&#8221; data-width=&#8221;450&#8243; data-show-faces=&#8221;true&#8221; data-font=&#8221;arial&#8221;&gt;&lt;\/div&gt;<\/span><\/p>\n<p>And, hey presto, you now have a &#8216;Like&#8217; button on your website :).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article assumes that you have followed and completed our Getting Started tutorial successfully. So, whats next? \u00a0Well there&#8217;s no point loading the JavaScript SDK and not using it! \u00a0So in this article we&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[55,231],"tags":[209,219,230,215,224,223,226,225,229],"class_list":["post-790","post","type-post","status-publish","format-standard","hentry","category-articles","category-facebook-developer-series-articles","tag-facebook-developer","tag-facebook-developer-article","tag-facebook-developer-article-series","tag-facebook-development","tag-fb","tag-fb-development","tag-social-media","tag-social-networks","tag-social-website"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3nsfA-cK","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/posts\/790","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/comments?post=790"}],"version-history":[{"count":4,"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/posts\/790\/revisions"}],"predecessor-version":[{"id":796,"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/posts\/790\/revisions\/796"}],"wp:attachment":[{"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/media?parent=790"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/categories?post=790"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dpscomputing.com\/blog\/wp-json\/wp\/v2\/tags?post=790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}