Home Forums Add-ons Repeater Field Newbie help with repeater sorting…


Newbie help with repeater sorting…

  • Hi … Wonder if anybody can please point me in the right direction as I am sure many of you will be able to rattle the answer off – but to me, being new to all this deep level of code – it is rocket science!

    I am try to sort a custom post type called ‘Films’ by a date which is in a repeater field ie .. the repeater for is ‘film_captures’ and the date is ‘capture_date’. Therefore, I thought it is something like – Some posts (films) may have none, some may only have a few and some may have over 50 … so how do I sort to show me the 10 most recent films???

    // get posts
    $posts = get_posts(array(
    ‘post_type’ => ‘films’,
    ‘posts_per_page’ => 10,
    ‘orderby’ => ‘film_captures_%_capture_date’,
    ‘order’ => ‘DESC’

    if( $posts ): ?>

    Where am I going wrong??


  • Thanks topdotter…

    I have looked at various articles but like that one, most are based upon having expected results in the rows to sort by.

    My request seems fairly simple – I can easily sort posts based upon a date picker field in a non repeating field …. so why is it so difficult in a repeater – or better still where do I find the instructions.

    I have been told by Support that the following should work … but I cannot get it to work.

    ‘post_type’ => ‘films’,
    ‘posts_per_page’ => 10,
    ‘meta_query’ => ‘film_captures_%_capture_date’,
    ‘orderby’ => ‘meta_value’,
    ‘order’ => ‘DESC’

    Really am desperate to get this working before I have to ditch it and go another route so any thoughts or guidance would be gratefully received.

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

The topic ‘Newbie help with repeater sorting…’ is closed to new replies.