// ADD SHORTCODE [social_media]; add_shortcode('social_media', 'codex_social_media'); function codex_social_media() { ob_start(); wp_reset_postdata(); $facebook = get_field('facebook', 'option'); $twitter = get_field('twitter', 'option'); $google_plus = get_field('google_plus', 'option'); ?> <div class="social-icons"> <ul> <?php if($facebook == true){ ?> <li><a href="<?php the_field('facebook_page_url', 'option'); ?>" target="_blank"><i class="fa fa-facebook"></i></a></li> <?php } ?> <?php if($twitter == true){ ?> <li><a href="<?php the_field('twitter_page_url', 'option'); ?>" target="_blank"><i class="fa fa-twitter"></i></a></li> <?php } ?> <?php if($google_plus == true){ ?> <li><a href="<?php the_field('google_plus_page_url', 'option'); ?>" target="_blank"><i class="fa fa-google-plus"></i></a></li> <?php } ?> </ul> </div> <!-- Social Media -->
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter