Last active
April 11, 2024 22:37
-
-
Save morgyface/d8c1c4246843bf0f0c76959b68faa95f to your computer and use it in GitHub Desktop.
WordPress | ACF | Social Media Links using Advanced Custom Fields and FontAwesome
Hi, where to save social.php file? inside child-theme? in root?
Sorry I am a noob
appreciate it!
Great work! Awesome write up as well! I did something like this today on the job using your example. However, I used fa-youtube-play
instead.
<?php
if (have_rows('social_media', 'option')):
echo '<div class="social-block">';
while (have_rows('social_media', 'option')) : the_row();
$socialchannel = get_sub_field('social_channel', 'option');
$socialurl = get_sub_field('social_url', 'option');
echo '<a rel="noopener" target="_blank" href="' . $socialurl . '"><i
class="fa fa-' . $socialchannel . '" aria-hidden="true"></i><i class="fa fa-' . $socialchannel . ' two"
aria-hidden="true"></i></a>';
endwhile;
endif;
?>
Nice work @theSalafee. Glad it helped!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @DecoGrafics, sorry it was a bit vague, I've updated the first comment to include more detail. I hope it helps.