• Resolved d-_-baker

    (@d-_-baker)


    Disclaimer: I’m very new to wordpress so if I say anything stupid or incorrect please tell me!

    I’m developing my own wordpress ecommerce theme from scratch (well, almost…I started off with the HTML5reset theme). It utilises a sidebar on the shop page, containing the layered navigation widget. I wanted to add a “reset” button to the bottom of the sidebar to clear all the filters. Luckily someone has already written code for this: https://www.joetannorella.com/clearreset-woocommerce-layered-nav-filters/

    I followed the tutorial above and it works great…except for one thing. I might be doing this all wrong, but I have 5 layered nav widgets in the sidebar – one for each product category – and the reset button gets added to the bottom of EVERY WIDGET (understandably, since the file I added the button to is the widget-adding file).

    I want the reset button to appear just once, at the very bottom of the entire sidebar. But I can’t figure out where to put it so that happens. I tried pasting the hook for the reset button into the woocommerce global/sidebar.php file, mainly to make sure that file is reponsible for displaying the sidebar – for obvious reasons, the reset button appeared completely outside the <aside id="sidebar"> since I just pasted it in after get_sidebar('shop').
    I want it to be inserted right before the closing </aside> tag.

    I’m very new to wordpress theming, but I think what I need to do is find where the ‘shop’ sidebar is registered (?), then modify the code there. But I have no idea where to look! I’ve done a lot of googling and experimenting and still haven’t worked it out, so I think it’s time I asked for help. >_>

    p.s. I’m working with a copy of the woocommerce template directory in my theme folder.

    https://www.ads-software.com/plugins/woocommerce/

Viewing 1 replies (of 1 total)
  • Thread Starter d-_-baker

    (@d-_-baker)

    UPDATE: I figured it out! Silly me, I didn’t realise that the sidebar.php file in my theme folder is actually just used by woocommerce – I thought there must have been something separate. I was able to add the code for displaying the reset button to the bottom of sidebar.php, just before the closing </aside> tag. It works beautifully now.

Viewing 1 replies (of 1 total)
  • The topic ‘how do I edit the woocommerce sidebar code?’ is closed to new replies.