Get posts if field is value

Support MB Views Get posts if field is valueResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38123
    ChrisChris
    Participant

    Hey, can't seem to get this.

    I have a view and want to get the posts that have a field value. Then, I'll run another loop to get posts that have a different value. This can be in the same view or different.

    #38131
    Long NguyenLong Nguyen
    Moderator

    Hi,

    Yes, you can run many loops in the same view to get posts. Just like

    {% set args1 = { post_type: 'post', posts_per_page: 1 } %}
    {% set posts1 = mb.get_posts( args1 ) %}
    {% for post1 in posts1 %}
        Post title: {{ post1.post_title }}
    {% endfor %}
    
    {% set args2 = { post_type: 'page', posts_per_page: 2 } %}
    {% set posts2 = mb.get_posts( args2 ) %}
    {% for post2 in posts2 %}
        Post title: {{ post2.post_title }}
    {% endfor %}

    Read more on the documentation https://docs.metabox.io/extensions/mb-views/#custom-query

    #38149
    ChrisChris
    Participant

    You are awesome, thanks!

    Close.

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