Home Forums Front-end Issues Output all ACF's in Correct Order


Output all ACF's in Correct Order

  • Hi there,

    Is there a way to iterate through all the ACF fields created for a specific post type (in posty-type-single.php for example) in the correct order? I.e if I change the order in the ACF admin area then that’s reflected on the front end?

  • Hey I have found a solution.

    It requires a core edit of the plugin though, so I hope you might be able to implement it in the core?

    $sort = array();
    	foreach ($value as $key => $row) {
    	  $sort[$key]  = $row['order_no'];
    	array_multisort($sort, SORT_ASC, $value);

    On line 144 of api.php

    On the CPT template I can then use:

    $meta = get_fields( get_the_ID() );
    foreach($meta as $key=>$value) {
    // Stuff here
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Output all ACF's in Correct Order’ is closed to new replies.