{"id":563,"date":"2013-06-06T09:57:52","date_gmt":"2013-06-06T09:57:52","guid":{"rendered":"http:\/\/musilda.cz\/?p=563"},"modified":"2013-06-06T09:57:52","modified_gmt":"2013-06-06T09:57:52","slug":"jak-vlozit-tlacitko-google-do-wordpressu","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-vlozit-tlacitko-google-do-wordpressu\/","title":{"rendered":"Jak vlo\u017eit tla\u010d\u00edtko Google+ do WordPressu"},"content":{"rendered":"

Google+ je soci\u00e1ln\u00ed s\u00edt\u00ed, kter\u00e9 se za\u0159adila po bok Twitteru a Facebooku. D\u00e1 se \u0159\u00edci, \u017ee dnes v\u011bt\u0161ina bloger\u016f \u0159e\u0161\u00ed, jak krom\u011b sd\u00edlen\u00ed pro zm\u00edn\u011bn\u00e9 dv\u011b s\u00edt\u011b, zobrazit u p\u0159\u00edsp\u011bvk\u016f i tla\u010d\u00edtka pro Google+. V n\u00e1vodu si uk\u00e1\u017eeme, jak p\u0159idat tla\u010d\u00edtko ke ka\u017ed\u00e9mu \u010dl\u00e1nku a to bu\u010f za n\u011bj, nebo p\u0159ed n\u011bj.\u00a0<\/p>\n

Nejprve mus\u00edme do \u0161ablony vlo\u017eit js soubor z Google. Do functions.php vlo\u017e\u00edme n\u00e1sleduj\u00edc\u00ed k\u00f3d:<\/p>\n

\nadd_action ('wp_enqueue_scripts','insert_google_plusone_script');\n\nfunction insert_google_plusone_script() {\n wp_enqueue_script('google-plusone',\n'https:\/\/apis.google.com\/js\/plusone.js', array(), null);\n}\n<\/pre>\n

Pomoc\u00ed n\u011bj jsme um\u00edstili do \u0161ablony link na soubor plusone.js. N\u00e1sledn\u011b vlo\u017e\u00edme funkci pro zobrazen\u00ed la\u010d\u00edtka:<\/p>\n

\nadd_filter('the_content', 'my_google_button');\nfunction my_google_button($content) {\n\n $content= $content.'
\n<\/div>\n';\n return $content;\n<\/pre>\n

T\u00edm jsme um\u00edstili tla\u010d\u00edtko Google+ za obsah str\u00e1nky, nebo \u010dl\u00e1nku. Pokud jej budeme cht\u00edt um\u00edstit p\u0159ed obsah, jednodu\u0161e zm\u011bn\u00edte funkci takto:<\/p>\n

\nadd_filter('the_content', 'my_google_button');\nfunction my_google_button($content) {\n\n $content= '
\n<\/div>\n'.$content;\n return $content;\n<\/pre>\n

Na v\u00fdb\u011br m\u00e1me z n\u011bkolika velikost\u00ed, kter\u00e9 jednodu\u0161e pomoc\u00ed size. Hodnoty jsou „small“, „medium“ a „tall“. Pokud size neuvedete, zobraz\u00ed se button ve velikosti standart. Pokud budeme cht\u00edt to buttonu p\u0159idat k\u00f3d pro sledov\u00e1n\u00ed klik\u016f Google Analytics, sta\u010d\u00ed do tla\u010d\u00edtka p\u0159idat callback=“sledovani“ a do pati\u010dky p\u0159idat funkci:<\/p>\n

\nfunction ga_track_googleplus() {\necho '\n\n            function sledovani( obj ) {\n                _gaq.push(['_trackEvent','plusone',obj.state]);\n            }\n\n';\n}\nadd_action('wp_footer', 'ga_track_googleplus');\n\n<\/pre>\n

D\u00edky tomu budeme moci sledovat statistiky v Google Analytics. <\/p>\n","protected":false},"excerpt":{"rendered":"

Google+ je soci\u00e1ln\u00ed s\u00edt\u00ed, kter\u00e9 se za\u0159adila po bok Twitteru a Facebooku. D\u00e1 se \u0159\u00edci, \u017ee dnes v\u011bt\u0161ina bloger\u016f \u0159e\u0161\u00ed, jak krom\u011b sd\u00edlen\u00ed pro zm\u00edn\u011bn\u00e9 dv\u011b s\u00edt\u011b, zobrazit u p\u0159\u00edsp\u011bvk\u016f i tla\u010d\u00edtka pro Google+. V n\u00e1vodu si uk\u00e1\u017eeme, jak p\u0159idat tla\u010d\u00edtko ke ka\u017ed\u00e9mu \u010dl\u00e1nku a to bu\u010f za n\u011bj, nebo p\u0159ed n\u011bj.\u00a0<\/p>\n","protected":false},"author":1,"featured_media":8624,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[12,23],"tags":[179,460],"class_list":["post-563","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-navody","category-video-navody","tag-google","tag-wordpress-2"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/563"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=563"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/563\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8624"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=563"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=563"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=563"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}