Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1250831

    Hey guys,

    I’ve been looking for a solution to display product categories within Enfold Product Grids after the title and as usual I found a veritable solution here in the forum and made some adaptions:

    add_action( 'woocommerce_after_shop_loop_item_title', 'avia_add_product_cat', 5);
    
    function avia_add_product_cat()
    {
        global $product;
        $product_cats = wp_get_post_terms($product->id, 'product_cat');
        $count = count($product_cats);
    	echo "Lieferdatum:<br/>";
        foreach($product_cats as $key => $cat)
        {
    		
            echo $cat->name;
            if($key < ($count-1))
            {
                echo ', ';
            }
            else
            {
                echo '<br/>';
            }
        }
    }

    My question: Do you guys have a function as well to add only the Yoast SEO plugin’s primary product category instead of all categories? Or is there an easy fix to make the above function work like that?

    I know this request is not only Enfold-related but since I couldn’t find anything elsewhere, a solution would be much appreciated.

    Thx, Regards
    Michael

    #1251856

    Hey micscr,

    Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Victoria

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.