How to render Bricks post content programmatically in a template?

I have a custom post type. For these posts I create a slide (using element “Slider (Nestable”) in Bricks Builder.

Now I want to programmatically render these slides using a template and a Code element.

If the slides were created in Gutenberg I could have used something like this:

$post_id = 578;
$post_content = get_post($post_id);
$content = $post_content->post_content;
echo apply_filters('the_content',$content);
?>

But in this case $post_content->post_content is empty, since the post content is created in Bricks (and not Gutenberg). So how do I programmatically render (echo) the Bricks “post content”, if I know the post id?

why can’t you use a specific template for that post type with condition?

I wanted to embed posts in other posts using a template for these other posts.

But it is solved now. The solution is simple. I just use this code:

echo do_shortcode( '[bricks_template id="'.$post_id.'"]' );

Bricks shortcode for templates works also for posts. Sridhar Katakam found this out when I asked a question to BricksLabs.

2 Likes