Cant display sidebar on new custom taxonomy archive page

Hi,

I have created new taxonomies to add to woocommerce products but I can not make sidebars show on the new taxonomies archive pages.

See http://woo.simplecsr.com/deals_status/active/

I have created a new template file called taxonomy-deals_status.php
which is installed in my child theme.

Can you please advise why no sidebars show?

Notes:

1. this template file simply includes the archive template :

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
wc_get_template( 'archive-product.php' );

2. The main product category files do include the sidebar. See
http://woo.simplecsr.com/product-category/hosting/

Many thanks
Chris

  • chris

    Hi Tyler,

    I have just tested switching to the 2012 theme and it does show the sidebar on that theme.

    I am using a child version of the DIVI theme.

    The new template has the following:

    <?php
    /**
     * The Template for displaying products in a product category. Simply includes the archive template.
     *
     * Override this template by copying it to yourtheme/woocommerce/taxonomy-product_cat.php
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     1.6.4
     */
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    wc_get_template( 'archive-product.php' );

    This is a straight copy from taxonomy-product_cat.php which runs the default product category archives - See http://woo.simplecsr.com/product-category/hosting/

    The archive template archive-product.php contains the following code:

    <?php
    /**
     * The Template for displaying product archives, including the main shop page which is a post type archive.
     *
     * Override this template by copying it to yourtheme/woocommerce/archive-product.php
     *
     * @author 		WooThemes
     * @package 	WooCommerce/Templates
     * @version     2.0.0
     */
    
    if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    get_header( 'shop' ); ?>
    
    	<?php
    		/**
    		 * woocommerce_before_main_content hook
    		 *
    		 * @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
    		 * @hooked woocommerce_breadcrumb - 20
    		 */
    		do_action( 'woocommerce_before_main_content' );
    	?>
    
    		<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
    
    			<h1 class="page-title"><?php woocommerce_page_title(); ?></h1>
    
    		<?php endif; ?>
    
    		<?php do_action( 'woocommerce_archive_description' ); ?>
    
    		<?php if ( have_posts() ) : ?>
    
    			<?php
    				/**
    				 * woocommerce_before_shop_loop hook
    				 *
    				 * @hooked woocommerce_result_count - 20
    				 * @hooked woocommerce_catalog_ordering - 30
    				 */
    				do_action( 'woocommerce_before_shop_loop' );
    			?>
    
    			<?php woocommerce_product_loop_start(); ?>
    
    				<?php woocommerce_product_subcategories(); ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>
    
    					<?php wc_get_template_part( 'content', 'product' ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			<?php woocommerce_product_loop_end(); ?>
    
    			<?php
    				/**
    				 * woocommerce_after_shop_loop hook
    				 *
    				 * @hooked woocommerce_pagination - 10
    				 */
    				do_action( 'woocommerce_after_shop_loop' );
    			?>
    
    		<?php elseif ( ! woocommerce_product_subcategories( array( 'before' => woocommerce_product_loop_start( false ), 'after' => woocommerce_product_loop_end( false ) ) ) ) : ?>
    
    			<?php wc_get_template( 'loop/no-products-found.php' ); ?>
    
    		<?php endif; ?>
    
    	<?php
    		/**
    		 * woocommerce_after_main_content hook
    		 *
    		 * @hooked woocommerce_output_content_wrapper_end - 10 (outputs closing divs for the content)
    		 */
    		do_action( 'woocommerce_after_main_content' );
    	?>
    
    	<?php
    		/**
    		 * woocommerce_sidebar hook
    		 *
    		 * @hooked woocommerce_get_sidebar - 10
    		 */
    		do_action( 'woocommerce_sidebar' );
    	?>
    
    <?php get_footer( 'shop' ); ?>
    do_action( 'woocommerce_after_main_content' );
    >

    Support access is open on that site so please use it if it helps. The site is set up for bug fixing issues with woocommerce and various WPMUDEV plugins as and when needed.

    Many thanks
    Chris

  • chris

    Additional Notes: (this might help to find the issue)

    I have just seen that DIVI contains an option in the theme ePanel dashboard as follows:

    "Shop Page & Category Page Layout for WooCommerce"

    This allows choosing of the left sidebar, right sidebar or fullwidth. I have this set to Right Sidebar.

    I suspect somewhere this is preventing the sidebar on new taxonomies from displaying.

    Thanks
    Chris

  • Tyler Postle

    Hey Chris,

    Thanks for posting that! Divi is a very complex theme, so it may take a bit further digging to get this one sorted. Do you mind providing FTP and WP access so I can access your theme and install it in my sandbox to play around with it a bit? :slight_smile:

    That way I can make sure my suggestion actually works before posting it.

    You can send that in privately through our contact form:
    https://premium.wpmudev.org/contact/

    Send in:

    Subject: "Attn: Tyler Postle"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me :slight_smile:

    https://premium.wpmudev.org/contact/

    Look forward to hearing back!

    All the best,
    Tyler

    PS. I'm heading to bed soon, but I will be back on tomorrow morning :slight_smile:

  • chris

    Hi Tyler,

    I have sent details for the cloned site i set up which is now active.

    From looking at how the divi theme works here is a bit more info... (as far as I got today)

    Post archives use the DIVI index.php but woocommerce archives do not.

    I also tried page.php but they dont use this template. They appear to use the templates from woocommerce plugin but with some functions being altered to display theme versions of things like the woocommerce sidebar. This occurs in the parent divi theme functions.php

    When i install taxonomy-deals_status.php in my child theme it will use this file- but not display the sidebar. (i believe because functions.php is removing the woocommerce sidebar ad not replacing it for the new taxonomy... but i havent yet worked out how to get the new taxonomies to use the et_sidebar.

    Thanks
    chris

  • Ash

    Hello @chris

    First of all, you need to put the template file in /themes/Divi-Child/ folder, not in /themes/Divi-Child/woocommerce/ folder.

    Second, in archive-product.php file there was an error, I have fixed it.

    And third, I have implemented a fix in your child theme. Please take a look at http://woocommerce.simplecsr.com/deals_status/active/

    Hope it helps :slight_smile: Please feel free to ask more question if you have.

    Cheers
    Ash

  • chris

    Hi Ash,

    Many thanks that is looking great.

    I need to replicate this fix on another site. I can see the changes made to the original archive-product.php code.

    You mentioned:

    And third, I have implemented a fix in your child theme. Please take a look at http://woocommerce.simplecsr.com/deals_status/active/

    Can you please let me know what this change is so I can replicate on the other site.

    Many thanks for figuring this out.

    Best wishes
    Chris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.