woocommerce category function with title attribute

Question

I would like to display woocommerce categeries on home page with title attribute, but my following attempt outputs no title and cat name

function my_product_categories() {
global $woo_options;
$params = apply_filters( 'my_homepage_product_categories_params', 'number="4"');
if (class_exists('woocommerce') == "true" ) {
    echo do_shortcode('[product_categories '. $params .']');
    woocommerce_reset_loop();
  }
}

it outputs

<li class="">
<a href=""><img src="" alt="" width="" height="" srcset="" sizes="" />
<h2 class="">
        Accessories <mark class="count">(3)</mark>
        </h2>
    </a></li>

I mean it displays cat name in h2 tag, what I want to make is how could I display cat name as title attribute in its link, exactly like this:

<a href="" title="Accessories"><img src="" alt="" ...

0
, user9637601 4 years 2020-03-10T16:51:40-05:00 0 Answers 109 views 0

Leave an answer

Browse
Browse