Hi there,
I’ve used the code found here: https://kriesi.at/support/topic/display-product-category-under-title/#post-182523
to display woocommerce product category under title. Is there a way to display it over the title = between the product image and product title?
Best regards
Carsten
Hey mariajoensen,
Would you mind providing a precise link to your site, showing the elements in question? We need to be able to inspect them in order to help :)
Best regards,
Andy
HI Andy,
The site is not open yet. I’ve sent you login credentials in the Private Content. It is the shop page: http://www.dropsbysamira.com/shop/
Regards
Carsten
Hi,
Please replace the code with the following:
add_action( 'woocommerce_before_shop_loop_item_title', 'avia_add_product_cat', 20);
function avia_add_product_cat()
{
global $product;
$product_cats = wp_get_post_terms($product->id, 'product_cat');
$count = count($product_cats);
foreach($product_cats as $key => $cat)
{
echo $cat->name;
if($key < ($count-1))
{
echo ', ';
}
else
{
echo '
';
}
}
}
We used the “woocommerce_before_shop_loop_item_title” instead of the “woocommerce_after_shop_loop_item_title” action hook.
Best regards,
Ismael
That worked.
Thanx Ismael!