Rajeeb Banstola

Rajeeb Banstola


Startups Enthusiast. Loves to code (PHP, JS). Occasional Blogger, wannabe Entrepreneur & Amateur Philosopher

March 2017
S M T W T F S
« Jan    
 1234
567891011
12131415161718
19202122232425
262728293031  

Categories


Display WooCommerce Categories with Thumbnail Without Shortcode

RajeebTheGreatRajeebTheGreat

Last night when I was working on new WooCommerce Compatible WordPress theme, I had to build a widget which shows category image with name and description. Though I was familiar to WordPress, WooCommerce wasn’t something I explored. Since I’d never used WooCommerce before, I used little time to figure out how to make things work with WordPress.

I looked around internet and finally came up with piece of code which does the job. It was a simple as passing an extra argument to get_categories function provided by WordPress.

On line no: 3, we are asking the get_categories function to look for taxonomy called ‘product_cat’ registered by WooCommerce plugin and the rest is similar to get_categories function.

On line no: 15, We are fetching thumbnail of WooCommerce Product Category using get_woocommerce_term_meta

Startups Enthusiast. Loves to code (PHP, JS). Occasional Blogger, wannabe Entrepreneur & Amateur Philosopher

Comments 0
There are currently no comments.