Trying to pull posts using either an array or wildcard

Support MB Views Trying to pull posts using either an array or wildcard

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37218
    info@insigniacreative.co.uk[email protected]
    Participant

    Hi,

    I'm trying to pull in posts which the current user has created from a post type using the post_name table either with an array or a wildcard. This is what I've got so far.

    View

    It's pulling in every post from that user we just want to pull in certain posts.

    Producing

    We'd rather use a wildcard which picks up any post_name which includes challenge-video otherwise an array would work too.

    Any help would be much appreciated

    #37220
    info@insigniacreative.co.uk[email protected]
    Participant
    {% set name_array = [showreel-6, promotional-video-3] %}
    {% set value = mb.custom_function( name_array ) %}
    {% set args = {post_type: "sfwd-essays", name: name_array, author: user.ID, post_status: "graded", posts_per_page: 10 } %}
    {% set posts = mb.get_posts( args ) %}
    Hi {{ user.first_name }}, Here's your video submissions!
    {% for post in posts %}
    <br>
    <a href="{{ mb.get_permalink( post.ID ) }}" target="_blank" rel="noopener">{{ post.post_title }} {{( post.ID )}}</a>
    {% endfor %}
    #37234
    Long NguyenLong Nguyen
    Moderator

    Hi,

    You can try to use the search parameter of the WP Query, please read more here https://developer.wordpress.org/reference/classes/wp_query/#search-parameters
    and refer to this topic https://stackoverflow.com/questions/50717222/wordpress-search-query-exact-post-title-match

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