Assuming that the taxonomy you want to check is product_cat and the term for which you want change template is special and finally assuming that the file you want to use for this special category is named special-single-product.php and resides in the root of your theme, the code you have to use is:
add_filter('template_include', 'special_single_product');
function special_single_product( $template ) {
if ( is_singular('product') ) {
if ( has_term( 'special', 'product_cat', get_queried_object() ) ) {
return get_stylesheet_directory() . '/special-single-product.php';
}
}
return $template;
}
Related Posts:
- Stop a plugin in the activation process when a certain WP version is not met then show error message in admin_notices action hook
- How to Add a Third Level Sub Menu to the WordPress Admin Menu
- How to Add an Index to Plugin Database table
- Override WordPress user with Oauth2 account
- Is it a good idea to edit an already existing plugin to add more functionality?
- Custom Filter in WordPress to modify footer information via plugin?
- Is it heavyweight plugins or lots of plugins that make a site slow?
- How to make media upload private? [duplicate]
- How to trace the cause of these PHP notices and warnings for class-wp-query.php?
- Admin plugin, how can I output a different content-type?
- Modify featured image URL at runtime
- Editor access to plugin settings
- Custom Widget outputs the input but doesn’t save anything inside the textarea
- Woocommerce: Changing the variations select default value? [closed]
- Why load_textdomain work but not load_plugin_textdomain?
- Get uploaded image url
- Akismet plugin is deleting spam despite preferences
- Star rating for custom post types [closed]
- How WordPress knows where to find locale files?
- How to add custom JS to tinymce in wordpress
- Collaborative post submission [closed]
- Reuse javascripts from plugins within the theme
- $wpdb working with ajax but showing ajax error instead of success
- plugins_url function mixes system path and URL
- Inserting large amounts of data into a custom table during plugin install
- WP-Markdown treating java generics like HTML tags
- Need help restoring my WordPress blog
- Loading child theme script after plugins scripts
- White page on custom plugin option submit
- Remove ALL css for a specific plugin page
- Is WP feature image function cropping images? WP Content Slideshow
- “Request has expired” with “Make your site social” (Gigya) plugin
- WordPress display breadcrumbs using Yoast plugin [closed]
- How to change this WP_Query to get all ProductIDs and not only specific one?
- how to use in custom single.php template using php?
- Automatically Assign Author to Category [closed]
- Howto check version of another plugin and then add a submenu page to it
- Excluding private/protected posts via IP
- WordPress “Categories to tags converter” not working. Pointing to import.php instead
- Some one is trying to hack my website, Need guidance [closed]
- WordPress premium theme development [duplicate]
- Mass SQL WordPress Meta Key deletion
- Gathering and logging data from a plugin: how to do it without race conditions?
- How to pass the API key to the client from the database? [closed]
- Elementor: How to override global theme style settings? [closed]
- How do I make a secure API call from a shortcode when a button is clicked?
- Modify page title and subtitle with a plugin
- Ambrosite Next/Previous Post Link Plus or WP next_post_link to cycle through top level category
- How to add options to the plugin page?
- Odd /wp-admin/admin-ajax.php entries showing in Wassup
- Plugin has added weird data in wp_options, set to autoload
- Setting Email locale before retrieving gettext translations
- how to execute some code after a post is published in WordPress [duplicate]
- Plugin to reformat the post automatically after submitting
- Submit plugin for review
- I can’t change permalink in WordPress 4.5.3
- Designing a plugin that uses an iFrame to process data in admin
- Add a “default sorting” menu to child store pages
- How to hook into action/filter call
- How to automatically activate users after registration without activation email?
- Pass PHP variable to javascript
- I want to add member to account in ultimate membership pro
- Using Remove Action Hook in Plugin
- Make downloadable ebook read online without download option
- WordPress rewrite rule depend on meta values not ids
- JS working when used normally but not in wordpress
- Do i need to use a plugin for third party api integration?
- WordPress – WPBakery – Near Footer jump issue
- Dequeue Table of Content font
- Offering a freemium plugin (a free version + paid version)
- Display Woocommerce attribute name above product title
- In woocommerce, is there any way to empty wordpress default mini cart when order placed?
- Remove special characters from filenames
- In woocommerce, is it possible to make payment of one customer order by another customer?
- My WordPress admin Lost All admin option, roles & privileges?
- Tracking sales/conversions in Woocommerce using Google Analytics
- How to make a website with two types of logins , Sellers and buyers?
- Rogue splash page keeps popping up
- Making a Custom Post Type Plugin – keep getting the white screen of death
- $POST variable is empty in receiving php add-on function but can be seen by jscript function
- Hook into install email
- Autoloading a PHP class – working outside, but not inside WordPress plugin
- Linking Plugin Files to WP
- How to maintain WordPress permalink structure with custom content with URL parameters?
- Is there a way to include some external script to some or all pages in a wordpress site?
- Plugin activated but plugin files nowhere to be found
- Any plugins that upload, resize, and display images? [closed]
- How to load css files in a specific order
- Wysija Newsletters: Redirect After Subcription
- Where to find remaining Boldgrid code in WP database?
- Notifications on WordPress Website [closed]
- My page content doesn’t show up
- Creating a Freemium plugin in the WordPress Repository
- Change from blogger to wordpress
- How to get URL param for pagination in shortcode?
- How to add an active state class to my info box
- Using ACF to allow user to add and edit multiple saved forms
- Difficult case to solve – Select + select = result(related data)
- How to disable display all posts from all categories?
- Custom Login and Password Reset for BuddyPress Website