Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//adds social share in AMP pages add in function.php /WP
add_filter('the_content', 'my_social_share');
function my_social_share($content) {
if(is_single()) {
$before_after_content = '<div class=social-share>
<amp-social-share width=35 height=35 type=facebook data-param-app_id=xxxxxxxxxxxxx></amp-social-share>
<amp-social-share height=35 width=35 type=twitter></amp-social-share>
<amp-social-share height=35 width=35 type="system"></amp-social-share>
</div>';
$share_content = $before_after_content . $content . $before_after_content;
} else {
$share_content = $content;
}
return $share_content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment