Support

Account

Home Forums Add-ons Repeater Field Event Order by repeater field

Solved

Event Order by repeater field

  • Hi,

    My Event Custom post type uses a repeater field containing Date and location.
    I’d like to order my event list by the first date field in the repeater of each event but i don’t k now what tp put in ‘meta_key’ ???
    Thanks a lot

    My event
    Date1 /location
    Date2 /location
    etc..

    How to order by Date1 ?

    $wp_query = new WP_Query(array(
    					'post_type' => 'spectacle',
    					'posts_per_page' => $posts_per_page,
    					'meta_key'	=> '????',
    					'orderby' => 'meta_value_num',
    					'order' => $order,
    					'paged' => $paged
    				));
    
  • I precise that i used a simple custom field named “thedate” we would have ‘meta_key’ => ‘thedate’ but how can i do with repeater ?

  • Hi @pipoulito

    You will find the format which sub field’s are saved as in this article (scroll to bottom): http://www.advancedcustomfields.com/resources/repeater/

    So the meta_key should look like: parent_name_0_child_name

    Cheers
    E

  • Hi,
    Works perfectly !
    Thanks for your great support !

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

You must be logged in to reply to this topic.