Aleš Sýkora / August 27, 2024 / 0 comments
Bricks: Display Current User Posts
1 min read / Bricks Builder, Custom Code / Share on: Twitter, LinkedIn, Facebook
Post summary: You will learn, how to create “my posts” query in Bricks builder.
If you want to create a page, where user can see created posts, you need to specify a query which will display them.
You must create a custom query via Bricks Query editor and then add this code:
$current_user = wp_get_current_user();
return [
'post_type' => 'post',
'author' => $current_user->ID,
'posts_per_page' => -1
];
Here is an example of mine query for post type called “poptavka”:
This can be also helpful for listing websites, directories or blogs with many users.
Fuel my passion for writing with a beer🍺
Your support not only makes me drunk but also greatly motivates me to continue creating content that helps. Cheers to more discoveries and shared success. 🍻