Hi all,
I’m running into an issue with Bricks when trying to exclude a Single/Page template if the page itself is built with Bricks. I’ve made a Single page template that has the condition ‘Post Type > Page‘. So all page’s use that template as a fallback. But i’d like when a page is edited with Bricks builder that the template is overwritten and that the page uses its own styling that I made with the bricks builder.
In another forum post I came acros this peace of code:
add_filter( 'bricks/active_templates', function( $active_templates, $post_id, $content_type ) {
if ( ! bricks_is_frontend() ) {
return $active_templates;
}
if ( $content_type !== 'content' ) {
return $active_templates;
}
$post_type = get_post_type( $post_id );
if ( $post_type !== 'page' ) {
return $active_templates;
}
$bricks_data = \Bricks\Database::get_data( $post_id, 'content' );
if ( empty( $bricks_data ) ) {
return $active_templates;
}
$active_templates['content'] = $post_id;
return $active_templates;
}, 10, 3 );
This works on the frontend, but when I want to edit that page, only the template loads without content and I can’t edit the page contents.
Is there a way to exclude a page from a template when its’s edited with Bricks builder? I know I can exclude a individual page manually in the conditions. But then when I create a new page with bricks builder, I have to manually add that page everytime to the conditions. I’d like that to happen automatically when a page is edited with bricks builder.