Support

Account

Home Forums General Issues Group subfields comma separated

Helping

Group subfields comma separated

  • Hi,
    I have a group field named : parent,
    and subfields: father, mother. i’m not sure how to show them on frontend with comma separated if both subfields are available.
    please help me. currently i’m using this nonsense code:
    `<tr>
    <?php if( have_rows(‘parent’) ): ?>
    <?php while( have_rows(‘parent’) ): the_row();

    // Get sub field values.
    $father = get_sub_field(‘father’);
    $mother = get_sub_field(‘mother’);

    ?>
    <td>parents</td>
    <td>
    <ul class=”list-group list-group-flush”>
    <?php if( get_sub_field(‘father’) ): ?>
    <li class=”nobullet”>” target=”_blank”><?php the_sub_field(‘father’); ?> (father)<?php endif; ?>
    <?php if( get_sub_field(‘mother’) ): ?>
    <li class=”nobullet”>” target=”_blank”><?php the_sub_field(‘mother’); ?> (mother)<?php endif; ?>

    </td>

    <?php endwhile; ?>
    <?php endif; ?>
    </tr>

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.