Custom Templates For A Custom Post Type
An example – to be used in functions.js – to customize both the archive and the single templates for a custom post type registered as my-post-type.
1 2 3 4 5 6 7 8 |
App.filter( 'template', function( template, current_screen ) { if ( current_screen.component_id === 'my-post-type-component-slug' ) { template = 'my-post-type-archive'; //Don't need .html here. } else if ( TemplateTags.isPostType('my-post-type', 0, current_screen ) ) { template = 'my-post-type-single'; //Don't need .html here. } return template; } ); |