This file contains hidden or 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 rm_scripts() { | |
wp_enqueue_script( 'pinit', '//assets.pinterest.com/js/pinit.js', false, false, true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'rm_scripts' ); | |
/** | |
* Script Loader | |
* | |
*/ | |
function rm_script_loader( $tag, $handle ) { | |
if( 'pinit' == $handle ) | |
$tag = str_replace( ' src', ' async="async" src', $tag ); | |
return $tag; | |
} | |
add_filter( 'script_loader_tag', 'rm_script_loader', 10, 2 ); |
This file contains hidden or 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>'); | |
}); | |
}); |