WooCommerce - show only parent category title
This project was successfully completed by artiboria for zł75 PLN in a day.Get free quotes for a project like this
Project Budgetzł30 - zł90 PLN
Completed In1 day
I have a very simple job.
This script displays in my shop categories to which the product belongs.:
global $post, $product;
$cat_count = sizeof( get_the_terms( $post->ID, 'product_cat' ) ); ?>
<div class="cat_title"><?php echo $product->get_categories( ', ', '<span class="posted_in">' . _n( '', '', $cat_count, 'woocommerce' ) . ' ', '</span>' );?></div>
I want to list the name ONLY parent category, without sub-categories.
Currently, the script displays a parent category and its subcategories. Must display only parent category.
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online