Custom Page Template via Child Theme

I’m trying to create a custom coded page template (outside of Bricks), but just getting a blank page.

I am using Bricks to build my site but want to write custom code for just one page. I know this isn’t typical and I can create custom templates in Bricks, but I already have the code written from a previous site so want to simply use that instead of recreating the template in Bricks.

In my child theme I have added a custom.php file and it shows in the dropdown under Page Template when editing in WordPress. But now that page on the front end is just a white screen. I have stripped down the template to simply “echo ‘test page’;” just to see if the template is being used at all and it’s not. Am I missing something? Thanks!

There is a pretty easy, but manual way to do it. I often use a custom “Gutenberg Content” template which allows me to control the design, but the clients use Gutenberg for all content. BTW… the new https://gutenbricks.com/ plugin looks like a “game changer” for integration of Bricks into Gutenberg.

By creating a normal “custom template” in WordPress, you can do pretty much anything you want. You have to 1) create the Template file, 2) add whatever code you want in the template, then 3) assign it to the page using the normal “Template” selection in the page/post settings. You can create the template in Bricks and use do_shortcode() in your template. Just copy/paste in the shortcode that is provided in the templates list in Bricks.

Here is an example:

<?php 
/* Template Name: Gutenberg Page */ 

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();
			echo do_shortcode( '[bricks_template id="4916"]' );
		endwhile;
	endif;
}
get_footer();

In the Bricks template, all I have is a section/container with the Gutenber “Content” element inside.

If you leave off the header and footer be aware that it will not show your Global styles or plugin code.

By default everything works. Verified.

<?php
/*
Template Name: My Custom Templ
*/

echo "test page";

?>

Thank you! This worked perfectly.