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
- How to modify submit button on GravityForms
- Create Custom Coupon Type
- Text Wrapping in WPDataTables
- how to show selected options drop down menu values in attributes field in after saving post.php
- fatal erro in one line if statment in wordpress plugin [Solved]
- Add different sizes packaging boxes to orders plugin
- Can’t use updated variables in handle function
- How can I make my plugin detect if a certain theme is active?
- How to get URL param for pagination in shortcode?
- edit slider plugin capability for custom_role
- Plugin Block at the backend of every page or post
- Make plugin admin page visible to other roles
- Buffered output in chunks and shortcode – how do I achieve that?
- Transfer wordpress comments form on another post [closed]
- Achieve the following layout
- Change email notification language based on the site language in WPForms
- Relationship field only loads items to administrator
- Is it possible to create post in wordpress using postman?
- How does one add numbers to an admin menu?
- Adding fontAwesome to Primary Menu returns after saving the menu
- I start to make custom plugin but for some reason is not working, i get no error. Can someone help me? Thanks
- Is there a membership plugin which offers the ability to hide content based on css rules?
- How to add an active state class to my info box
- Using ACF to allow user to add and edit multiple saved forms
- How Create LastMod and Update Date Only on Taxonomy Category and Tags
- How To Convert External Image URLs To Own Website’s Uploaded Images Automatically?
- Getting 400 Error in wordpress website
- How can i store cache of wordpress a database request without plugins?
- disabled plugin and now wordpress won’t load
- How to provide page_template path in custom plugin using WordPress
- WordPress User Registration/ Sign Up -> Able to take Paid Certification Courses & keep track of Completed Certificates
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- Block Root REST API Route using custom &/or iThemes
- How to set an exact search box in tablepress plug-in
- Private plugin updating – GitHub zip file changes the plugin directory (with release or branch name)
- WordPress custom block: Link saved in database not retrieved when editing post
- Accessing Correct Database to Create REST API Endpoint
- How do I replace a logo image that’s hard-coded into a plugin’s logo.php file?
- How to Order Posts by Taxonomy in Jetengine Plugin
- Detect if user is on the specific page in WordPress
- A multi-section WordPress store [closed]