I’ve read the documentation but no luck. What I’m trying to do is to have different template for each cpt like archive-{post-type}.php which I copied from index.php. But it doesn’t show up, instead the index.php was showing. But when I installed toolset plugin the archive-{post-type}.php seems detected by the plugin. So meaning I’m doing the right process, but still it’s not showing the archive template.
Anyway I’ve added the line of code below from the documentation to be able to have have different base code for archive and I tried creating base-{post-type}.php but this doesn’t show up too! Seems weird.
add_filter('sage/wrap_base', __NAMESPACE__ . 'sage_wrap_base_cpts'); // Add our function to the sage/wrap_base filter
function sage_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
}
P.S: I’m using Sage 8.4.2 and latest version of WP.