Support

Account

Home Forums Front-end Issues ACF as select that filters with ajax

Helping

ACF as select that filters with ajax

  • I have a custom field for time that is 1 hour etc, 2 hours etc.

    In the back-end the user selects 2 hours.

    In the front end, how do I get a select field with all the fields showing (1hr, 2hr) and when the user selects 2 hours it only shows that one via ajax.

    For the select field, I’ve tried;

    $field = get_field_object('time');
    if( $field['choices'] ): ?>
        <select>
            <?php foreach( $field['choices'] as $value => $label ): ?>
                <option><?php echo $label; ?></option>
            <?php endforeach; ?>
        </select>

    Which brought back nothing oddly…so struggling to get past that before I comprehend the ajax filter – is that possible?..)

  • I realised that works on the page with the custom fields associated but not on another…so how do I get it to populate there??

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

The topic ‘ACF as select that filters with ajax’ is closed to new replies.