Displaying an image on the category archive page
Each category page in WooCommerce looks the same, with of course the exception of the products in that category. This works great for a lot of merchants. However, some merchants like to differentiate their categories—maybe add a banner at the top of the category page to help users see at a glance what they're looking at, or some other customization.
By building on our knowledge of hooks from the preceding recipe, we can add an action onto an existing hook and display a category image.
Getting ready
You need at least one product and it needs to belong to a category. You should also have an image to represent that category.
How to do it…
In the following steps, we're going to start off with something really easy. WooCommerce allows you to upload an image for a category, but it doesn't display it anywhere by default. Once we get the image uploaded, then we can add some code to display it:
- From the WordPress admin, go to...