Sorting by 'event' date

Home Forums Calendar Products Events Calendar PRO Sorting by 'event' date

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #587933
    Nathan
    Participant

    Hi there,

    I am trying to create a Royal Slider that shows events by event date (like list view) rather than the default publish date. I have tried to search the EC Pro documentation, but unfortunately the search isn’t working. Essentially, I’m trying to establish what an ‘event date’ would be called if I replace the default word ‘title’. For clarity, I’ve provided the code I’m editing below. Basically, I want to sort by (event) date, like the usual EC displays, but I can’t find what the ‘magic word’ is! 🙂

    add_filter(‘new_royalslider_posts_slider_query_args’, ‘newrs_custom_query’, 10, 2);
    function newrs_custom_query($args, $index) {
    // $args is WP_Query arguments object.
    // feel free to change them here
    $args[‘orderby’] = ‘title’;

    // $index is an ID of slider that you’re modifying

    return $args;
    }

    #597391
    Barry
    Member

    Hi!

    It’s often best to share code via Pastebin, Gist or some similar service – occasionally the forum, which unfortunately wasn’t really designed with sharing code in mind, can sometimes drop bits of code (so we’re never sure if we’re looking at the complete snippet or not).

    • Looks like you need to add a post_type argument (set to TribeEvents::POSTTYPE or else ‘tribe_events’)
    • You may want to set the orderby argument to event_date

    Does that help at all? Unfortunately we can’t go in to too much depth with customization/integration issues like this one, but hopefully that gives you some ideas 🙂

    #604663
    Nathan
    Participant

    OK… so the sort order is called event_date. Makes sense, but I couldn’t find it on the documentation.

    Will use paste bin in future, thanks.

    #605657
    Barry
    Member

    Glad that helped – we definitely do have some gaps in our documentation certainly – but we are slowly but surely working to build them up and plug the gaps 🙂

    I’ll go ahead and close this thread, but if we can help with anything else please don’t hesitate to create new threads and one of the team will be only too happy to help.

    Thanks again!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Sorting by 'event' date’ is closed to new replies.