admin管理员组文章数量:1122846
I am customizing my product detail page. I put the code before the single product summary in content-single-product.php
As you can see here: Link to product page
But i want it like this:
Can some one tell me where i have to put the code to place it outside the woocommerce container?
Thanks,
Chiel
I am customizing my product detail page. I put the code before the single product summary in content-single-product.php
As you can see here: Link to product page
But i want it like this:
Can some one tell me where i have to put the code to place it outside the woocommerce container?
Thanks,
Chiel
Share Improve this question asked May 7, 2019 at 12:11 Chiel van der ZeeChiel van der Zee 111 bronze badge2 Answers
Reset to default 0You can try adding php in index.php file in your theme folder after get_header()
is called.Your php block will come after header and before woo commerce content.
The function responsible for opening WooCommerce content wrapper is attached to woocommerce_before_main_content
action hook with priority 10.
You can wrap your code into function and attach it to that hook with priority less than 10.
add_action( 'woocommerce_before_main_content', 'se337291_before_content_wrapper');
function se337291_before_content_wrapper()
{
// display something only on single product page
if ( ! is_product() )
return;
//
// your code here...
//
}
Another option is to copy the single-product.php
file to the theme directory and modify it. Here you will find information on how to overwrite templates.
本文标签: How to output php between header and woocommerce container
版权声明:本文标题:How to output php between header and woocommerce container 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736295429a1929568.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论