-
-
Save billerickson/6ab6b7c9a2175eb69767b1813bd39f17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Scripts | |
* | |
*/ | |
function ea_scripts() { | |
wp_enqueue_script( 'pinit', '//assets.pinterest.com/js/pinit.js', false, false, true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'ea_scripts' ); | |
/** | |
* Script Loader | |
* | |
*/ | |
function ea_script_loader( $tag, $handle ) { | |
if( 'pinit' == $handle ) | |
$tag = str_replace( ' src', ' async="async" src', $tag ); | |
return $tag; | |
} | |
add_filter( 'script_loader_tag', 'ea_script_loader', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($){ | |
// Pinterest PinIt | |
$('.page-header .wrap, .wp-caption').each(function(){ | |
margin_top = 42; | |
if( $(this).find('.wp-caption-text').length ) { | |
margin_top += $(this).find('.wp-caption-text').height() + 35; | |
} | |
$(this).append('<span class="pinit" style="margin-top: -' + margin_top + 'px; margin-right: 10px; float: right;"><a data-pin-do="buttonBookmark" data-pin-tall="true" data-pin-round="true" data-pin-save="false" href="https://www.pinterest.com/pin/create/button/"><img src="//assets.pinterest.com/images/pidgets/pinit_fg_en_round_red_32.png" /></a></span>'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment