Support

Account

Home Forums ACF PRO If field is blank can it not show?

Solving

If field is blank can it not show?

  • Hi,
    I’m creating social media links with the URL field and Beaver Builder Themer. All is going well. But if someone does not have every social network, I’d like that not to show.

    Say someone only has Twitter and Facebook. I’d only want those 2 to show if the other fields are left blank.

    Is there some If then logic that can be applied for this? thanks.

  • You mean you do not want it to show on the front-end correct?

    You can achieve by using:

    $facebook_link = get_field(‘facebook_link’);
    if($facebook_link) {
    echo $facebook_link;
    }

  • Thanks. I’m using Beaver Themer. I don’t have to get in the templates. Where would I put this code? Functions.php? Or somewhere else? Thanks. May seem stupid. Sorry.

  • In Beaver Themer is a little wrench icon near the social icons when you go to edit them? Can you just remove the icons that you don’t have links for?

    To answer your question, you would add the code example i gave where the icons output in your template, but i am no familiar with beaver themer so i dont know if that is possible in your case.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘If field is blank can it not show?’ is closed to new replies.