try to use get_template_part(‘yourfile’) instead.
the get_template_part() goes from theme root path.
so if you have your template in woocommerce folder use:
if( has_term( 'course', 'product_cat' ) ) {
get_template_part('woocommerce/single-product-course' );
} else {
wc_get_template_part( 'content', 'single-product' );
}
however probably should be better to make a folder that its not woocommerce, once woocoomerce folder will searched for woocommerce files, and if there is somewhere a file with that name with make conflict.
also, are you calling the single-product template from the same file, probably would be better to make a second file and paste the code there.
Related Posts:
- Pass PHP variable to javascript
- Does the number of downloads displayed for a plug-in in the WordPress.org plug-in directory include automatic updates?
- Namespaces in WordPress – How do I initiate the main class?
- wordpress get meta value by meta key
- What areas to Unit test while building a plugin?
- Which method is best to enqueue scripts
- Function to activate WordPress theme inside a plugin
- What is the correct way to check if WP_Filesystem can write to a directory without aking for username / password?
- Is there a WordPress Plugin that allows voting “does this coupon work” on specific links like Retailmenot
- Errors while using ajax from external wordpress page
- Pass A Value From Outside To A Plugin Variable
- shortcode doesn’t work
- Built in admin ajax hooks?
- Dequeue / Deregister script and replace it with a new plugin
- Force plugin to fail activation
- Could someone please help me to add category id with in this query so this will return posts from a certain category?
- How to handle autoloading with composer by keeping the WordPress naming conventions?
- Hide Theme options and Customize Admin menu
- Current user in plugin returns NULL
- What are the benefit in adding hook in the init() hook?
- How can I implement a notification system in wordpress?
- Minimum PHP Required for WordPress
- building plugin and it is displaying above plugins page
- load_theme_textdomain path
- Dynamic CSS Vs Inline Issues in Code any Way around in a WordPress Themes?
- Building an email signup form. Where should the information be saved in the DB?
- plugin development: problem with functions
- Custom form action to handle data inside a plugin
- WP Post Template – Templates in own folder
- Create entire wordpress as a github repositery?
- Building plugin with changeable custom post type values…advice needed
- Plugin options page with live preview?
- How to update post’s content on post publish?
- Conditional attributes and logic per product category
- Why Is This Code Causing The Admin Bar to Disappear?
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- Ordering taxonomies by rank
- Can I create a table on my DB without creating a plugin?
- Submit Form data to another page via Ajax (WordPress Way)
- WordPress checkbox and Illegal string offset
- Is it fair to use MIT licensed code in WordPress plugins? [closed]
- How to add an element right after the article using jQuery?
- How to reset wordpress but not plugins and settings
- Include a php file from another plugin
- How do I make a secure API call from a shortcode when a button is clicked?
- Hook into the rendering of a WordPress Template
- Can the uniqueness of the plugin file/plugin slug and version number be trusted?
- How to create plugin/ page that reads from database
- Add a “View all” button on WooCommerce product archives pages
- How do I add an options page at the bottom of the list?
- Plugin not properly prepared for localization
- WordPress Active Plugins
- is it possible to hook every page style?
- Redirect logged in user to somepage on every page view?
- How to add filter for wordpress plugin?
- A question of etiquette when forking a plugin? [closed]
- how to request a script more than once in wordpress
- Adding a jQuery modal dialog to the admin area
- How to make a Product page without ordering and database
- wp_options not returning value for logged out users?
- Gutenberg default attributes are empty when accessing in edit
- i need to make custom cron_schedule with custom interval time as a parameter into a custom payment gateway plugin wordpress
- How to upload large media file in chunks, without any plugin?
- How to store a secret for a plugin inside public_html
- Cannot run script properly with my custom plugin
- Cookie value changes back to previous value after changing
- Hide all Admin Notices and move on a separate page
- How to use functions found inside pluggable.php with my plugin files
- Is it okay to make a plugin to the WordPress repo, but limit it’s actions to maximum N events?
- Highlight admin menu items that are parent of existing core items
- Adding shortcodes to multiple pages with function
- Getting all woocommerce products from REST API call in plugin
- AJAX update fails for public/non-admin users
- Get a list of Product Categories inside a loop
- WordPress Product Detail and catalog
- Can you develop themes and plugins while using the hosting services BlueHost? [closed]
- WordPress plugin changes not updating
- Google analytic issue in wordpress
- Create Database Tables on Plugin Activation hook
- What’s the preferred method of writing AJAX-enabled plugins?
- How to tell which Plugin is displaying?
- Change page according to fetched GET Parameters
- Shortcode registered from a plugin not recognized
- How to change a specific page to custom page?
- Get Core Functionality from Within a (Secondary) Plugin File
- wp_update_post call really slow when official Facebook plugin is installed
- Plugin keeps saying needs to be updated and it’s in a constant loop [closed]
- How use Dynamic hyperlink on each wordpress post?
- _e in wordpress +
- How to provide access to specific plugin to all the user roles except subscriber in wordpress
- Output pure JSON wordpress
- WordPress Code Access to Restricted Content without Registration
- Activate plugin button do nothing [closed]
- How can I make my plugin detect if a certain theme is active?
- Plugin Block at the backend of every page or post
- How to provide page_template path in custom plugin using WordPress
- WordPress custom block: Link saved in database not retrieved when editing post
- Accessing Correct Database to Create REST API Endpoint
- Detect if user is on the specific page in WordPress
- A multi-section WordPress store [closed]