Skip to content

Instantly share code, notes, and snippets.

@Dimasmagadan
Last active December 27, 2015 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Dimasmagadan/7315703 to your computer and use it in GitHub Desktop.
Save Dimasmagadan/7315703 to your computer and use it in GitHub Desktop.
Yandex social share
// добавить этот код в functions.php
function os_styles_and_scripts() {
if(!is_admin()){
wp_enqueue_script( 'yashare', '//yandex.st/share/share.js', null, '1', true );
}
}
add_action( 'wp_enqueue_scripts', 'os_styles_and_scripts' );
<!-- этот код вставить там, где нужно вывести лайки -->
<div class="yashare-auto-init" data-yashareL10n="ru" data-yashareType="small"
data-yashareQuickServices="vkontakte,facebook,twitter,odnoklassniki,moimir,gplus"
data-yashareTheme="counter"
data-yashareLink="<?php the_permalink(); ?>"
data-yashareTitle="<?php the_title(); ?>"
data-yashareDescription="<?php the_excerpt(); ?>"
<?php if(has_post_thumbnail( )){
$thumb=wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium');
?> data-yashareImage="<?php echo $thumb[0]; ?>"<?php
} ?>
></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment