I read that it is possible to place alternative header into woocommerce pages using get_header('shop');
in product-archives.php template in my custom theme. In order to make it work I need to make copy of header.php file and rename it to header-shop.php. It should be also located in same folder as header.php file.
Unfortunately I can't get this to work.
Anything I am missing if somebody notices that would be great help.
product-archives.php文件中的Woocommerce(shop)标题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- dpwqicw157673 2015-10-26 05:56关注
You can have a work around.
- Just make a copy of header.php in your current theme with the same name (i.e. header.php).
- Create another copy of the header.php with you desired name(i.e. header-shop.php).
- Now you just need to add a custom code in header.php at the starting lines to check that whether its a product archive page(using this function http://codex.wordpress.org/Function_Reference/is_post_type_archive), if yes then include the header-shop.php else show the below default code of the file itself.
An Example Snippet:
if ( is_post_type_archive('product')) { // Load header-shop.php }else{ // continue with default code }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报