Support » Plugin: Custom Content Shortcode » Sort by custom field

  • Resolved nbguy

    (@nbguy)


    Hello,

    I am using ACF for events listings. I’m using Custom Content Shortcode to display the events on my home page, but I am having difficulties sorting them properly. I want to sort them by the event date. I have tried [loop type=sjxa_events orderby=event_date] and [loop type=sjxa_events orderby_6] (6 being the field number), but neither is working. Any suggestions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Peter Berger

    (@peterpolow)

    Take a look at the section “Sorting and series” at the Loop reference page.

    I think you need to use orderby=field key=event_date of try orderby=field_num key=event_date.

    Please let me know if it works.

    Peter

    Thread Starter nbguy

    (@nbguy)

    Thanks Peter. Unfortunately neither of those worked. It seems to just be sorting them using the date they were added.

    Thread Starter nbguy

    (@nbguy)

    Update. It looks like orderby=field key=event_date “should” work. If I change to another field, the order updates, so it appears to be not liking the event_date field (I use the date-picker for the field).

    • This reply was modified 6 years ago by nbguy.
    Thread Starter nbguy

    (@nbguy)

    Resolved. Not sure if “event_date” is a reserved slug, but when I changed it to “date_of_event” it started working.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Sort by custom field’ is closed to new replies.