Well, I handle this issue by adding some code above get_template_part() function in theme as:
//Theme
/* If any filter set */
if(has_filter('ppr_one_search_item_view'){
$themePartSlug = apply_filters('ppr_one_search_item_view');
}
else{
$themePartSlug = 'templates/search/place';
}
get_template_part($themePartSlug);
in my plugin:
/* Plugin Code */
function get_template_part_place(){
// Template file from plugin Directory
load_template(PPR1_PLUGIN_PATH.'templates/search_places.php');
}
add_filter( 'ppr_one_search_item_view', 'get_template_part_place');
/* plugin Code End*/
may this will help you
Related Posts:
- Passing variables through locate_template
- How to use get_template_part()?
- Is there a variable for a template parts name?
- How to make get_template_part always check child theme first?
- Check if partial file is called from within header.php or footer.php
- Too many get_template_parts?
- get_template_part() does not work if you call it when you are in a subfolder
- Pass a variable to get_template_part
- get_template_part inside get_template_part?
- Getting the chosen template when iterating through pages
- Possible to use pagename inside get_template_part?
- Why would include(locate_template) work but not get_template_part()?
- How does get_template_part() work inside a loop?
- Is there a tirck in the get_xxxx function in the general_template.php file?
- Problem with using get_template_part() in footer
- how to remove get_template_part from a plugin? [closed]
- get_template_part() based on get_post_type() for a custom post type instead of get_post_format()
- Using get_template_part to retrieve a template file based on current post type
- add a hook with get_template_part()
- ä/ü/… are not displayed when including via get_template_part()
- How to limit the number of Related Posts?
- get_template_part – how to find html file which is being render
- Get_Template_Part And Two Global WP_Query On Frontpage
- The use of get_template_part() returns ‘invalid argument’ loading options
- Passing a variable from the archive page to the default template
- For which reasons can get_template_part’s $args fail to work? (WP 5.8.1 – PHP 7.4.23)
- Can I set a global base path for get_template_part?
- how to use a different template (index.php) in wordpress
- What are the benefits of using get_template_part()?
- Include template file from plugin to theme
- get_template_part doesn’t output all data
- Passing a variable to get_template_part
- Is there any way to use get_template_part() with folders?
- get_template_part vs action hooks in themes
- When is get_template_part() preferable to simply using the template.php files?
- How to add custom content template part for a custom post type on main query using a plugin
- Combining shortcode and get_template_part
- passing argument to get_template_part() or a better way to code
- get_template_part execute with ajax
- Get template part based on custom taxonomy term
- WP_Query on custom post type not displaying, multiple loops & get_template_part
- TwentyTen: Overloading template.php files vs. get_template_part
- Accessing $post variable from template part
- Template tags vs get_template_part() vs functions.php
- How to move style from template file to section?
- get_template_part in admin
- ACF Relationship + WP Template Parts
- Does get_template_part pull data once in a loop?
- Checking whether template part is loaded in a page
- Filter get_template_part() $args array
- Template part inside shortcode, unexpected reult
- get_template_part for each level of taxonomy term
- Unexpected results with conditionals inside template part
- What is the best way to organize template parts?
- Get template part using a custom taxonomy term
- Get_template_part inside a folder
- Conditional get template part
- Don’t see add_filter result in the site front page
- Showing the WordPress standard text area on a Woocommerce Single Product Page?
- Overriding of the template for the Attachment “thumbnails” in the Media Grid isn’t working
- Styles and scripts inside template part
- Modify foreach loop for social sharing links?
- get_template_part based upon post’s category
- Modal working only on home page
- Loading template parts conditionally in Customizer
- How do I display an image before the first post of the loop when I’m using get_template_part?
- Tag page only display 10 posts
- Remove portion of header code from home page only
- Use a separate template for the home page only
- How do I get standard posts to open up in their own template when using get_template_part()?
- get_template_directory_uri() not working
- How to reuse get_template_part() containing a simple loop to work with AJAX correctly?
- How to use template inside plugin shortcode with variables for big HTML code
- Both the require and add_template_part function are not including the file
- Displaying a custom post type using get_template_part into a specific layout
- get_template_directory() returns wrong address on VPS
- Get template part with CPT and Custom Taxonomy conditionals
- How can have a conditional template tag based on the main loop within a secondary loop with new WP_Query(), using get_template_part()
- Use of IF statement in Header file
- Organize template parts and page templates in folders in regards of template hierarchy
- Custom fields in post later used in loop
- Exclude function from homepage only?
- How to get all template files used for rendering a single post/page?
- how to replace h1 entry title with h2 in category pages only
- Contain multiple page templates in one PHP custom template file in WordPress?
- Adding a second loop breaks everything
- do_action doesn’t trigger if it’s in a template that gets loaded via REST endpoint
- Shortcode and get_template_part
- How can I show contents of a template part inside of another page?
- Call get_template_part() custom permalink
- Use another theme template in my theme
- When using shortcode, content stops generating after the_content
- Using require_once for parent-directory not working but is working in sub-directories
- How to unregister sidebar for template_part?
- Is it possible to call a template file inside wysiwyg editor? And how?
- Re-using single CPT code with get_template_part?
- get_template_part() to render single page Theme
- strange parse error when including a loop template within another template
- Print post data inside loop using theme content template
- First post outside of loop, homepage only?