Support

Account

Home Forums Front-end Issues Checkbox value

Solved

Checkbox value

  • This maybe super easy, but I’m stuck; I got the front end working beautifully and using some conditionals to display basic info.

    I juts can’t figure out how to display something based on a the specific value of a checkbox.

    My checkbox is either checked or not. The value is yes when checked.

    I wan to do

    if(get_field(‘active’)) is yes

    do this.

    Can you please help me?

    Thanks in advance.

  • Something along these lines:

    <?php 
    $venue_active = the_field('display_wtr');
    if ($venue_active == "Yes") {
    ?>
    
    Output stuff here...
    
    <?php
    }
    ?>  
  • Hi @frescova

    May I suggest using the true/false field instead for this. That way you literally only have to do
    if( get_field('display_wtr') ){ //It's been checked }

  • That was to easy 😉

    Thanks for the help!

    M

  • No problem!

    Please mark the reply as an answer to your question to make it easier for future answer-searching folks 🙂

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

The topic ‘Checkbox value’ is closed to new replies.