2
I created social media fields in the profile editor for a template. I tested them on static links and they are working properly:
function author_social_media ($profile_fields){
$profile_fields['facebook'] = 'Facebook URL';
return $profile_fields;
$facebookHandle = the_author_meta('facebook');
}
What I’m trying to do is show them only when they’re filled in, but I’m not succeeding. Filling in is not required. I tried it this way:
<section>
<?php if(isset($profile_fields['facebook']){
echo "<a href="<?php the_author_meta('facebook'); ?>">Facebook</a>";
} else{
echo '';
}
?>
</section>
Grateful from now on.
I suggest the
empty()
– brasofilo
Thanks guys, it worked.
– Raphael Americano