You should create a filter to the archive_template
template hook.
function use_custom_template($tpl){
if ( is_post_type_archive ( 'books' ) ) {
$tpl = plugin_dir_path( __FILE__ ) . '/tpl/dir/books-archive.php';
}
return $tpl;
}
add_filter( 'archive_template', 'use_custom_template' ) ;
Related Posts:
- Overriding Plugin Template Files with Child Theme
- How do I cleanly override a plugin’s CSS with a child theme?
- Function to activate WordPress theme inside a plugin
- How do you auto-activate plugins from child themes
- How to load all plugins CSS after child theme CSS?
- Override the core function locate_template
- How to override my plugin’s php classes with duplicates that are in my child theme folder
- Uncaught Error: Call to undefined function get_user_by() after moving function from theme to plugin
- unzip a folder on specific location and delete the zip file
- Override plugin text domain in child theme
- How to edit Image layout in single product page in woocommerce on wordpress?
- Reusable functions and tools (Framework)
- Loading child theme script after plugins scripts
- Override Javascript in a Plugin?
- Why does my functions.php cause white-screen and media-library issues?
- How to overwrite core/libraries/vendor template with child theme
- Buddypress – Add the post_id in the bp_activity_add function
- Removing an action from wp_footer called in a class that’s inside a bigger class
- How to show only next post pagination link using wp_link_pages()
- Installing plugins and using complex folder structure with child theme in WordPress
- Co-Authors Plugin Displaying Wrong Author
- Overriding Parent Theme… will cause plugins failure?
- How to over-ride a file in a plugin? [closed]
- archive_template override when no posts exist
- Child Themes and Updating Parent Theme
- Managing wordpress Themes & plugins for multisite
- Set up functions to be overridden without using function_exists() by short-circuiting them?
- How to customize this theme? [closed]
- Programmatically install and activate child-theme
- Next Previous Post in wordpress with previous / next link with title?
- Trying to use shortcode for a plugin on custom homepage of Responsive theme
- Per theme plugins?
- How to overwrite the category template in a plugin
- How to override any plugin file in the child theme
- how to create a custom page in child theme or plugin?
- Hide custom field value
- I have updated my plugins, though one page of the site has ‘hit a critical error’
- Theme that includes a “core” plugin but the files in theme and child folder ignored
- Genesis Child Theme – Customize body
- Override plugin images so that they are not removed when the plugin is updated
- Plugin function in child theme
- Crazy redirect happening with no redirects set up
- PageNavi redirects to 404 when used as archive page
- Google trying to index child theme files
- How can I write code in a plugin for my child theme that will allow me to use remove_action() based on if the current page is the home page?
- Cron job emails blank
- function of parent not working in childtheme
- What Are the Advantages of Using an mu-plugin
- How to tell if a script is being executed from a plugin, a theme or a child theme in WordPress?
- How to Change MU/BuddyPress Group Blog New Installation Defaults [closed]
- Loading Canvas & WooCommerce translation file in child theme
- How do I activate my child theme, as I do not see it in developer tools
- Duplicating wordpress install issue
- Can’t modify plugin function
- Scripts don’t enqueue after removing plugin
- Issue with customizer and widget page
- ACF prugin for WooCommerce Shop Page
- Any plugin installation and update overwrite current theme
- WordPress child theme widget customization – Eduma
- WordPress Apply filter in plugin causes 500 internal error
- Updating options into the wp database performance
- Meta query for comparing two dates
- What are the performance hiccups when building plugins?
- Can’t activate Plugin: unexpected T_STRING, expecting T_FUNCTION [closed]
- How can I modify admin bar only if my plugin is loaded
- Using wordpress translations strings in plugin
- How to get menu location in wp_update_nav_menu hook
- Are mu-plugins plugins still deployed via wordpress.org/plugins?
- Proper way to use plugin functions in functions.php
- How to make my blog available to other website using RSS feed?
- Slashes stripped in ACF
- How do I add some javascript validation to the admin interface form’s onsubmit?
- How do I publish portfolio items with a future date?
- Login problem after installing my written plugin [closed]
- Can WordPress Drop-ins be given their own directory?
- Can deactivating a plugin sometimes “reset” settings within that plugin?
- remove all submenus from plugin
- Can my hooked uninstall class function access a global var declared in main plugin file?
- How Can I Safely Remove WP-Super Cache without messing my site up? [closed]
- How to activate a plugin on the activation of a theme?
- Specific way to allow WordPress users to view their current password? And edit it?
- Add Shortcode tag in Widget/Sidebar
- Basic function call on init failing
- echo statement displayed on front end
- Is it possible to remove subscription box from Jetpack stats page? [closed]
- In Woocommerce theme need to add custom external link [closed]
- How to create a post with next buttons
- Problem with isset and $_POST
- multiple language website navigation menu suggestion
- WooCommerce product and terms count [closed]
- Error checking when future updates are automatic
- http_response_timeout filter not working
- Create custom template in plugin and display it into post template section?
- Woocommerce Change The Price Of A Product Once Woocommerce Has Retreived It From Database
- Allowed memory size exhausted problem
- Getting taxonomy images to display on single-post with their terms
- plugin generated 751 characters of unexpected output during activation
- Where to populate custom terms in custom taxonomy in plugin?
- Get all woocommerce comments/reviews
- How can i force wp-admin to use 2-column dashboard layout? [closed]