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)

    • andiszek

    • September 17, 2013 at 6:07 am

    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

    • Elliot

    • September 17, 2013 at 1:07 pm

    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 ):

    • andiszek

    • September 17, 2013 at 5:43 pm

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.