/** * Creates an array for adding the staff social options to the metaboxes * * @since 1.5.4 */ function wpex_staff_social_meta_array() { $profiles = wpex_staff_social_array(); $array = array(); foreach ($profiles as $profile) { $array[] = array('title' => '<span class="' . $profile['icon_class'] . '"></span>' . $profile['label'], 'id' => $profile['meta'], 'type' => 'text', 'std' => ''); } return $array; }
function wpex_get_staff_social($atts = NULL) { // Extract staff social args extract(shortcode_atts(array('link_target' => 'blank', 'post_id' => '', 'style' => 'minimal-round', 'font_size' => '', 'css' => ''), $atts)); ob_start(); // Get social profiles array $profiles = wpex_staff_social_array(); // Define post_id $post_id = $post_id ? $post_id : get_the_ID(); // Parse style to return correct classname $style = wpex_get_social_button_class($style); // Wrap classes $wrap_classes = 'staff-social wpex-social-btns clr'; if ($css) { $wrap_classes .= ' ' . vc_shortcode_custom_css_class($css); } // Font size $font_size = $font_size ? wpex_sanitize_data($font_size, 'font_size') : ''; $font_size = $font_size ? 'style="font-size:' . $font_size . '"' : ''; $tooltip = apply_filters('wpex_tooltips_enabled', false); $tooltip = $tooltip ? ' tooltip-up' : ''; ?> <div class="<?php echo esc_attr($wrap_classes); ?> "<?php echo $font_size; ?> > <?php // Loop through social options foreach ($profiles as $profile) { // Get meta $meta = $profile['meta']; // Display link if one exists if ($url = get_post_meta($post_id, $meta, true)) { // Add "mailto" for emails if ('wpex_staff_email' == $meta && is_email($url)) { $url = 'mailto:' . $url; } elseif ('wpex_staff_skype' == $meta) { if (strpos($url, 'skype') === false) { $url = str_replace('callto:', '', $url); $url = 'callto:' . $url; } } elseif ('wpex_staff_phone_number' === $meta) { if (strpos($url, 'callto') === false) { $url = str_replace('tel:', '', $url); $url = 'tel:' . $url; } } else { $url = esc_url($url); } ?> <a href="<?php echo $url; ?> " title="<?php echo esc_attr($profile['label']); ?> " class="wpex-<?php echo esc_attr(str_replace('_', '-', $profile['key'])); ?> <?php echo $style; echo $tooltip; ?> " target="_<?php echo $link_target; ?> "> <span class="<?php echo $profile['icon_class']; ?> "></span> </a> <?php } } ?> </div><!-- .staff-social --> <?php return ob_get_clean(); }
function wpex_get_staff_social($atts = NULL) { extract(shortcode_atts(array('link_target' => 'blank'), $atts)); global $post; if (!$post) { return; } // Get social profiles array $profiles = wpex_staff_social_array(); ob_start(); // Do not display if disabled for the archives if (is_tax() && !get_theme_mod('staff_entry_social', '1')) { return; } ?> <div class="staff-social clr"> <?php // Loop through social options foreach ($profiles as $profile) { $url = get_post_meta($post->ID, $profile['meta'], true); // Escape URL for all items except skype if ('wpex_staff_skype' != $profile['meta']) { $url = esc_url($url); } if ('' != $url) { ?> <a href="<?php echo $url; ?> " title="<?php echo $profile['label']; ?> " class="staff-<?php echo $profile['key']; ?> tooltip-up" target="_<?php echo $link_target; ?> "> <span class="<?php echo $profile['icon_class']; ?> "></span> </a> <?php } } ?> </div><!-- .staff-social --> <?php return ob_get_clean(); }