Add “Post Templates” support to a CPT

When you register a new custom post type it won’t be powered by the “Post Templates”, instead it will behave the same way as pages.

If you want your custom post type to use the “Post Templates” functionality, you can hook into “dslc_post_templates_post_types” to add support for it.

function lc_add_post_templates_support( $cpt ) {

	$cpt['custom_post_type_id'] = 'Label';

	return $cpt;

} add_filter( 'dslc_post_templates_post_types', 'lc_add_post_templates_support' );

Things to note:

  • Use a different function name (not lc_add_post_templates_support), to prevent possible conflicts.
  • The “Label” is what will be shown in the “For” option when adding/editing a post template

Use a Premium Extension

You can save your time and integrate CPT in Live Composer without touching codes, using the "CPT support" add-on from our Oficial Extension Package.