Created
July 15, 2017 06:06
-
-
Save ahmedeshaan/cfb5e9ab8a94a1eae6150ea66a3580e1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// [follow] | |
function my_shortcode_reorder_follow_icons($atts, $content = null) { | |
$sliderrandomid = rand(); | |
extract(shortcode_atts(array( | |
'title' => '', | |
'style' => 'outline', | |
'align' => '', | |
'scale' => '', | |
'defaults' => '', | |
'twitter' => '', | |
'facebook' => '', | |
'pinterest' => '', | |
'email' => '', | |
'googleplus' => '', | |
'instagram' => '', | |
'rss' => '', | |
'linkedin' => '', | |
'youtube' => '', | |
'flickr' => '', | |
'vkontakte' => '', | |
'px500' => '', | |
'snapchat' => '', | |
// Depricated | |
'size' => '', | |
), $atts)); | |
ob_start(); | |
if($size == 'small') $style = 'small'; | |
// Get Defaults | |
if($defaults){ | |
$twitter = get_theme_mod('follow_twitter'); | |
$facebook = get_theme_mod('follow_facebook'); | |
$instagram = get_theme_mod('follow_instagram'); | |
$snapchat = get_theme_mod('follow_snapchat'); | |
$youtube = get_theme_mod('follow_youtube'); | |
$pinterest = get_theme_mod('follow_pinterest'); | |
$googleplus = get_theme_mod('follow_google'); | |
$linkedin = get_theme_mod('follow_linkedin'); | |
$px500 = get_theme_mod('follow_500px'); | |
$vkontakte = get_theme_mod('follow_vk'); | |
$flickr = get_theme_mod('follow_flickr'); | |
$email = get_theme_mod('follow_email'); | |
$rss = get_theme_mod('follow_rss'); | |
} | |
$style = get_flatsome_icon_class($style); | |
// Scale | |
if($scale) $scale = 'style="font-size:'.$scale.'%"'; | |
// Align | |
if($align) $align = 'full-width text-'.$align; | |
?> | |
<div class="social-icons follow-icons <?php echo $align; ?>" <?php echo $scale;?>> | |
<?php if($title){?> | |
<span><?php echo $title; ?></span> | |
<?php }?> | |
<?php if($instagram){?> | |
<a href="<?php echo $instagram; ?>" target="_blank" rel="nofollow" data-label="Instagram" class="<?php echo $style; ?> instagram tooltip" title="<?php _e('Follow on Instagram','flatsome')?>"><?php echo get_flatsome_icon('icon-instagram'); ?> | |
</a> | |
<?php }?> | |
<?php if($facebook){?> | |
<a href="<?php echo $facebook; ?>" target="_blank" data-label="Facebook" rel="nofollow" class="<?php echo $style; ?> facebook tooltip" title="<?php _e('Follow on Facebook','flatsome') ?>"><?php echo get_flatsome_icon('icon-facebook'); ?> | |
</a> | |
<?php }?> | |
<?php if($snapchat){?> | |
<a href="#" data-open="#follow-snapchat-lightbox" data-color="dark" data-pos="center" target="_blank" rel="nofollow" data-label="SnapChat" class="<?php echo $style; ?> snapchat tooltip" title="<?php _e('Follow on SnapChat','flatsome')?>"><?php echo get_flatsome_icon('icon-snapchat'); ?> | |
</a> | |
<div id="follow-snapchat-lightbox" class="mfp-hide"> | |
<div class="text-center"> | |
<?php echo do_shortcode(flatsome_get_image($snapchat)) ;?> | |
<p><?php _e('Point the SnapChat camera at this to add us to SnapChat.','flatsome'); ?></p> | |
</div> | |
</div> | |
<?php }?> | |
<?php if($twitter){?> | |
<a href="<?php echo $twitter; ?>" target="_blank" data-label="Twitter" rel="nofollow" class="<?php echo $style; ?> twitter tooltip" title="<?php _e('Follow on Twitter','flatsome') ?>"><?php echo get_flatsome_icon('icon-twitter'); ?> | |
</a> | |
<?php }?> | |
<?php if($email){?> | |
<a href="mailto:<?php echo $email; ?>" target="_blank" data-label="E-mail" rel="nofollow" class="<?php echo $style; ?> email tooltip" title="<?php _e('Send us an email','flatsome') ?>"><?php echo get_flatsome_icon('icon-envelop'); ?> | |
</a> | |
<?php }?> | |
<?php if($pinterest){?> | |
<a href="<?php echo $pinterest; ?>" target="_blank" rel="nofollow" data-label="Pinterest" class="<?php echo $style; ?> pinterest tooltip" title="<?php _e('Follow on Pinterest','flatsome') ?>"><?php echo get_flatsome_icon('icon-pinterest'); ?> | |
</a> | |
<?php }?> | |
<?php if($googleplus){?> | |
<a href="<?php echo $googleplus; ?>" target="_blank" rel="nofollow" data-label="Google+" class="<?php echo $style; ?> google-plus tooltip" title="<?php _e('Follow on Google+','flatsome')?>"><?php echo get_flatsome_icon('icon-google-plus'); ?> | |
</a> | |
<?php }?> | |
<?php if($rss){?> | |
<a href="<?php echo $rss; ?>" target="_blank" rel="nofollow" data-label="RSS Feed" class="<?php echo $style; ?> rss tooltip" title="<?php _e('Subscribe to RSS','flatsome') ?>"><?php echo get_flatsome_icon('icon-feed'); ?></a> | |
<?php }?> | |
<?php if($linkedin){?> | |
<a href="<?php echo $linkedin; ?>" target="_blank" rel="nofollow" data-label="LinkedIn" class="<?php echo $style; ?> linkedin tooltip" title="<?php _e('Follow on LinkedIn','flatsome') ?>"><?php echo get_flatsome_icon('icon-linkedin'); ?></a> | |
<?php }?> | |
<?php if($youtube){?> | |
<a href="<?php echo $youtube; ?>" target="_blank" rel="nofollow" data-label="YouTube" class="<?php echo $style; ?> youtube tooltip" title="<?php _e('Follow on YouTube','flatsome') ?>"><?php echo get_flatsome_icon('icon-youtube'); ?> | |
</a> | |
<?php }?> | |
<?php if($flickr){?> | |
<a href="<?php echo $flickr; ?>" target="_blank" data-label="Flickr" class="<?php echo $style; ?> flickr tooltip" title="<?php _e('Flickr','flatsome') ?>"><?php echo get_flatsome_icon('icon-flickr'); ?> | |
</a> | |
<?php }?> | |
<?php if($px500){?> | |
<a href="<?php echo $px500; ?>" target="_blank" data-label="500px" rel="nofollow" class="<?php echo $style; ?> px500 tooltip" title="<?php _e('Follow on 500px','flatsome') ?>"><?php echo get_flatsome_icon('icon-500px'); ?> | |
</a> | |
<?php }?> | |
<?php if($vkontakte){?> | |
<a href="<?php echo $vkontakte; ?>" target="_blank" data-label="VKontakte" rel="nofollow" class="<?php echo $style; ?> vk tooltip" title="<?php _e('Follow on VKontakte','flatsome') ?>"><?php echo get_flatsome_icon('icon-vk'); ?> | |
</a> | |
<?php }?> | |
</div> | |
<?php | |
$content = ob_get_contents(); | |
ob_end_clean(); | |
return $content; | |
} | |
//follow | |
//add a custom shortcode | |
add_action( 'init', 'my_action_reorder_follow_icons' ); | |
function my_action_reorder_follow_icons() | |
{ remove_shortcode( 'follow' ); | |
add_shortcode( 'follow', 'my_shortcode_reorder_follow_icons' );} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment