Example #1
0
    function grve_osmosis_social_shortcode($atts, $content)
    {
        $output = $data = $el_class = '';
        extract(shortcode_atts(array('social_facebook' => '', 'social_twitter' => '', 'social_linkedin' => '', 'social_googleplus' => '', 'social_reddit' => '', 'grve_likes' => '', 'animation' => '', 'align' => 'left', 'animation_delay' => '200', 'margin_bottom' => '', 'el_class' => ''), $atts));
        $social_classes = array('grve-element', 'grve-social', 'grve-social-large', 'grve-align-' . $align);
        if (!empty($animation)) {
            array_push($social_classes, 'grve-animated-item');
            array_push($social_classes, $animation);
            $data = ' data-delay="' . esc_attr($animation_delay) . '"';
        }
        if (!empty($el_class)) {
            array_push($social_classes, $el_class);
        }
        $social_class_string = implode(' ', $social_classes);
        $style = grve_osmosis_vce_build_margin_bottom_style($margin_bottom);
        $grve_permalink = esc_url(get_permalink());
        $grve_title = esc_attr(get_the_title());
        ob_start();
        ?>
			<div class="<?php 
        echo esc_attr($social_class_string);
        ?>
" style="<?php 
        echo $style;
        ?>
"<?php 
        echo $data;
        ?>
>
				<ul>

					<?php 
        if (!empty($social_facebook)) {
            ?>
					<li><a href="<?php 
            echo $grve_permalink;
            ?>
" title="<?php 
            echo $grve_title;
            ?>
" class="grve-social-share-facebook grve-icon-facebook"></a></li>
					<?php 
        }
        ?>
					<?php 
        if (!empty($social_twitter)) {
            ?>
					<li><a href="<?php 
            echo $grve_permalink;
            ?>
" title="<?php 
            echo $grve_title;
            ?>
" class="grve-social-share-twitter grve-icon-twitter"></a></li>
					<?php 
        }
        ?>
					<?php 
        if (!empty($social_linkedin)) {
            ?>
					<li><a href="<?php 
            echo $grve_permalink;
            ?>
" title="<?php 
            echo $grve_title;
            ?>
" class="grve-social-share-linkedin grve-icon-linkedin"></a></li>
					<?php 
        }
        ?>
					<?php 
        if (!empty($social_googleplus)) {
            ?>
					<li><a href="<?php 
            echo $grve_permalink;
            ?>
" title="<?php 
            echo $grve_title;
            ?>
" class="grve-social-share-googleplus grve-icon-google-plus"></a></li>
					<?php 
        }
        ?>
					<?php 
        if (!empty($social_reddit)) {
            ?>
					<li><a href="<?php 
            echo $grve_permalink;
            ?>
" title="<?php 
            echo $grve_title;
            ?>
" class="grve-social-share-reddit grve-icon-reddit"></a></li>
					<?php 
        }
        ?>

					<?php 
        if (!empty($grve_likes) && function_exists('grve_likes')) {
            global $post;
            $post_id = $post->ID;
            ?>
					<li><a href="#" class="grve-like-counter-link grve-icon-heart" data-post-id="<?php 
            echo $post_id;
            ?>
"></a><span class="grve-like-counter"><?php 
            echo grve_likes($post_id);
            ?>
</span></li>
					<?php 
        }
        ?>

				</ul>
			</div>
		<?php 
        return ob_get_clean();
    }
Example #2
0
/**
 * Prints social icons ( Post )
 */
function grve_print_post_social($post_title_color = "light", $element_id = 'grve-social-share', $element_class = 'grve-social-style-default')
{
    global $post;
    $post_id = $post->ID;
    $post_facebook = grve_option('blog_social', '', 'facebook');
    $post_twitter = grve_option('blog_social', '', 'twitter');
    $post_linkedin = grve_option('blog_social', '', 'linkedin');
    $post_googleplus = grve_option('blog_social', '', 'google-plus');
    $post_likes = grve_option('blog_social', '', 'grve-likes');
    $grve_permalink = esc_url(get_permalink($post_id));
    $grve_title = esc_attr(get_the_title($post_id));
    ?>
	<!-- Socials -->
	<div id="<?php 
    echo $element_id;
    ?>
" class="<?php 
    echo esc_attr($element_class);
    ?>
 grve-<?php 
    echo esc_attr($post_title_color);
    ?>
">
		<ul>

			<?php 
    if (!empty($post_facebook)) {
        ?>
			<li><a href="<?php 
        echo $grve_permalink;
        ?>
" title="<?php 
        echo $grve_title;
        ?>
" class="grve-social-share-facebook grve-icon-facebook"></a></li>
			<?php 
    }
    ?>
			<?php 
    if (!empty($post_twitter)) {
        ?>
			<li><a href="<?php 
        echo $grve_permalink;
        ?>
" title="<?php 
        echo $grve_title;
        ?>
" class="grve-social-share-twitter grve-icon-twitter"></a></li>
			<?php 
    }
    ?>
			<?php 
    if (!empty($post_linkedin)) {
        ?>
			<li><a href="<?php 
        echo $grve_permalink;
        ?>
" title="<?php 
        echo $grve_title;
        ?>
" class="grve-social-share-linkedin grve-icon-linkedin"></a></li>
			<?php 
    }
    ?>
			<?php 
    if (!empty($post_googleplus)) {
        ?>
			<li><a href="<?php 
        echo $grve_permalink;
        ?>
" title="<?php 
        echo $grve_title;
        ?>
" class="grve-social-share-googleplus grve-icon-google-plus"></a></li>
			<?php 
    }
    ?>
			<?php 
    if (!empty($post_likes)) {
        ?>
			<li><a href="#" class="grve-like-counter-link grve-icon-heart" data-post-id="<?php 
        echo $post_id;
        ?>
"></a><span class="grve-like-counter"><?php 
        echo grve_likes($post_id);
        ?>
</span></li>
			<?php 
    }
    ?>
		</ul>
	</div>
<?php 
}
/**
 * Prints portfolio like counter
 */
function grve_print_portfolio_like_counter()
{
    $post_likes = grve_option('portfolio_social', '', 'grve-likes');
    if (!empty($post_likes)) {
        global $post;
        $post_id = $post->ID;
        ?>
		<div class="grve-like-counter grve-icon-heart"><span><?php 
        echo grve_likes($post_id);
        ?>
</span></div>
<?php 
    }
}