Hi,
I have created repetable groups. Using a function in functions.php I go to load all the single groups inserted in a post with the function
$single = types_render_field ("field-name", array ("id" => "$ icon-> ID", "output" => "raw", "show_name" => "false"));
However, I note that the order is incorrect. If I set an order in my post group then it's not the same as I see from the function. How come?
Around the code that you've shared, you must be using some other function to query all the repeatable field group entries, which technically are separate post entries.
The Toolset Types manages the order of the repeatable field group entries/posts, with respect to a custom field "toolset-post-sortorder". You can update your function that is querying these repeatable field group entries/posts to order by this custom field and the results will show in the same order as they're in the admin area.
I hope this helps and please let me know if you need any further assistance around this.
Hi Wagar, correct.
First I call the field and then I go to see all the values. But how do I get them in the correct order? I attach to the procedure I use
I had to temporarily enable the WordPress file editor for the theme and plugin files from the "SiteGround Security" plugin's settings, to find the code for the dashboard creation.
( it is deactivated now )
To order these results, based on the order of the repeating field group items in the admin area, you can set the 'orderby' attribute to 'rfg_order' in the function, like this:
Note: This works on my test website, but your website also has the "Post Types Order" plugin active. This plugin can override the order of posts in all queries, so in case the suggested change doesn't work, try disabling the "Auto Sort" option in that plugin's settings.