d2321
5/6/2020 - 6:46 AM

custom social share

<?php 
    $url = urlencode(esc_url($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]));
    $title = wp_title('', false);
    
    $links = array();

    $links['url'][] = 'http://www.facebook.com/sharer.php?u='.$url.'&amp;t='.$title;
    $links['url'][] = 'http://twitter.com/share?text='.$title.'&url='.$url;
    $links['url'][] = 'http://linkedin.com/shareArticle?mini=true&amp;url='.$url.'&amp;title='.$title;

    $links['class'][] = 'fab fa-facebook-f';
    $links['class'][] = 'fab fa-twitter';
    $links['class'][] = 'fab fa-linkedin-in';
?>

<div class="d-social-share-wrap">
    <?php for($i=0; $i < count($links['class']); $i++) { 
        echo '<a href="'.$links['url'][$i].'" target="blank"><i class="'.$links['class'][$i].'"></i></a>';
    } ?>
</div>
<div class="sh-wr d-flex align-items-center justify-content-end">
	<?php include (locate_template( 'parts/share-single.php' )); ?>
</div>
.sh-wr {
  .text {
    color: $themecolor;
    font-size: 1.4rem;
    font-weight: 400;
    line-height: 0.86;
    margin-right: 3rem;
  }

  .d-social-share-wrap {
    a {
      font-size: 2.5rem;
      color: $secondarycolor;
      &:hover {
        color: $thirdcolor;
      }
      &:not(:last-child) {
        margin-right: 2rem;
      }
    }
  }
}