Help needed with template conditions workflow

Hi,

I think in template settings, we need a condition to render template only if there is not bricks data.

Like it is done in bricks code:

<?php
get_header();

$bricks_data = Bricks\Helpers::get_bricks_data( get_the_ID(), 'content' );

if ( $bricks_data ) {
	Bricks\Frontend::render_content( $bricks_data );
} else {
	if ( have_posts() ) :
		while ( have_posts() ) :
			the_post();
			get_template_part( 'template-parts/page' );
		endwhile;
	endif;
}

get_footer();

My solution (but i think we need better) is to add:

<?php echo do_shortcode( '[bricks_template id="136"]' ); ?>

in a file wp-content/themes/bricks-child/template-parts/page.php

1 Like