Filter the posts based on specific category in views

Support MB Views Filter the posts based on specific category in viewsResolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33294
    JamesJames
    Participant

    Hi guys. I have a custom post type 'schedule' and I want to filter the post for specific category. I tried it but it doesn't work 🙁

    <div class="calendar-container">
    {% set args = { post_type: "schedule", posts_per_page: 4, post_term: "category-1" } %}
    {% set posts = mb.get_posts( args ) %}
    {% for post in posts %}
            <div class="calendar__card" id="schedule-">
                <div class="calendar__image_wrapper">
                    {{ mb.get_the_post_thumbnail( post.ID, 'medium') }}
    <!--                 {{ mb.get_terms( { taxonomy: 'schedule_category' } ) }} -->
                </div>
                <div class="calendar__description">
                    <h6 class="calendar__activity">Activity: <span style="font-family: Josefin Sans;">{{ post.ufp_schedule }}</span></h6>
                    <h6 class="calendar__schedule">Schedule: <span style="font-family: Josefin Sans;">{{ post.ufp_schedule }}</span></h6>
                    <a href="{{ mb.get_permalink( post ) }}" class="calendar-btn">View More</a>
                </div>
            </div>
        {% endfor %}
    </div>
    #33299
    Long NguyenLong Nguyen
    Moderator

    Hi Kirb,

    Please refer to this topic to query posts by taxonomy https://support.metabox.io/topic/create-filter-by-category/

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