Woocommerce (shop) header in product-archives.php file

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.

Related posts

2 comments

  1. You can have a work around.

    1. Just make a copy of header.php in your current theme with the same name (i.e. header.php).
    2. Create another copy of the header.php with you desired name(i.e. header-shop.php).
    3. 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
    }
    
  2. Even you can load header-shop.php with the PHP function include_once()

        if ( is_post_type_archive('product')) {
         include_once 'header-shop.php'; 
        }
    

Comments are closed.