mihdan
9/28/2016 - 4:21 PM

Example AMP Social Share buttons in WordPress

Example AMP Social Share buttons in WordPress

<?php
/*
 * Example of using amp-social-share within WP.
 * 
 * Note that Facebook requires an App ID {YOUR_FB_APP_ID}.
 *
 * Be sure to include the amp-social-share component script.
 */
<div class="share-buttons">
	<amp-social-share type="facebook" width="32" height="32"
	                  data-url="<?php echo esc_url( get_permalink() ); ?>"
	                  data-param-app_id="<?php echo esc_attr( {YOUR_FB_APP_ID} ); ?>"
	                  data-media="<?php echo esc_url( wp_get_attachment_url( get_post_thumbnail_id() ) ); ?>"
	                  data-description="<?php the_title_attribute(); ?>">
	</amp-social-share>
	<amp-social-share type="twitter" width="32" height="32"
	                  data-url="<?php echo esc_url( get_permalink() ); ?>"
	                  data-media="<?php echo esc_url( wp_get_attachment_url( get_post_thumbnail_id() ) ); ?>"
	                  data-description="<?php the_title_attribute(); ?>">
	</amp-social-share>
	<amp-social-share type="pinterest" width="32" height="32"
	                  data-url="<?php echo esc_url( get_permalink() ); ?>"
	                  data-media="<?php echo esc_url( wp_get_attachment_url( get_post_thumbnail_id() ) ); ?>"
	                  data-description="<?php the_title_attribute(); ?>">
	</amp-social-share>
</div>