-
Notifications
You must be signed in to change notification settings - Fork 43
Page Templates
Justin Tadlock edited this page Aug 5, 2018
·
1 revision
You may notice that custom page templates aren't being picked up from resources/views
. This is due to a bug in WordPress that doesn't allow us to change the template path.
Don't worry though. We've got you covered. It's easy to register custom templates for pages (or any post type) with the following code.
add_action( 'hybrid/templates/register', function( $templates ) {
$templates->add(
'example.php',
[
'label' => __( 'Example' ),
'post_types' => [ 'page', 'another_type' ]
]
);
} );
The first parameter of the file name should be relative to resources/views
.