I am working on a WooCommerce WordPress site. I have added WooCommerce search feature for product. But both main shop page and search result page have same template archive-product.php. But I want separate design for both pages. How can I do that?
Leave a Reply
You must be logged in to post a comment.
As @arun said in the comments copy the archive-product.php and paste in the to the woocommerce folder inside your theme (if you don’t have this folder, create one)
Open the file and split the content inside that file using a php if statement
Just make sure this line of code always stays at the top of the file:
Based on @Capital Themes answer – you can inverse the function and add code for the non search form categories:
you must use file product-searchform.php in woocommerce/templates directore.
and customize search page by loop files in woocomerce/templates/global directore
And then with the is_search() method you can find out if you are in searching page or not.