WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Incorrect sidebar on shop pages (9 posts)

  1. miocene22
    Member
    Posted 1 year ago #

    I am developing a refresh of my site on a new VPS plan and on of the main changes is switching from the dreaded wp e-commerce to WooCommerce.

    The URL to the WooCommerce store page is http://95.142.166.209/shop/
    [I am accessing the site via the VPS IP address for now as my domain is being used for the live site]

    I am still in the process of styling and templates but I can't seem to figure out the sidebar. My WordPress theme has 2 sidebars defined in its functions.php: blog sidebar and shop sidebar. For some reason the only sidebar I can get to show on the store page is the blog sidebar which is only meant to show (surprisingly!) on the blog.

    I tried creating a template for the store and inserted the get_sidebar() function, referring to the ID of the shop sidebar in the process, but no joy.

    I am of the belief that WooCommerce should register its own sidebar when installed but there is no sign of this in the WP backend under appearance->widgets.

    I have trawled through the WooCommerce theme files but the only sidebar-related thing I can find is a php file containing get_sidebar('shop') which is obviously included by other theme files. There is no sign of a sidebar with ID 'shop' being registered anywhere.

    Any idea how I can get the correct sidebar showing on the shop pages? Thanks

    http://wordpress.org/extend/plugins/woocommerce/

  2. royho
    Member
    Posted 1 year ago #

    Hmmm, I am not aware WooCommerce registers any sidebars. This would seem like an issue with your theme. Have you contacted your theme developer?

  3. miocene22
    Member
    Posted 1 year ago #

    I am the theme developer. I have defined a second 'shop' sidebar in my functions.php and incorporated it a template file within my theme.
    I then have changed the store pages' template to this template but it still shows the 'blog' sidebar which is called in index.php.

  4. royho
    Member
    Posted 1 year ago #

    That's probably because WooCommerce doesn't use "pages" but instead uses custom post type.

  5. rhonz10
    Member
    Posted 1 year ago #

    @miocene22

    in my case, i created a "sidebar-shop.php" with the stuff calling my woocommerce widgets and a "sidebar.php", which is my default sidebar for the normal posts / pages.

    get_sidebar('shop') will call sidebar-shop.php file.

  6. miocene22
    Member
    Posted 1 year ago #

    @rhonz10
    Great, yeah that's pretty much what I've done. It seems that WooCommerce always uses index.php which has my normal sidebar in it. How do I tell index.php to call a different sidebar file like sidebar-shop.php when WooCommerce pages are showing?

  7. miocene22
    Member
    Posted 1 year ago #

    SOLVED! There is a handy function is_woocommerce() which returns true on a woocommerce page and false on a normal page.

  8. Seahawksean
    Member
    Posted 7 months ago #

    @miocene22 and @rhonz10,

    Could you please elaborate on how you fixed this issue?

    I have my single product page laid out the way I want to by altering a copy of the single-product.php in my theme folder. The only problem is that the sidebar is displaying the "search for:" search bar, pages, categories, and archives widgets, yet none of these widgets are currently placed in any of my theme's sidebars. I can't figure out what file these are being called from.

    http://www.biologydesign.com/SarahCHanson/product/accretion-1/

    I've unhooked the woocommerce sidebar and tried adding a hook for my theme's sidebar, tried calling the sidebar in the single-product.php file, everything. Everything works as it should, except this sidebar issue.

    If I could just get one of my theme's sidebars to display, I could work with that. I'm just not 100% sure how the two of you went about fixing this issue with adding "shop sidebars into your function.php file".

    And I completely agree that Woocommerce should include their own sidebar within the plugin. That was first thing I looked for after installing the plugin and was stunned that their wasn't one. I knew I was going to cause me more work.

    Thank you in advance for any assistance you can provide.

  9. Gabster1501
    Member
    Posted 5 months ago #

    Hey there. I have tried to follow but I cannot. Can someone explain to me how that might work with my theme? I have unlimited sidebars and can assign any sidebar in the page setting and I can use a special page template to desicide where the sidebar should be. Of course now the Problem is, that the shop page always shows the default sidebar for the posts. By now all I did was creating a woocommerce.php in the theme folder and used get_sidebar('Shop'); Whats the next step?

    Thanks for any help!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags