I have problem with wrapper, it doesn’t work in woocommerce product vendor.
Product vendor is plugin for woocommerce that adds new taxonomy named ‘Product Vendor’ (shop_vendor), and when I click on a Vendor (which should be taxonomy page) wrapper not working.
I have tried to add taxonomy-shop_vendor.php with woocmmerce_content(), but nothing.
You can check for yourself: http://bit.ly/1dgoytC
There are some products that have ‘by Vendor 1’, and then when you click on Vendor name, it takes you to vendor taxonomy.
By not working I mean, it’s not wrapping content.
I have removed pretty url’s.
When I go view source I see all is wrapped in div id=page, and when I do search in all files for that string there is no such template.
I have created file named: woocommerce.php with content:
It is a taxonomy, so I would see if the fix you tried works with a more general template (such as taxonomy.php).
The duplicate headers would suggest that you haven’t modified the Woocommerce templates by removing the get_header/get_footer calls. The other workaround people often use is creating blank header.php and footer.php files; this means that you can leave the default templates in tact.
I would guess that the priority of that include filter is higher than 99 (which is the point at which the wrapper kicks in). You could try setting a later priority for the wrapper (higher number): see the last line of lib/wrapper.php .
The problem with template_redirect is that it runs before the wrapper kicks in. So you’ll have to add an action with a higher numbered priority (or lower numbered priority and use exit()) in order to redirect before the plugin does.
There may be a simpler way if the plugin code has a filter.
I had a quick think and something like this could work:
function template_override_with_wrapper(){
$template = Your_Plugin_Class::load_product_archive_template(); // select your template
include Roots_Wrapping::wrap($template); // set up wrapper with template
exit();
}
add_action('template_redirect', 'template_override_with_wrapper', 9); // run before defaults
You will of course need to add conditionals inside the function or this will run on every page, but I’ll leave that up to you.
I am having a similar issue and hope someone can help. I have not had any issues editing the WooCommerce template files but I cannot figure out why my Product Vendor pages are missing all head/header content as well as the footer. It’s just a blank page… http://198.20.249.142/~sennco/vendor/best-buy/
The product vendors plugin calls the archive-product.php Woo template. I copied those templates and then removed the multiple header instances, etc. Then I noticed the blank product vendors page… It’s only outputting the content, no head, header, footer , etc. I am confused since all the other Woo templates are displaying fine and outputting the correct files…
What am I missing? Any feedback is greatly appreciated!
Thanks for the feedback guys! I really appreciate it. @Foxaii - your php snippet causes a fatal error / blank page… I really wish I understood more about the Roots Wrapping function.
It’s meant to allow woocommerce to load the template it chooses, the template invokes the wrapper and the wrapper returns back;
woo calls template -> template calls wrapper -> wrapper includes template.