0

I have 4 metabox facebook, twitter, instagram, youtube with title "Follow Us". I am using this code to show facebook logo and link.

So if there are a value in facebook metabox I got the logo and the link.

Now my question, if One of this 4 metabox (facebook, twitter, instagram, youtube) has a value ( at least one of this 4 ), I need to show title "Follow Us on".

Thank you

1 Answer 1

0

I prefer below way,

$fb = get_post_meta($post->ID, 'ecpt_facebookpage', true);
$twitter = get_post_meta($post->ID, 'ecpt_facebookpage', true);
//etc...

if($fb != "" || $twitter != "" || $instagram = ""){
    echo "Follow Us On";
    if($fb != ""){ ?>    
      <a target="_blank" href="http://www.facebook.com/<?php echo $fb; ?>">
      <img src="<?php bloginfo('template_url'); ?>/images2/service-fb.png" width="25px" height="33px" alt="" align="right">
      </a>
    <?php }
    // And so on.....
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.