Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ocean90
Created September 6, 2012 08:39
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ocean90/3653152 to your computer and use it in GitHub Desktop.
Save ocean90/3653152 to your computer and use it in GitHub Desktop.
Add/load social plugins after 5 seconds
<div class="share-box twitter">
<span>Auf Twitter teilen</span>
<a style="display:none" href="https://twitter.com/share" class="twitter-share-button" data-lang="de" data-dnt="true" data-count="vertical">Twittern</a>
</div>
<div class="share-box googleplus">
<span>Auf Google+ teilen</span>
<div class="g-plusone" data-size="tall"></div>
</div>
<div class="share-box facebook">
<span>Auf Facebook teilen</span>
<!--- get_permalink() is a WordPress function and returns the URL for current post -->
<span class="fb-like" data-url="<?php echo urlencode( get_permalink() ); ?>"></span>
</div>
( function( $ ) {
$.ajaxSetup({
cache: true
});
load_social = function() {
// Google+
window.___gcfg = {lang: 'de'};
$.getScript("//apis.google.com/js/plusone.js");
// Twitter
$.getScript("//platform.twitter.com/widgets.js");
// Facebook
var permalink = $('.fb-like').data('url');
$('.fb-like').after('<iframe src="//www.facebook.com/plugins/like.php?href=' + permalink + '&amp;send=false&amp;layout=box_count&amp;width=150&amp;show_faces=false&amp;action=recommend&amp;colorscheme=light&amp;font&amp;height=60&amp;appId=177681565672418" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:150px; height:60px;" allowTransparency="true"></iframe>');
};
setTimeout( load_social, 5000 ); // 5 seconds
} )( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment