• I am kind of a noob, and trying to figure out how to make fields only show up if completed. Meaning, I’ve got a label and then the <?php the_field(”); ?> set up, but I want to write a conditional statement that encompasses the entire area so I don’t even show the label if the field is empty.

    Any assistance is greatly appreciated

Viewing 3 replies - 1 through 3 (of 3 total)
  • Function the_field() is not a part of standard WordPress, so I am not sure what is providing it. If it comes from the Advanced Custom Fields plugin, your code would look similar to this:

    <?php if ( get_field('field_name') ) {
       // code here for label
       the_field('field_name');
    ?>
    Thread Starter justplaindoug

    (@justplaindoug)

    kinda broke the page. Here is the code I currently use to output the email field

    (i use “Types” plugin btw)

    <a href="mailto:<?php $email = types_render_field("email", array("raw"=>"true","separator"=>";")); echo $email; ?>" class="contact_link">Email</a>

    Sorry, I don’t use that plugin. You might have better luck posting in the Types support forum: https://wordpress.org/support/plugin/types

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Conditional Fields’ is closed to new replies.