{"id":174,"date":"2011-03-29T11:31:38","date_gmt":"2011-03-29T10:31:38","guid":{"rendered":"http:\/\/www.manuelmarangoni.it\/sir-bit\/?p=174"},"modified":"2015-12-22T10:24:27","modified_gmt":"2015-12-22T09:24:27","slug":"inserire-il-tasto-mi-piace-di-facebook-sulle-pagine-di-un-sito-o-di-wordpress","status":"publish","type":"post","link":"https:\/\/www.manuelmarangoni.it\/sir-bit\/174\/inserire-il-tasto-mi-piace-di-facebook-sulle-pagine-di-un-sito-o-di-wordpress\/","title":{"rendered":"Inserire il tasto mi piace di facebook sulle pagine di un sito o di wordpress"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-medium wp-image-175\" title=\"facebook - bottone mi piace\" src=\"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-content\/uploads\/2011\/03\/facebook-mi-piace-300x187.jpg\" alt=\"facebook - bottone mi piace\" width=\"300\" height=\"187\" srcset=\"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-content\/uploads\/2011\/03\/facebook-mi-piace-300x187.jpg 300w, https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-content\/uploads\/2011\/03\/facebook-mi-piace.jpg 320w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><br \/>\nAvete presente quel famoso bottone &#8220;<strong>mi piace<\/strong>&#8221; di <strong>facebook <\/strong>che si vede in alcuni siti, e che permette con un solo tasto di condividere il contenuto o il link di una pagina? Bene, crearlo \u00e8 pi\u00f9 facile del previsto, e ci sono pochissimi passi da fare. Vediamo quali sono.<!--more--><br \/>\nFacebook dispone di uno <a href=\"http:\/\/developers.facebook.com\/docs\/reference\/plugins\/like\/\" target=\"_blank\">strumento per sviluppatori<\/a> che permette di creare il bottone &#8220;mi piace&#8221; in due modi, con gli Open Graph Tags (un po&#8217; pi\u00f9 complicato) o con gli iframe. Gli Open Graph vanno a toccare i meta tag presenti nell&#8217;head, e non sempre \u00e8 possibile modificarli (soprattutto con wordpress).<br \/>\nVediamo quindi gli <strong>iframe<\/strong>.<\/p>\n<p>Nella pagina che volete sia condivisa inserite questo codice:<\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\r\n2\r\n3\r\n4<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"html4strict\" style=\"font-family: monospace;\"><span style=\"color: #009900;\">&lt;<span style=\"color: #000000; font-weight: bold;\">iframe<\/span> <span style=\"color: #000066;\">src<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"http:\/\/www.facebook.com\/plugins\/like.php?href=http:\/\/www.vostrosito.it\/&amp;<\/span> <span style=\"color: #009900;\">\r\nlayout=standard&amp;show_faces=true&amp;width=400&amp;<\/span> <span style=\"color: #009900;\">\r\naction=like&amp;colorscheme=light\"<\/span> <span style=\"color: #000066;\">scrolling<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"no\"<\/span> <span style=\"color: #000066;\">frameborder<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"0\"<\/span> <\/span>\r\n<span style=\"color: #009900;\"><span style=\"color: #000066;\">style<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"border:none; overflow:hidden; width:400px\"<\/span> <span style=\"color: #000066;\">class<\/span><span style=\"color: #66cc66;\">=<\/span><span style=\"color: #ff0000;\">\"like_fb\"<\/span>&gt;&lt;<span style=\"color: #66cc66;\">\/<\/span><span style=\"color: #000000; font-weight: bold;\">iframe<\/span>&gt;<\/span><\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p><strong>Href <\/strong>contiene l&#8217;url della pagina che verr\u00e0 condivisa.<br \/>\n<strong>Layout <\/strong>pu\u00f2 essere standard (mostra numero, amici e una frase di invito a mettere mi piace), button_count (solo il conteggio dei mi piace) o box_count (come button_count, ma mostra il numero sotto al bottone).<br \/>\n<strong>Show_faces<\/strong> permette di mostrare o meno la foto dell&#8217;utente, solo nel layout standard.<br \/>\n<strong>Action <\/strong>pu\u00f2 essere like o recommend a seconda dello scopo del bottone (se mettere solo il &#8220;mi piace&#8221; o raccomandarlo a qualcuno).<br \/>\n<strong>Colorscheme <\/strong>pu\u00f2 essere light o dark e modifica i colori del bottone.<\/p>\n\n<p>Cos\u00ec facendo comparir\u00e0 il famoso bottone che collegher\u00e0 direttamente la pagina facebook del visitatore a quella in cui \u00e8 presente.<br \/>\nSe invece siete su wordpress la modifica \u00e8 semplice. Inserite questo codice nella pagina <strong>single.php<\/strong><\/p>\n<div class=\"wp_syntax\">\n<table>\n<tbody>\n<tr>\n<td class=\"line_numbers\">\n<pre>1\r\n2\r\n3\r\n4\r\n5<\/pre>\n<\/td>\n<td class=\"code\">\n<pre class=\"php\" style=\"font-family: monospace;\">&lt;iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?\r\nhref=<span style=\"color: #000000; font-weight: bold;\">&lt;?php<\/span> the_permalink<span style=\"color: #009900;\">(<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #000000; font-weight: bold;\">?&gt;<\/span>&amp;\r\nlayout=standard&amp;show_faces=true&amp;width=400&amp;\r\naction=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\"\r\nstyle=\"border:none; overflow:hidden; width:400px\" class=\"like_fb\"&gt;&lt;\/iframe&gt;<\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Avete presente quel famoso bottone &#8220;mi piace&#8221; di facebook che si vede in alcuni siti, e che permette con un solo tasto di condividere il contenuto o il link di una pagina? Bene, crearlo \u00e8 pi\u00f9 facile del previsto, e ci sono pochissimi passi da fare. Vediamo quali sono.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[22,24,23],"class_list":["post-174","post","type-post","status-publish","format-standard","hentry","category-programmazione","tag-facebook","tag-html","tag-wordpress","cat-3-id"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/posts\/174"}],"collection":[{"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/comments?post=174"}],"version-history":[{"count":14,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/posts\/174\/revisions"}],"predecessor-version":[{"id":2125,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/posts\/174\/revisions\/2125"}],"wp:attachment":[{"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/media?parent=174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/categories?post=174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.manuelmarangoni.it\/sir-bit\/wp-json\/wp\/v2\/tags?post=174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}