I am creating a wp custom post type plugin. Which supports the custom meta datas as well.Now my question is i have to create a archive page with custom template file. I have added the appropriate function for archive page and as well as single page. Single.php file work fine whereas archive.php is not working. here is my funcitons
add_filter('template_include', 'testimonial_archive');
function testimonial_archive( $template )
{
$post_types = array('astestimonial');
if ( is_post_type_archive( $post_types ) && ! file_exists( get_stylesheet_directory() . '/testimonial_archive.php' ) )
$template = dirname(__FILE__) . '/list-testimonial.php';
if ( is_singular( $post_types ) && ! file_exists( get_stylesheet_directory() . '/single-testimonial.php' ) )
$template = dirname(__FILE__) . '/single-testimonial.php';
return $template;
}