예제 #1
0
function ct_tracks_save_social_profiles($user_id)
{
    if (!current_user_can('edit_user', $user_id)) {
        return false;
    }
    $social_sites = ct_tracks_social_array();
    foreach ($social_sites as $key => $social_site) {
        if ($key == 'email') {
            // if email, only accept 'mailto' protocol
            if (isset($_POST["{$key}-profile"])) {
                update_user_meta($user_id, $social_site, sanitize_email($_POST["{$key}-profile"]));
            }
        } else {
            if (isset($_POST["{$key}-profile"])) {
                update_user_meta($user_id, $social_site, esc_url_raw($_POST["{$key}-profile"]));
            }
        }
    }
}
<?php

$social_sites = ct_tracks_social_array();
$square_icons = array('linkedin', 'twitter', 'vimeo', 'youtube', 'pinterest', 'reddit', 'tumblr', 'steam', 'xing', 'github', 'google-plus', 'behance', 'facebook');
foreach ($social_sites as $key => $social_site) {
    if (get_the_author_meta($social_site)) {
        if (in_array($key, $square_icons)) {
            $class = 'fa fa-' . $key . '-square';
        } else {
            $class = 'fa fa-' . $key;
        }
        if ($key == 'googleplus') {
            $class = 'fa fa-google-plus-square';
        }
        if ($key == 'email') {
            ?>
			<a class="email" target="_blank"
			   href="mailto:<?php 
            echo antispambot(is_email(get_the_author_meta($social_site)));
            ?>
">
				<i class="fa fa-envelope" title="<?php 
            _e('email icon', 'tracks');
            ?>
"></i>
			</a>
		<?php 
        } else {
            ?>
			<a class="<?php 
            echo esc_attr($key);
예제 #3
0
function ct_tracks_author_social_icons()
{
    // array of social media site names
    $social_sites = ct_tracks_social_array();
    foreach ($social_sites as $key => $social_site) {
        if (get_the_author_meta($social_site)) {
            if ($key == "flickr" || $key == "dribbble" || $key == "instagram" || $key == "soundcloud" || $key == "spotify" || $key == "vine" || $key == "yahoo" || $key == "codepen" || $key == "delicious" || $key == "stumbleupon" || $key == "deviantart" || $key == "digg" || $key == "hacker-news" || $key == 'vk' || $key == 'weibo' || $key == 'tencent-weibo') {
                echo "<a href='" . esc_url(get_the_author_meta($social_site)) . "'><i class=\"fa fa-{$key}\"></i></a>";
            } elseif ($key == 'googleplus') {
                echo "<a href='" . esc_url(get_the_author_meta($social_site)) . "'><i class=\"fa fa-google-plus-square\"></i></a>";
            } elseif ($key == 'email') {
                echo "<a href='mailto:" . antispambot(is_email(get_the_author_meta($social_site))) . "'><i class=\"fa fa-envelope\"></i></a>";
            } else {
                echo "<a href='" . esc_url(get_the_author_meta($social_site)) . "'><i class=\"fa fa-{$key}-square\"></i></a>";
            }
        }
    }
}