Function get_template_part()
load file only from theme directory (or child theme).
There is no filter or action hook that would change this behavior.
You will need to write your own get_template_part()
variant to load files from the plugin directory (replace the locate_template()
call from the original function). Or write an explicit:
$query->the_post();
include plugin_dir_path( __FILE__ ) . 'single-products.php';
Related Posts:
- Where to put my code: plugin or functions.php?
- How to add custom content template part for a custom post type on main query using a plugin
- Make custom post type display as a page
- Form action/link to render a plugin in WordPress front-end
- Modify a plugin function output from another plugin
- Content in WP Editor displayed below CPT shortcode [duplicate]
- How to display the post using a shortcode in WordPress?
- How to seperate posts by categories?
- Custom meta box in editor of custom post type not working
- Shortcode error
- How to separate posts by categories?
- Post URL redirecting to homepage
- How to Insert Elementor Elements with CSS and JS into a Custom Post Type Using wp_insert_post()? [closed]
- get_template_part and template file names
- How to display Custom Post Type Post based on Tag with Shortcode Parameter?
- Hook to override title, image and content
- Insert Multiple Post with Same Publish Button
- Why is conditionally loading a custom plugin’s code only on a specific custom post type causing the site content to disappear?
- Remove single page for custom post type
- How to create shortcode to display custom field value on a custom post type
- Single Template that can be applied only via URL
- How to enable shortcodes in a custom post type?
- get_object_taxonomies() returns empty array for custom post type
- Get custom fields from a custom post type with a shortcode
- Shortcode for display posts in wp-editor
- Display Recently Added Custom Post Types with Custom Taxonomy Shortcode
- How do I display tags for a custom post type single page?
- WordPress theme custom capabilities not works
- custom post type not showing in menu
- Custom posts don’t work
- No posts found – Custom Post Type show_ui
- Get template part using a custom taxonomy term
- How to customize a permalink (URL) structure?
- Adding a custom post type taxonomy template in plugin
- Plugin: register custom post types, child ready and performance best practices
- How to add a custom taxonomy to show up in a custom post type menu?
- Get custom post type list for every category shortcode
- Give a permalink to Custom Post Types without title
- Custom post type not displaying content from single-{custom post type} page
- custom post type parsed as attachment
- Getting template_include to work when allow_url_include is off?
- WordPress post_where & posts_join not working only for custom post type
- Add custom ID to CPT posts only create not update
- Add custom post type as submenu [closed]
- WordPress multiple custom post types capability conflict in a single menu
- Getting meta in editor plugin, and event triggering issue
- Orderby CPT custom fields not working
- Single template showing all posts of that type
- Unable to get Custom Plugin Options data
- Making a Template for a CPT created by a plugin
- Update post meta not working in transition_post_status
- Use custom metabox to update automatically a post after a given date
- Addition of custom option panel crashes Media Library & Admin Area
- Using advanced custom fields from one custom post type in another custom post type / using nested shortcodes
- Programmatically rewriting slug through functions.php but returns 404
- How to render a custom post type template with custom fields using shortcode
- Custom Permalink to remove category word , keeping posts permalink with date?
- What is the best practice for displaying my plugin content in themes?
- custom post type category count shortcode
- Custom post type archive page blank
- Add Custom Post type menu to another menu in specific location
- Set a CPT slug as a base name for all the taxonomies
- Display Child Pages of Custom Post Type Parent Page
- How to use TinyMCE Editor for one of my custom post meta field?
- Shortcode to display Staff post type based on Location post type and Specialty post type
- How to Create a WordPress Plugin With Custom Post Type/Custom Field Features?
- How to display single post from custom post type loop?
- Setup template_redirect using has_term when NO term assigned
- Custom post listing page layout of custom post type
- How to Get WordPress custom post data in WooCommerce product meta panel? [closed]
- wp_reset_postdata() and wp_reset_query() inside shortcode are not working to reset original page query
- Shortcode for CPT post content in a page
- A custom post type in another post type
- Adding a metabox on a CPT’s submenu page
- Next Post links not working in custom post type shortcode
- Deleting taxonomy terms and relationships on a custom post_type when a user is deleted
- Foreach inside shortcode not working as planned
- Plugin fatal error
- custom comments form for custom post type
- Wrap meta boxes & data handling for specific post types in classes?
- Not Able To Render Single-CustomPostType.php File
- Problems wp_insert_post and save_posts filter
- Custom fields for custom post type
- Redirect to another page using contact form 7? [closed]
- Suggestion on custom post type/ taxonomy relationship
- Single page not working for custom post type
- Can a shortcode included in post content add styles to the ?
- How to retrieve category of a post in have_post loop?
- single-{post_type}.php not working
- Get term name without a foreach loop
- Cant get paginations on single.php to work with my custom post types
- Including all post id’s of a custom post type into an array
- Tag page only display 10 posts
- wordpress remove views from action links in a custom post
- When should I create custom post types?
- Custom post type’s extra fields – how to handle?
- Save Multiple Metabox values
- Checking if looped item has a parent inside a shortcode
- Send a conditional email notification when a custom field value changes in Post Type
- WordPress custom post type capabilities issue