Tutorials
Enabling the BBE Live Editor on Specific Single Posts OR on Custom Post Types

By Jeff,

Sometimes you may want to build a  specific blog post with the BBE Live Editor – if you want to *REALLY* spice up it’s presentation (like we did on our post regarding responsive embeds). This can be really useful to make special “storytelling” posts, to achieve a more immersive experience for your visitors.
This feature is supported via the post type templates native WordPress API.
Here’s how to enable the BBE editor on any post of choice:

While editing any post, check out the Post Attributes > Template dropdown (a shown in  this screenshot).
Choose a BBE based template, eg “BBE Full Width Template”. Save and update – and you’re set.

Yes, it’s really easy – but our recommendation is don’t overuse that. Blogs shouldn’t look like a website built in 1998, with no visual coherence at all between posts.
Big freedom comes with big responsibility.

Enabling the BBE Editor on Custom Post Types

[disclaimer: following lines are for advanced theme users – just a rough experimental guide]
Sometimes you may want to let the BBE Live Editor handle a Custom Post Type.
There is no real reason to do this unless for integration with some specific plugins
This experimental guide will allow you to do so.

It will basically just force the single post template to behave like a BBE page.
We explicitly ignore what will happen in archive pages – if you do have them.

So let’s go.

Step 1: setup a BBE Child Theme

You can easily get a starter child theme here. Download and Activate it.
Get to know it’s folder. That’s where you’ll fiddle.

Step 2: let’s initialize a Custom Post Type called acme_products

We’ll use this code to setup a CPT called acme_products
as example. You can add the following code to your functions.php file inside your child theme

///ADD THE acme_product CPT
add_action( 'init', 'create_post_type' );
function create_post_type() {
register_post_type( 'acme_product',
array(
'labels' => array(
'name' => __( 'Products' ),
'singular_name' => __( 'Product' )
),
'public' => true,
'has_archive' => true,
)
);
}

Step 3: Let’s add the template file

Download this file, unzip and upload Inside your Child Theme folder –  it’s name is single-acme_product.php
This template file, due to the WordPress template hierarchy, will be run on all single instances of the  acme_product post type – following the single-{post-type}.php naming structure.
If YOUR custom post type has another name, just rename the template file accordingly – or nothing will happen.

Done, now what?

In your wp-admin, go create and publish an acme_product item.
You may have to re-save your permalinks to be able to view it’s public page.
While viewing this page, you’ll see the “Edit this page” link – and you should now be able to trigger the edit the page’s content with BBE functionality.
Hope you enjoy!

  Filed under: Tutorials

Comments are closed for this post.