• Resolved Tory

    (@tmac187)


    In my template I have an if statement like so:
    if (block_field( 'add-row-2' ) == 'Yes') { ?> <tr class="sortabletr"><td class="model-image"> Test </td></tr> <?php }
    What’s odd is it prints “Yes” on the page above the table this code sits in. Any ideas why? I have no code to echo or print it. If I remove the if statement then the “Yes” is removed.

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

    (@ryankienstra)

    Hi @tmac187,
    Thanks for bringing that up, and for using Block Lab.

    Using block_value( 'add-row-2' ) should prevent printing it to the front-end. Does that help?

    Thread Starter Tory

    (@tmac187)

    Thanks for the quick reply! That did remove the “Yes” from being displayed, but now the if statement isn’t working. If I uncheck the add-row-2 checkbox, it still shows <tr class=”sortabletr”><td class=”model-image”> Test </td></tr>

    Thread Starter Tory

    (@tmac187)

    Ok, I got it. i changed the if statement to

    `if (block_value( ‘add-row-9’ ) != 0) {‘

    and it worked! Thanks for the help. Great plugin!

    Thread Starter Tory

    (@tmac187)

    Marking as resolved

    Plugin Author Ryan Kienstra

    (@ryankienstra)

    Nice, thanks a lot for using Block Lab!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Using if Statement Prints Condition value?’ is closed to new replies.