The file testimonial_archive.php
is not a valid WP template if you don’t define a custom way to use that file. The expected name is cpt-archive.php
, in your case astestimonial-archive.php
. Also, instead of using file_exists
, you should use locate_template()
to take adventage of template hierarchy and compatibility with child and parent themes.
add_filter('template_include', 'testimonial_archive');
function testimonial_archive( $template ) {
$post_types = array('astestimonial');
if ( is_post_type_archive( $post_types ) && locate_template('atestimonial-archive.php' ) == '' ) {
$template = dirname(__FILE__) . '/list-testimonial.php';
}
if ( is_singular( $post_types ) && locate_template( 'single-testimonial.php' ) == '' ) {
$template = dirname(__FILE__) . '/single-testimonial.php';
}
return $template;
}
Related Posts:
- How Do I Use The WordPress Plugin Posts 2 Posts by Scribu?
- Enable comments for post with comments meta box removed
- Custom Post Type causes Page Not Found
- Is there a way to order posts and custom post types as one group?
- Accessing post’s meta data based on user’s click of a post
- get_post_type on post.php
- Matching Chapters to a Custom posts [closed]
- Redirect to another page using contact form 7? [closed]
- How to delete all trashed item in one-go
- Custom setup of wordpress comments that are displayed
- posts from multiple post types in one slider
- Show related posts based of current ACF field name in a single page post (a loop within loop)
- What hook can I use to modify custom post data before it is displayed on the page?
- Is it possible to pin a post in second position from top
- Is there a hook similar to “save_post” which only fires AFTER the post is completely published?
- Adding custom post category to categories widget
- How to display the custom post related blog by category?
- WordPress hide post from custom post-type on a single page
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- WordPress list child pages of custom post type
- Insert data in custom table during new post creation
- How to export post tags from wordpress
- Custom Post Type Templates from Plugin Folder?
- Manually set global $post vars with an ID, in order to use template tags
- How to Remove Certain Screen Options and Meta Boxes from add/edit post type?
- How to prevent a post from being deleted?
- Limit access to posts/pages by user roles
- Show Similar Post Titles ( Similar to Stack Exchange )
- How do I unlock a post programmatically?
- How To Ignore a Filter On Applying Filter the Content In a Function
- How to extract images of post and pages excluding header and logo image in wordpress?
- Fastest way to loop through all posts?
- remove custom taxonomy metabox form custom post type
- Custom Post Type Statuses
- add_meta_box Callback not being called
- Star rating for custom post types [closed]
- How to Make a Custom Grid View
- Get image URL from media library in input
- Way to hook into a sidebar call to replace it with a custom sidebar
- Tag link suggestion plugin
- Collaborative post submission [closed]
- how do i remove posts from a WP_Query so the pagination is right?
- If post has custom field then display css-class
- The problem with WordPress Importer
- Plugin custom post type – Internal server Error
- Is it possible to create Custom Post plug-in?
- Display post lists in 2nd paragraph
- How to make a proper custom post type link
- WordPress display breadcrumbs using Yoast plugin [closed]
- Preg Match All doesn’t Allow echo first character for WordPress Taxonomy Tags
- Excerpts on category page
- External RSS feed to WordPress Portfolio
- Mq translate plugin custom post type issue
- Would Gutenberg be considered a PlugIn?
- pagination on data fetched using SQL query
- What is the best way for showing a grid of customer logos?
- How do I publish portfolio items with a future date?
- How to use template_include hook with form submission?
- $pages = get_pages(‘child_of=’.$post->ID); Why arguments are concatenated?
- Flickering sidebar when scrolling page [closed]
- Where Should i write the code for wordpress ajax voting?
- Post status doesn’t update to ‘future’ every time?
- Modify Posts from Custom_Post_Type within the plugin
- Grab ID from post from plugin and use it to create an object
- WP::is_main_query() Not Working
- Change website directory safely to add a static page on startup
- How can I list custom post type categories of portfolio
- Get data from wp_posts of mysql in to variables of wordpress-php script
- WordPress “Add new tag” button is not working
- “After file loaded” action
- Problem with ajax plugin for refreshing posts
- Add posts from other WordPress blog to the current one
- Link Posts to External URL
- How do I allow users to supply a photo/image to be used instead of the grey/white silhouette?
- How to create repeater field manually, without plugin (ACF Pro)?
- how to create hierachial taxonomy and manage under single post type?
- Check if theme supports sidebar
- Custom Post Type same name as Category
- Can i stream data to a custom_post_type?
- WP Forms not displaying,becomming an fatal error
- Undefined index: custom_post_template_present
- $wpdb->insert not working inside save_post tag
- automatically set random featured image by category in wordpress on post
- Pagination (including title of each page) in a post for a long posts
- Include post_date in search
- Add Filter to get_next_posts_link
- Trending Tags based on post views
- Array to string conversion error when trying to POST multidimensional array
- WordPress custom posttype meta values doesnot save
- Assigning a custom post type to a custom page
- making a glossary with wordpress
- Create custom fields on a post
- Retrieve post thumbnails
- get_option include in my adsense
- How can I default a new post to being saved?
- Change the behaviour of archive cpt category and single cpt by plugin, not by theme
- A plugin for software reviews site like this one?
- Snippet displaying LearnDash parent course title with lesson title [closed]
- Display Custom Post Type and Custom Taxonomy Data on Front End Using Only a Plugin
- Links not opening as they should. Custom WP plugin