<?php
/**
 * Social Sharing Hook *
 * @since 1.0.0
 *
 * @param int $post_id
 * @return void
 *
 */
if (!function_exists('intimate_social_sharing')) :
    function intimate_social_sharing($post_id)
    {
        $intimate_url = get_the_permalink($post_id);
        $intimate_title = get_the_title($post_id);
        $intimate_image = get_the_post_thumbnail_url($post_id);
        
        //sharing url
        /*
         * These were built by pasting the title and URL straight into a query
         * string, so a title containing & or # truncated the shared text, and
         * three of the four endpoints were plain http.
         * add_query_arg() encodes each value.
         */
        $intimate_twitter_sharing_url = add_query_arg(
            array( 'text' => $intimate_title, 'url' => $intimate_url ),
            'https://twitter.com/share'
        );
        $intimate_facebook_sharing_url = add_query_arg(
            array( 'u' => $intimate_url ),
            'https://www.facebook.com/sharer/sharer.php'
        );
        $intimate_pinterest_sharing_url = add_query_arg(
            array( 'url' => $intimate_url, 'media' => $intimate_image, 'description' => $intimate_title ),
            'https://pinterest.com/pin/create/button/'
        );
        $intimate_linkedin_sharing_url = add_query_arg(
            array( 'mini' => 'true', 'title' => $intimate_title, 'url' => $intimate_url ),
            'https://www.linkedin.com/shareArticle'
        );
        
        ?>
        <div class="meta_bottom">
            <div class="post-share">
                <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $intimate_facebook_sharing_url ); ?>"><i class="fa fa-facebook"></i></a>
                <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $intimate_twitter_sharing_url ); ?>"><i
                            class="fa fa-twitter"></i></a>
                <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $intimate_pinterest_sharing_url ); ?>"><i
                            class="fa fa-pinterest"></i></a>
                <a target="_blank" rel="noopener noreferrer" href="<?php echo esc_url( $intimate_linkedin_sharing_url ); ?>"><i class="fa fa-linkedin"></i></a>
            </div>
        </div>
        <?php
    }
endif;
add_action('intimate_social_sharing', 'intimate_social_sharing', 10);