• I created a sidebar ‘Shop’ in my child’s functions.php. It is displaying on the backend (Appearance > Widgets) but it is not displaying on the frontend (anything I put in there does not display). I’ve even tried putting the widget in another sidebar location but no display as well.

    functions.php (child theme):
    register_sidebar( array(
    ‘id’ => ‘shop-sidebar’,
    ‘name’ => esc_html__( ‘Shop’, ‘obsidian-child’ ),
    ‘description’ => esc_html__( ‘Sidebars to display on the Shop pages’, ‘obsidian-child’ ),
    ‘before_widget’ => ‘<div id=”%1$s” class=”sbar”>’,
    ‘after_widget’ => ‘</div>’,
    ‘before_title’ => ‘<h2 class=”widget-title”>’,
    ‘after_title’ => ‘</h2>’,
    ) );

    WooCommerce archive-product.php (child theme):
    <div class=”shopl”>

    <?php if ( is_active_sidebar( ‘shop-sidebar’ ) ) : ?>
    <?php dynamic_sidebar( ‘shop-sidebar’ ); ?>
    <?php endif; ?>
    …..
    </div>

    Any idea why it won’t display on the frontend?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • try this in the template instead

    
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('shop-sidebar') ) : ?>
    <?php endif; ?>
    
    
    Thread Starter toad78

    (@toad78)

    Thanks, HudsonValleyWebDesign, but the result is the same: nothing.

    I even created a new sidebar and posted a widget in it to display on the Shop page and it won’t display (even added the code to the ‘archive-product.php’ template).

    Thread Starter toad78

    (@toad78)

    If it matters, I’ve posted my ‘archive-product.php’ template code:

    <?php
    /**
     * The Template for displaying product archives, including the main shop page which is a post type archive
     *
     * This template can be overridden by copying it to yourtheme/woocommerce/archive-product.php.
     *
     * HOWEVER, on occasion WooCommerce will need to update template files and you
     * (the theme developer) will need to copy the new files to your theme to
     * maintain compatibility. We try to do this as little as possible, but it does
     * happen. When this occurs the version of the template file will be bumped and
     * the readme will list any important changes.
     *
     * @see 	    https://docs.woocommerce.com/document/template-structure/
     * @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
    		 * @hooked WC_Structured_Data::generate_website_data() - 30
    		 */
    		do_action( 'woocommerce_before_main_content' );
    	?>
        <header class="woocommerce-products-header">
    
    		<?php if ( apply_filters( 'woocommerce_show_page_title', true ) ) : ?>
    
    			<h1 class="woocommerce-products-header__title page-title"><?php woocommerce_page_title(); ?></h1>
    
    		<?php endif; ?>
    
    		<?php
    			/**
    			 * woocommerce_archive_description hook.
    			 *
    			 * @hooked woocommerce_taxonomy_archive_description - 10
    			 * @hooked woocommerce_product_archive_description - 10
    			 */
    			do_action( 'woocommerce_archive_description' );
    		?>
    
        </header>
        
    		<?php if ( have_posts() ) : ?>
    		<div class="shopl">
    		
    			<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('shop-sidebar') ) : ?>
    			<?php endif; ?>
                
                	<?php
    				/**
    				 * woocommerce_before_shop_loop hook.
    				 *
    				 * @hooked wc_print_notices - 10
    				 * @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
    						/**
    						 * woocommerce_shop_loop hook.
    						 *
    						 * @hooked WC_Structured_Data::generate_product_data() - 10
    						 */
    						do_action( 'woocommerce_shop_loop' );
    					?>
    
    					<?php wc_get_template_part( 'content', 'product' ); ?>
    
    				<?php endwhile; // end of the loop. ?>
    
    			<?php woocommerce_product_loop_end(); ?>
    
    </div>
    			<?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
    				/**
    				 * woocommerce_no_products_found hook.
    				 *
    				 * @hooked wc_no_products_found - 10
    				 */
    				do_action( 'woocommerce_no_products_found' );
    			?>
    
    		<?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' ); ?>
    Thread Starter toad78

    (@toad78)

    Come to find out, the plugin ‘Widget Options’ was conflicting with it. I had to find a replacement plugin that would work.

    Glad you found a solution –

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘No Sidebar Widget Displaying’ is closed to new replies.