I created a WooCommerce product template and the content renders however it is being jammed between a bunch of default woocommerce layouts. to try and find the template file it's using I removed the call to the sidebar in all of my templates, however their is still a sidebar rendered on the template. I can't find anything that would be causing the template to become nested inside of part of a general woocommerce page. I'm sure its a theme conflict, however it's a custom theme from a few years ago, I've cleaned out my functions file nothing seams to trigger this issue that I can see.
lien caché
flywheel
caffinated-support
I found that if I add add_theme_support( 'woocommerce' ); to my after_setup_theme function that it cleans up most of the issues, except that it still renders my sidebar that is not called in ANY of the theme template files? for some reason it's pulling in my <?php dynamic_sidebar( 'sidebar' ); ?> if I register my sidebar with a different ID than sidebar then it does NOT get pulled into my toolset content template. Is this a conflict with toolset pulling in a sidebar of id sidebar automatically somehow?
it still renders my sidebar that is not called in ANY of the theme template files? for some reason it's pulling in my <?php dynamic_sidebar( 'sidebar' ); ?> if I register my sidebar with a different ID than sidebar then it does NOT get pulled into my toolset content template. Is this a conflict with toolset pulling in a sidebar of id sidebar automatically somehow?
I'm not aware that Toolset pulls in a sidebar automatically here, usually it just hooks into the_content() and replaces that content with the template. It could have something to do with how this custom theme registers sidebars and then suppresses them in specific areas. If you add a custom function like this does the sidebar disappear in single Product pages?
function tssupp_disable_woo_commerce_sidebar() {
remove_action( 'woocommerce_sidebar', 'woocommerce_get_sidebar', 10);
}
add_action('init', 'tssupp_disable_woo_commerce_sidebar');
Well I was able to remove it by changing the ID from "sidebar" to just something else. My theme just manually calls the sidebar where needed using the below call, and I had completely removed all calls to it, so maybe it is WooCommerce defaulting to the first sidebar registered in your theme or something? ohh well no worries. It might make sense however to update the toolset documentation that if you don't add add_theme_support( 'woocommerce' ); to your site the content templates may NOT work. You don't need to add_theme_support to get woocommerce to work out of the box so I think it's an important note. I don't know what it's doing differently once that theme support is added but my theme is a pretty standard modification of the underscores theme and the toolset template was not rendering in place of the_content() of ANY template in my theme.
<?php if ( is_active_sidebar( 'sidebar' ) ) : ?>
<?php dynamic_sidebar( 'sidebar' ); ?>
<?php endif; ?>
You don't need to add_theme_support to get woocommerce to work out of the box so I think it's an important note.
Not required for basic functionality out-of-the-box, but required for WC template overrides per their documentation:
"If you are using custom WooCommerce template overrides in your theme you need to declare WooCommerce support using the add_theme_support function. WooCommerce template overrides are only enabled on themes that declare WooCommerce support. If you do not declare WooCommerce support in your theme, WooCommerce will assume the theme is not designed for WooCommerce compatibility and will use shortcode-based unsupported theme rendering to display the shop."
https://docs.woocommerce.com/document/woocommerce-theme-developer-handbook/#section-5
Since a Content Template override of the standard WC template is involved, I can understand why theme support for WC is required for Toolset's template functionality. There's not much information about integrating with custom themes here on Toolset.com, and forum support is fairly limited as well. I can mention it to my documentation team and see if it makes sense to add a note about integrating with a custom theme using this function to add theme support. I found a couple of other tickets here in the forum related to this, so you're not the only person who has run into this issue. I think it might make sense to add to this document, unless you have a different location in mind?
https://toolset.com/documentation/programmer-reference/theme-support-for-content-templates/
my only thought was that you might want to then link to it from here https://toolset.com/course-chapter/installing-toolset-and-choosing-a-theme-for-woocommerce-sites/ or mention it where it says this:
Toolset plugins work with any theme. Using one of our recommended themes gives you additional options.
That maybe it should have a note saying that "Toolset plugins work with any theme that has registered theme_support for woocommerce" and link to the programmer-reference.
side note..... can you guys add the https://toolset.com/documentation/programmer-reference/ to the documentation menu? I didn't even know that existed. is there a link to it from anywhere?
can you guys add the https://toolset.com/documentation/programmer-reference/ to the documentation menu?
We have a direct link to this reference in the main Documentation page. If you click "Documentation" in the main menu, the Programmer Reference link has top visibility in the Programmer Information section:
https://toolset.com/documentation/#programmer-information
I'll submit your request to add information about add_theme_support for WooCommerce and to add the Programmer Reference link in the main menu. Thanks for the report!