Custom Fields
Re-Envisioned
Support MB Views Ability to ORDERBY a custom field in a View?

  • Creator
    Topic
  • #29174
    Resolved wpstudio
    Participant

    In my arguments prior to passing into the mb.get_posts( args )... I'm running into an issue that appears to have the custom field being ignored.

    {% set args = { post_type: 'wps_webinar', posts_per_page: -1, orderby: 'date_of_webinar', order: 'DESC' } %}

    I have a custom field called "date_of_webinar" that I'm trying to order the results by but it appears to constantly be defaulting to the post publish date. Any help or am I just missing something simple?

    Do I need to orderby the meta_value and then pass a meta_query array into the set args statement... and does TWIG markup support arrays inside that line?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #29175
    wpstudio
    Participant

    SOLVED

    Never mind, it just required me to pass the meta_key into the argument. For those who run into the same issue:

    {% set args = { post_type: 'wps_webinar', posts_per_page: -1, orderby: 'date_of_webinar', order: 'DESC', meta_key: 'date_of_webinar' } %}

    #29674
    JonS
    Participant

    This looks like exactly what I need. Where did you put that line of code?

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.