Woocommerce has it’s own function woocommerce_get_template_part()
for loading template parts, use it like this:
woocommerce_get_template_part( $slug, $name );
which refers to the according file {$slug}-{$name}.php
or used like this:
woocommerce_get_template_part( $slug );
refers to the file {$slug}.php
, it automatically
Looks in yourtheme/slug(-name).php and yourtheme/woocommerce/slug(-name).php
it can be used with a conditional like this:
if( has_term( 'shop', 'product_cat' ) ) {
woocommerce_get_template_part( 'single-product-shop' );
} else {
woocommerce_get_template_part( 'content', 'single-product' );
}
Related Posts:
- Building a custom REST API
- Restricting a Plugin to Only Load its CSS and JS on Selected Pages?
- What plugin can I use to create a list / slideshow of featured images?
- Beta Versioning of Plugins
- WooCommerce – how to display product category above product? [closed]
- WooCommerce – Show shipping cost on product page [closed]
- Why doesn’t the WordPress Importer update posts?
- Way to force media uploader use custom image size
- How to Add jQuery Infinite Scroll to My Custom Archive Page
- Change page title from plugin
- Override dynamic_sidebar() in plugin?
- A plugin for having rel=”nofollow” in posts?
- Template plugin for blog posts? [closed]
- Are contributed plugin translations automatically installed in WordPress?
- Why would WP-CLI and WP Admin show different list of plugins with updates?
- How do you install the automattic developer plugin under localhost for mamp when there is an error, deprecated?
- Translating plugin inside the theme [closed]
- Admin Dashboard with Custom Tab for Client
- reorder plugin menu position
- How can I serve a text file at a custom URL
- How to add custom link to menu in wordpress programmatically?
- How to send little data between admin pages of my plugin?
- How to activate plugins for my WordPress sites from a remote server
- Register script in one plugin, and enqueue it in another
- how to load the language file in plugin?
- Getting a List of Categories for Use in a Plugin?
- UnWanted Custom field added in the wp page edit area
- WordPress download manager plugin showing attached file is missing/deleted?
- How to get all of the activate_plugin action parameters?
- Display update notification messages like ‘What’s New’
- Gutenberg block can’t save richtext
- WP_Terms_List_Table Quick Edit not working
- Is there a directory my plugin can write files to that cannot be viewed via the browser/url?
- How to exclude certain files from the plugin editor?
- file-gallery plugin line 1573 broken in 4.2 upgrade [closed]
- How do I use wp_editor() in widget form?
- How to create an option page for this simple plugin
- Errors when trying to use a plugin to write to the database
- _prime_post_caches in wordpress
- Can some vulnerabilities in plugins be exploited even when the plugin is inactive?
- Plugin settings won’t save changes
- WPTouch – how to remove shortcodes or make shortcodes function
- Adding class to last list item? Not WP generated
- Trying to add a page template for my custom post type from a plugin, but it will not display in the template dropdown unless file is in theme
- Custom shortcode for displaying user based on a role parameter
- How to execute plugin and theme updates from a web hook / endpoint?
- WordPress Plugin Insert Html Code with Shortcode
- How to remove index meta tag
- WordPress gtag.js with User ID tracking
- trigger email when post is published by someone a user follows
- WP Rest API and json_decode()
- Disable submit button order
- Install old version of plugin from admin panel?
- insert an html tag using php plugin
- Can we give Pending as a Role to wp_insert_user?
- Rename Smart YouTube’s httpv back to http for all posts
- Custom page from wp admin area
- Create category for each user
- Avada Live is broken on WP
- How page with random php file with query params generated
- location lock wordpress website
- New Plugin Info request
- Membership and search criteria
- WooCommerce Product Table – filter query on attributes
- Why does plugin_url append absolute file path?
- Disable WC Bookings automatic order completion [closed]
- PDF Viewer Origin is Different
- WordPress Sumo Plugin not showing all images on clicking pinterest icon
- Insert Google Maps HTML in WordPress
- WP nonce verification
- Call to undefined function add_action() in plugin
- How to make my wordpress site Multi-region
- Created wordpress using quick install on Hostgator but unable to access the URLS
- How to Display image from Menu Image in Walker Dropdown Select Menu
- How to add separator between default and custom panels in WordPress customizer?
- Having trouble going from Jfiddle to implementing in WordPress :(
- Buddypress Member list not showing admin and mods
- Shortcode in a blog post, footer and related products stop working
- SVN problem – commit taking forever to fix incomplete prior commit
- Editing a built plugin: How to activate it only on a single post page
- pluggable function in theme, to be overridden by plugin
- Restrict my pages from public
- Migrating site from stage to production server without particular dev. plugins?
- Using “excerpt_more” filter for a specific post type
- w3 total cache and post__not_in
- Plugin programming: Uploading a file to a specific folder
- Conditional statements using category and Tags
- Shrinktheweb plugin problem
- Issue with custom plugin
- How do i use postMash to order posts in a custom loop?
- How to link that “logged in” in “you must be logged in to post a comment” with custom login page on WordPress?
- Get value of a key from a Plugin Serialized array
- Get post id in Post Page within Wp-admin
- Simple WordPress function / plugin to redirect a site
- How to insert current “login” page to certain page?
- Infinite scroll for text in post with url page change
- How to host a WordPress plugin on my own server and provide updates?
- claim a permalink and all sublinks in plugin
- Play an animated character video on click of a button or radio button selection only
- Vanilla javascript in custom gutenberg block not working