How to order relashionship elements ?

Support MB Views How to order relashionship elements ?Resolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #38689
    Guillaume LORAINGuillaume LORAIN
    Participant

    Hello.

    In a MB View I use a relashionship :
    {% set relationship = attribute( relationships, 'quiz-question' ) %}
    {% for post in relationship.to %}

    But I would like to change the order to use a custom field. I tried this way :

    {% set args = { post_type: 'question', orderby: 'meta_value_num', meta_key: 'question-order', relationship: { id: 'quiz-question', to: post.ID } } %}
    {% set questions = mb.get_posts( args ) %}
    {% for question in questions %}

    Unfortunately it doesn't work at all, nothing appears.
    Do you have an idea of what is the best option to do the ordering ?

    Thanks.

    #38690
    Guillaume LORAINGuillaume LORAIN
    Participant

    I found my mistake I just replaced to this part : relationship: { id: 'quiz-question', to: post.ID }

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