Support

Account

Home Forums Feature Requests Get field that has specific 'class' or 'id' Reply To: Get field that has specific 'class' or 'id'

  • Hi @pooya

    You can make use of the get_field_objects() function to step through all the fields and display the ones that match your class like so:

    <?php
    $fields = get_field_objects();
    if( $fields ): ?>
        <ul>
            <?php foreach( $fields as $field ): ?>
                <?php if($field['wrapper']['class'] =='your_class'){
                   //do something here
    } ?>
            <?php endforeach; ?>
        </ul>
    <?php endif; ?>