NO BUG: Displaying posts with different statuses

Bricks Version: 1.6

There are a sufficient number of posts related to the problem of displaying posts with different Statuses. Reactions of developers on this topic 0!

The problem is that only posts with the status Published are displayed.
But what about other types of posts?
But I now need to display posts with custom statuses or even an internal status. I can’t display it on approval.

Be lenient, please answer about this problem!

1 Like

Give more freedom, let all posts be displayed with all statuses, but also give the ability to filter them


for example, in Oxygen you can do it like this

up! doesn’t anyone need?

You can easily achieve that using the bricks/posts/query_vars filter.
See Filter: bricks/posts/query_vars – Bricks Academy.

Note: Replace the yejqra in the screenshot with your query loop element’s ID.

1 Like

I’m sorry, probably a stupid question.
Could you elaborate a little more on your comment, please?
And please, can the code not be a screenshot.
Thank you so much

As the documentation states (check the link in my previous comment) you can use this filter to manipulate a query loop (in situations where the Bricks UI does not offer the necessary settings – like the post status).

add_filter( 'bricks/posts/query_vars', function( $query_vars, $settings, $element_id ) {
    if ( $element_id == 'YOUR_ELEMENT_ID' ) { // e.g. fpebdn
        $query_vars['post_status'] = 'YOUR_CUSTOM_POST_STATUS'; // e.g. completed
    }

    return $query_vars;
}, 10, 3 );

Put this code into your child theme’s functions.php file or use a code snippets plugin. Replace YOUR_ELEMENT_ID with your query loop element’s ID and YOUR_CUSTOM_POST_STATUS with the post status you want to query.

CleanShot 2022-11-29 at 22.48.06@2x

1 Like

Yes, this method works.
I hope that in the next updates these “crutches” will be fixed.
Thanks a lot.

Hi Maximus,
Thank you very much for your report.

I would be very happy if you share any of these with us :slight_smile:

There is nothing to fix. The filter works perfectly fine and is sufficiently documented in the academy.
You can always use the Idea Board to submit meaningful ideas: https://bricksbuilder.io/ideas/

Best regards,
timmse

Ps: Thanks for your patience and help @aslotta :fist_left:

1 Like

how is it not “crutches”?
Screenshot_8
Briсks does not see custom statuses and does not allow you to enter something of your own

You can always use the Idea Board to submit meaningful ideas: Ideas – Bricks

Hmm, somehow I added another request, but I don’t see it anywhere.

This is the first time you are mentioning conditions. This is a different topic than the one you started this topic about where you talked about queries.

1 Like

Yes you are right. Next time I will make requests more extensively