How do I create a base file for a custom post type? base-customposttypeslug.php does not seem to work.
That’s not how the wrapper works. All it does is take the template chosen by the WordPress template hierarchy and prepend base-
. It does not go through a hierarchy of its own.
So you either need archive-posttype.php
and base-archiveposttype.php
or you can use the the example I gave in my article on the wrapper:
<?php
add_filter('roots_wrap_base', 'roots/wrap_base_cpts'); // Add our function to the roots_wrap_base filter
function roots_wrap_base_cpts($templates) {
$cpt = get_post_type(); // Get the current post type
if ($cpt) {
array_unshift($templates, 'base-' . $cpt . '.php'); // Shift the template to the front of the array
}
return $templates; // Return our modified array with base-$cpt.php at the front of the queue
}
?>