how do I edit the woocommerce sidebar code?
-
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 afterget_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.
- The topic ‘how do I edit the woocommerce sidebar code?’ is closed to new replies.