How to use beaver builder templates for custom Post Types without Beaver Themer

Omar Kasem
Oct 30, 2020

--

So you purchased the beaver builder page builder and you are happy with it building all kinds of things, But you have a template that you want a certain Post type to use without purchasing the beaver themer addon, Here’s how to do it.

Each template in beaver builder has an ‘id’, you can get that id by going into the template in the dashboard and looking at the URL, it will be something like that

https://www.website.com/wp-admin/post.php?post=3681&action=edit

That’s our id here ‘3681’, So what are we going to do with that ID?

Beaver builder has a great shortcode we can use to display any template by it’s id here it

[fl_builder_insert_layout id=”3681"]

So now you can put inside your single post type page or you can do it from fuctions.php like that

add_action(‘single_template’,’ok_single_job_page’);
function ok_single_job_page( $single_template ) {
global $post;
if ( ‘jobs’ === $post->post_type ) {
if(intval($post->post_author) === 20){
$single_template = get_stylesheet_directory() . ‘/single-jobs.php’;
}
}

return $single_template;
}

Here I’m only displaying that template for post author with ID 20 and for post type Jobs, So you can do many things here with that great shortcode without purchasing the addon.

--

--