WordPress: Pinterest ohne Plugin nutzen

Den Pinbutton von Pinterest kann man auch ohne Plugin in WordPress nutzen. Eine Möglichkeit wäre die folgende Variante…

Einfach das Skript vor dem schließenden body Tag in der footer.php einfügen…


(function() {
    window.PinIt = window.PinIt || { loaded:false };
    if (window.PinIt.loaded) return;
    window.PinIt.loaded = true;
    function async_load(){
        var s = document.createElement("script");
        s.type = "text/javascript";
        s.async = true;
        s.src = "http://assets.pinterest.com/js/pinit.js";
        var x = document.getElementsByTagName("script")[0];
        x.parentNode.insertBefore(s, x);
    }
    if (window.attachEvent)
        window.attachEvent("onload", async_load);
    else
        window.addEventListener("load", async_load, false);
})();

Den folgenden Code an passender Stelle z. B. in der single.php einfügen…

ID ), 'full' ); ?>
&lt;a href=&quot;http://pinterest.com/pin/create/button/?url=ID)); ?&gt;&amp;media=&amp;description=" class="pin-it-button" count-layout="vertical"&gt;Pin It</a>

Quelle: wpbeginner.com