Support

Account

Home Forums Front-end Issues Text field inside repeater doesn`t display the value 0 (zero)

Solved

Text field inside repeater doesn`t display the value 0 (zero)

  • Hello,
    first of all, this is a great and vital plugin. i have been using it and the addons for over 2 years now and i never had any issues.

    i have a small problem now:
    i have a repeater field with some simple text fields inside, and it seems that the number 0 is not displayed in the frontend:
    http://oenj.justbemotion.com/tischtennis/ergebnisse-tischtennis/ – see the empty spaces in the “U” column.

    if i add “0.” it works – see table 1, column U, row 4.

    is there something i should change in my php code in order to display the “0”?

    i am using a fairly basic code:

    <?php if(get_sub_field(‘tt_ergb_ek_u’)): // U ?>
    <?php the_sub_field(‘tt_ergb_ek_u’); ?>
    <?php endif; ?>

    thank you and best regards,
    andi

  • Hi @andiszek

    Your code contains: if(get_sub_field(‘tt_ergb_ek_u’)):

    If the value is 0, then your if statement will fail. Try changing it to:

    if( get_sub_field(‘tt_ergb_ek_u’) !== false ):

  • Hello Elliot,
    thank you very much! i`m not an accomplished coder, so i really appreciate it!

    best regards,
    andi

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

The topic ‘Text field inside repeater doesn`t display the value 0 (zero)’ is closed to new replies.