|
/** |
|
* Creates a social media links for various sites |
|
* |
|
* @param string $title Title that is passed to sharing site |
|
* @param string $link permalink that will be shared |
|
* @return string html snippet with icons |
|
*/ |
|
function insert_social_links( $link, $title, $image, $desc ) { |
|
|
|
$link = esc_url( $link ); |
|
$facebook = 'https://www.facebook.com/sharer.php?s=100&p[url]=' . $link . '&p[images][0]=' .$image . '&p[title]=' . $title . '&p[summary]=' . $desc; |
|
$twitter = 'https://twitter.com/intent/tweet?url=' . $link . '&text=' . $title . '&hashtags=endoftheworldisnear'; |
|
$google = 'https://plus.google.com/share?url=' . $link; |
|
$pinterest = 'https://pinterest.com/pin/create/bookmarklet/?media=' . $image . '&url=' . $link . ' &is_video=0&description=' . $title; |
|
|
|
ob_start(); ?> |
|
<div class="d-social-links"> |
|
<div class="d-social-link"> |
|
<a onclick="window.open('<?php echo $facebook; ?>','Share on Facebook','width=600,height=400')"> |
|
<div class="d-social-icon"><?php insert_icon( 'facebook' ); ?></div> |
|
Facebook |
|
</a> |
|
</div> |
|
<div class="d-social-link"> |
|
<a onclick="window.open('<?php echo $twitter; ?>','Share on Twitter','width=600,height=400')"> |
|
<div class="d-social-icon"><?php insert_icon( 'twitter' ); ?></div> |
|
Twitter |
|
</a> |
|
</div> |
|
<div class="d-social-link"> |
|
<a onclick="window.open('<?php echo $google; ?>','Share on Google','width=600,height=400')"> |
|
<div class="d-social-icon"><?php insert_icon( 'google-plus' ); ?></div> |
|
Google Plus |
|
</a> |
|
</div> |
|
<div class="d-social-link"> |
|
<a onclick="window.open('<?php echo $pinterest; ?>','Share on Pinterest','width=600,height=400')"> |
|
<div class="d-social-icon"><?php insert_icon( 'pinterest' ); ?></div> |
|
Pinterest |
|
</a> |
|
</div> |
|
</div> |
|
<?php |
|
$snippet = ob_get_clean(); |
|
return $snippet; |
|
} |