Any template file must be in the current active theme folder. If they are in a different location, they won’t be automatically loaded, instead you need to code and modify the template file location determined by WordPress template system:
add_filter( 'template_include', 'envento_type_templates', 99 );
function portfolio_page_template( $template ) {
if ( is_archive( 'evento_type' ) ) {
// Full path to archive-evento_type.php file in
// the plugin directoy
$template = plugin_dir_path( __FILE__ ) . 'archive-evento_type.php';
}
if ( is_singular( 'evento_type' ) ) {
// Full path to single-evento_type.php file in
// the plugin directoy
$template = plugin_dir_path( __FILE__ ) . 'single-evento_type.php';
}
return $template;
}
You could also use locate_template()
to check if the template file already exists in theme. That would allow theme developers to override the default layout and desing created by the plugin.
add_filter( 'template_include', 'envento_type_templates', 99 );
function portfolio_page_template( $template ) {
if ( is_archive( 'evento_type' ) && ! locate_template( 'archive-evento_type.php' ) ) {
// Full path to archive-evento_type.php file in
// the plugin directoy
$template = plugin_dir_path( __FILE__ ) . 'archive-evento_type.php';
}
if ( is_singular( 'evento_type' ) && ! locate_template( 'single-evento_type.php' ) ) {
// Full path to single-evento_type.php file in
// the plugin directoy
$template = plugin_dir_path( __FILE__ ) . 'single-evento_type.php';
}
return $template;
}
PD: it has nothing to do with permalinks.