Created
July 5, 2020 16:32
-
-
Save mustafix/0cce4089b591a4a6383fe856290c746d 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
/*------------------------------------------------------- | |
Use functions.php | |
--------------------------------------------------------*/ | |
add_filter('user_contactmethods', 'theme_user_contactmethods'); | |
function theme_user_contactmethods($cm){ | |
$cm['facebook'] = __('Facebook', 'verum'); | |
$cm['twitter'] = __('Twitter', 'verum'); | |
$cm['pinterest'] = __('Pinterest', 'verum'); | |
$cm['google-plus'] = __('Google Plus', 'verum'); | |
return $cm; | |
} | |
/*------------------------------------------------------- | |
Use page.php | |
--------------------------------------------------------*/ | |
<?php | |
$theme_user_cm = wp_get_user_contact_methods(); | |
foreach($theme_user_cm as $theme_user_cm_key => $theme_user_cm_value){ | |
$theme_cm_link = get_user_meta(get_the_author_meta('ID'), $theme_user_cm_key, true); | |
if($theme_cm_link){ | |
?> | |
<a href="<?php echo esc_url($theme_cm_link); ?>"> | |
<i class="fa fa-<?php echo esc_attr($theme_user_cm_key); ?>"></i> | |
</a> | |
<?php | |
} | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment