Getting category context on category page

[ad_1]

I’ve got a function which checks if the page is a category, product, or page and displays different content.

The issue I’m having is, no matter where I reference the `global $post` variable I end up getting the context of the first product within that category. How can I ensure that on a category page, the code will have the context of that category rather than the top product?

TIA

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer