Google +1 Button

Hinweis: Dieser Artikel ist älter als zwei Jahre (letzte Änderung: 8. Mai 2020) und evtl. nicht mehr aktuell.

Es gibt eine neue Methode den Google +1 Button in Websites einzubauen: http://www.google.com/intl/en/webmasters/+1/button/
Für WordPress einfach als URL the_permalink(); einfügen. Der alte Code im Header verschwindet.

<!-- Place this tag where you want the +1 button to render -->
        <g:plusone size="standard" href="<?php the_permalink(); ?>"></g:plusone>
      <!-- Place this tag after the last plusone tag -->
        <script type="text/javascript">
          window.___gcfg = {lang: 'de'};
          (function() {
            var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
            po.src = 'https://apis.google.com/js/plusone.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
          })();
        </script>

Und hier als HTML5 valider Syntax:

<!-- Place this tag where you want the +1 button to render -->
      <div class="g-plusone" data-annotation="inline" data-width="120" href="<?php the_permalink(); ?>"></div>
      <!-- Place this render call where appropriate -->
      <script type="text/javascript">
        window.___gcfg = {lang: 'de'};
      
        (function() {
          var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
          po.src = 'https://apis.google.com/js/plusone.js';
          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
        })();
      </script>
Empfehle uns: email facebook google plus twitter

Artikel Informationen

  • Erstellt am Freitag, 29. Juli 2011 um 19:56 (Letzte Änderungen 8. Mai 2020, 21:43) und abgelegt unter Weitere Google-Dienste, WordPress mit den Tags: ,
  • Kommentare zu diesen Eintrag im Kommentar Feed Feed.
  • Du kannst einen Kommentar hinterlassen. Pingback ist im Augenblick nicht erlaubt.
Abonnieren
Benachrichtige mich zu:
4 Kommentare
Inline Feedbacks
View all comments

vielen dank hab schon danach gesucht :)

Danke für den Tipp! Allerdings dürfte auch diese neue Methode nicht valides (X)HTML erzeugen, denn der Tag ist kein HTML. Oder liege ich da falsch?

Ja, da hast du sicherlich Recht. g:plusone wird wohl momentan noch invalid sein.

Mittlerweile scheint es eine Möglichkeit zu geben, den +1 Button valide einzubinden:
[code]
<!-- Place this tag where you want the +1 button to render -->
<div class="g-plusone" data-annotation="inline" data-width="120" href="<?php the_permalink(); ?>"></div>
<!-- Place this render call where appropriate -->
<script type="text/javascript">
window.___gcfg = {lang: 'de'};

(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
[/code]
Quelle: http://www.google.com/intl/en/webmasters/+1/button/ (-> Advanced options)

4
0
Would love your thoughts, please comment.x