• Resolved dc47

    (@dc47)


    Hey,

    I’m trying to have 2 fields and if one of them empty I don’t want it to be rendered in the front end.

    As you can see in the following page after the button with amazon logo there is a second button with just a text, above that text, there is an empty image tag. Is there any way to hide a field when it’s empty? I’m not a developer so I could not figure this out please help me ??

    Thank you ??
    Dc

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Ryan Kienstra

    (@ryankienstra)

    Hi @dc47,
    Good question. Could you do something like:

    
    $your_value = block_value( 'foobax' );
    if ( $your_value ) {
            echo $your_value; // Or whatever you do to output the value
    }
    
    Thread Starter dc47

    (@dc47)

    Thank you!

    Thread Starter dc47

    (@dc47)

    Hey is it possible to add 2 inputs in the same echo?

    <?php 
    
    $prd_img = block_value( 'prod-image' ); 
    $img_alt = block_value( 'alt_img' ); 
    if ( $prd_img ) && ($img_alt) {echo '<img class="ic_prdct_img" src="' . $prd_img . '"alt="' . $img_alt . '">' ;} 
    
    ?>
    • This reply was modified 4 years, 2 months ago by dc47.
    • This reply was modified 4 years, 2 months ago by dc47.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘if empty hide field’ is closed to new replies.