Created
August 22, 2018 23:22
-
-
Save AbhishekGhosh/e4a1786726624b672fbdc4b3853c0025 to your computer and use it in GitHub Desktop.
Fat Free Social Share WordPress
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
<div class="dev-share-buttons"> | |
<a class="button full facebook" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>" target="_blank" rel="nofollow"> Facebook</a> | |
<a class="button full twitter" href="https://twitter.com/share?text=<?php the_title(); ?>&url=<?php the_permalink(); ?>&via=AbhishekCTRL" target="_blank" rel="nofollow"> Twitter</a> | |
<a class="button full google" href="https://plus.google.com/share?url=<?php the_permalink(); ?>" onclick="javascript:window.open(this.href, | |
'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;" target="_blank" rel="nofollow"> Google+</a> | |
<a class="button full pinterest" href="https://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php | |
$args = array( | |
'numberposts' => 1, | |
'order'=> 'DESC', | |
'post_mime_type' => 'image', | |
'post_parent' => $post->ID, | |
'post_type' => 'attachment' | |
); | |
$get_children_array = get_children($args,ARRAY_A); //returns Array ( [$image_ID]... | |
$rekeyed_array = array_values($get_children_array); | |
$child_image = $rekeyed_array[0]; | |
$firstimage_attributes = wp_get_attachment_image_src( $child_image['ID'], full ); | |
echo $firstimage_attributes[0]; | |
?>&description=<?php $excerpt = strip_tags(get_the_excerpt()); | |
echo $excerpt; ?>" target="_blank" rel="nofollow"> Pinterest</a> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment