Support

Account

Home Forums General Issues ACF display fields in front end based on admin order

Solving

ACF display fields in front end based on admin order

  • I have saw, that now, is possible to order custom fields also inside pages and posts just dragging each field inside the page/post (I’m not talking about the custom field admin section).
    Is it possible to get the same order for each page/post also in front-end?

    At the moment I can get all fields with this function:

    <?php $fields = get_fields(); if( $fields ) {
    foreach( $fields as $field_name => $value )
    { $field = get_field_object($field_name);
    echo ‘<p>’ . $field_name . ‘</p>’; }
    } ?>

    If it would be possible to get the order “by order in every page/post” for each page/post it would be great!
    In this way it would be possible develope components to show/hide them and order them for each page/post giving a plus of this powerful plugin.

    Hope to receive good news soon!
    Regards.

  • Hi @otta

    The backend drag and drop is WordPress’ feature that allows you to reposition the meta boxes. Unfortunately, this is not related to ACF at all. If you want to order them, then you need to do it programmatically.

    I hope this makes sense 🙂

  • I found this post after googling for the same question.
    I almost gave up but found this solution, that answers perfectly the problem : use admin fields order to order the fields in your frontend template
    https://support.advancedcustomfields.com/forums/topic/order-of-fields-in-acf-get_fields/

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

You must be logged in to reply to this topic.