I created fields for social media in the profile editor for a template. I tested on static links and they are working correctly:
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 populated, but I'm not succeeding. Completion is not required. I tried the following:
<section>
<?php if(isset($profile_fields['facebook']){
echo "<a href="<?php the_author_meta('facebook'); ?>">Facebook</a>";
} else{
echo '';
}
?>
</section>
Thank you in advance.