Making Shop base page, category pages, single product pages all different
-
I’m trying to make the shop page different from the category pages and the single product pages. I’ve gone ahead and made 3 different templates (single-product.php, archive-product.php, shop-product.php) for each and put them in my theme folder. The single product pages and category pages are laid out just the way I want them after I edited the corresponding templates. However, no matter what I do to the Shop page template (even delete all the code) it has no affect on how the shop page displays. I even tried assigning different templates of my theme (Customizr) to the Shop page in Dashboard > Pages.
In addition, I want each of these pages to have their own sidebar. So I created 3 sidebar files (sidebar-product.php, sidebar-archive.php, sidebar-shop.php), registered 3 sidebars in my function.php file with the following code:
/* Woocommerce Sidebars */ /* Single Product page sidebar */ register_sidebar( array( 'name' => __( 'Single Product Pages Sidebar', 'customizr' ), 'id' => 'product-widgets', 'description' => __( 'Appears on the single product pages.', 'customizr' ), 'before_widget' => '<div id="%1$s" class="widget %2$s shop-widgets">', 'after_widget' => '</div>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>', ) ); /* Product Category/Archive/Tag page sidebar */ register_sidebar( array( 'name' => __( 'Category/Archive/Tags Pages Sidebar', 'customizr' ), 'id' => 'archive-widgets', 'description' => __( 'Appears on the category/archive/shop/tags pages.', 'customizr' ), 'before_widget' => '<div id="%1$s" class="widget %2$s shop-widgets">', 'after_widget' => '</div>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>', ) ); /* Product Shop page sidebar */ register_sidebar( array( 'name' => __( 'Shop Page Sidebar', 'customizr' ), 'id' => 'shop-widgets', 'description' => __( 'Appears on the category/archive/shop/tags pages.', 'customizr' ), 'before_widget' => '<div id="%1$s" class="widget %2$s shop-widgets">', 'after_widget' => '</div>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>', ) );
All three of these sidebars show up in Appearance > Widgets as they should. On the Single Product pages and the Category pages, the correct sidebar is used respectively, however on the Shop Page it is displaying the category page sidebar, and again the layout is not correct (ie: it is displaying the Category page layout).
This would indicate that the shop-product.php is not being called. But I’m not sure what file calls the templates. I’ve removed and added my own hooks as suggested by Woocommerce codex, and like I said the Category and Single Product page layout are correct. I guess one thing I don’t understand is how you can remove hooks from from just the archive-archive.php and NOT the shop-product.php when they use the same hooks and removing them via functions.php file would remove the hooks from all of them and not just the archive-product.php or the shop-product.php individually.
If anyone has information on this or can lead me in the right direction I would be greatly appreciative.
This is the link to my site. https://www.biologydesign.com/SarahCHanson which may help you understand what I’m trying to explain.
Thank you in advance for your help.
- The topic ‘Making Shop base page, category pages, single product pages all different’ is closed to new replies.