WooCommerce - show only parent category title
- Status Completed
- Budget zł30 - zł90 PLN
- Total Bids 15
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.Get free quotes for a project like this
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