Home Forums General Issues Display/hide multiple fields based on value Reply To: Display/hide multiple fields based on value

  • Hi,

    you should store your other field in a variable as well,

    Then before rendering your blockquote your run an if statement that check if the testimonial is available, if it’s not it skips the blockquote part

    someting like:

    $testimonial = get_field('testimonial');
    if($testimonial && !empty($testimonial)){
    // build your quote blockquote with the if img... 

    this case doesn’t test for the name if you want the testimonial AND the name you should write:

    $testimonial = get_field('testimonial');
    $name = get_field('name);
    if($testimonial && !empty($testimonial) && $name && !empty($name)){
    // build your quote block with the if img... 

    I haven’t tested this code but an if statement before your <blokquote> building is what you need, you can find more info about the if “or”, “and” conditions here if you want to set up something more complex.