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:
- Should all plugins be encapsulated in a Class?
- In what order does WordPress load plugin files?
- How do I cleanly override a plugin’s CSS with a child theme?
- How can I bulk edit variations in woocommerce? [closed]
- Add a subitem to Woocommerce section
- Search and replace text across all posts
- Using rewrite rule to access a view of a plugin from home page
- How to make a list of companies’ information and display them to user, using custom post types and a custom taxonomy?
- Thumb rating for wordpress – top user
- How to Get Admin Settings for a widget when using the_widget() with custom widget
- resize only height using wp_get_image_editor
- Upload files programmatically to users
- How to crop image from center using wp_image_editor
- Deactivate plugin upon deactivation of another plugin
- Ajax with jQuery UI dialog not working
- Shortcode in AJAX popup
- Set attached to state
- Editing Theme to apply Co-Authors Plus
- Converting Attachment to Images?
- How can I see the error generated by plugin activation?
- How do you remove plugin edit option?
- Localiztion in javascript
- Why none of the plugins that have ajax doesn’t work in my website?
- wordpress reusable content blocks
- How to add a random image to a post from gallery and only show one?
- Is there a filter for get_post_custom()?
- Problem with wordpress version 3.8
- Where should I save an API key of my user when installing my plugin?
- How to make a customize role and view a specific plugins base on that role?
- Accessing post’s meta data based on user’s click of a post
- Stuck on image in an Advanced Custom Field loop
- With WordPress + Visual Composer, how to restrict a user to change some content in a page?
- Translating long texts with html formatting
- How do I run SQL queries on a WordPress web page? [closed]
- Remove strange code from wordpress footer [closed]
- Making Mathjax dynamic so it renders input without page refresh
- Removing an action from wp_footer called in a class that’s inside a bigger class
- Front-end only $_POST and $_POST requests handling in WordPress plugin
- WordPress plugin/theme or other wayout to create portable pages?
- How to create user that has permission to create new sites on WordPress with multisite option enabled?
- WordPress Widget – Saving multidimensional arrays into $instance
- date/time-picker and file upload (image) fields for custom fields (e.g. with more fields)
- Reference product SKU on WooCommerce confirmation page [closed]
- Jquery plugin not working on single pages
- Advanced Custom Fields – Get value in other plugin file [closed]
- How to get menu location in wp_update_nav_menu hook
- Progmatically adding menu links to the default (Top) or Footer menu
- WordPress Console Application (ability to excecute a custom function via crontab only)
- How to add table class for tables of TinyMCE advanced wordpress plugin? [closed]
- Huge number of 404 pages getting spawned
- Licensing options for WordPress Plugins
- Updating WordPress across multiple versions
- Why does my jQuery plugin show up as text in WordPress?
- I am Unable to access WP admin
- Embed PDF into wordpress
- Replace woocommerce | (pipe) separator in product variation to , or another character?
- how would I include some html in the header section of a wordpress plugin? I get an error
- Why are my constants not available outside my class?
- Category “same post” retreive and display
- Adding custom Field To The Posts Listing
- WordPress does not allow me to upload a .xml file
- WordPress FLIR (Facelift Image Replacement) plugin clipping off end of text
- WP Subtitle Plugin Problem
- Switching Code plugins
- Add a new category for posts
- How to use a shortcode or an application to dynamically embed content from one WordPress site to another?
- How to save Setting pages data to the database?
- How to Remove all Traces of a WordPress Plugin?
- How to get brand children with woocommerce brands
- Create Woocommerce account password post-checkout on thank you page
- dokan edit functionality
- How do I insert a shape onto an image and then play an audio file upon mouse hover or mouse click on that shape in WordPress
- How to migrate Powerbuilder page data to another site?
- Automatic chage password of pages after some time
- Is it possible to customize a wordpress post from outside dashboard(Something like site.com/post-type/post/?e=post_id)?
- Bing/msn bots is heavily requesting random of my website
- WordPress Thickbox Navigation Issue in Gallery
- wp plugin adds “pagespeed.css” after each css file
- How to detect if i am on plugin’s settings page
- WordPress Media Uploader : How to add custom button on featured image tab
- Change pricing in Woocommerce based on Category and Product [closed]
- Featured Image id disappeared
- Re-writing MySQl query for execute faster
- Pull Data from DB for Admin Page Display as Relates to Admin Page Class by BA Internet
- WordPress Custom post type won’t save properly
- A simple script/plugin to display specific page upon hierarchy of selections
- Editing “Kahi’s Highlight Used Categories” plugin code – highlighting parent and child category in post page
- A plugin, which allows editing certain template regions [duplicate]
- Does a Google + RSS Plugin Exist?
- Making a Plugin work based on URL Location
- Showing author box on post detail page
- Can I install plugins manually on WP.com? [closed]
- PHP $_session is not work in wordpress
- Next and Previous Pagination button not displaying in WordPress
- Woo Commerce filter
- WordPress Customise
- I Need To Display A Specific Product (Called By Meta Field) On It’s Current WooCommerce Category Page
- Warning: Undefined variable $admin
- plugin translation *.mo file not getting loaded for custom post
- Getting error when accessing Customizer Page