Viewing 5 replies - 1 through 5 (of 5 total)
  • Your screenshot seems to show the category title underneath the category image already.

    To show the category description, try this code snippet:

    add_action( 'woocommerce_before_subcategory_title', 'show_cat_description', 20);
    function show_cat_description ($category) {
      $cat_id = $category->term_id;
      $prod_term = get_term($cat_id, 'product_cat');
      $description = $prod_term->description;
      echo '<div class="shop_cat_desc">'.$description.'</div>';
    }

    You will need to make a child theme and put the snippet in functions.php for the child theme.

    Thread Starter Bojan Denić

    (@evilmc)

    Hi lorro,

    your function work, but only show on subcategory, not on main category under large image.

    https://i.gyazo.com/9591bce1d1a43175b428cf609c4a16e8.png

    I want show show text on both under image, but on hover description and product title is one LINK.

    How to fix that?

    Thanx!

    On my site, I only have subcategory images. I don’t have a large image on the main category page. Is this a feature of your theme? What theme are you using?

    on hover description and product title is one LINK

    I’m not sure what you want to do. The image, description and title are all inside the link to the product. To change that markup, you would need to reorganise the markup using a combination of remove_action and add_action functions. Set the priority parameters to suit the order you want. This would be a development job requiring some testing with your theme, and probably outside the scope of a forum answer.

    lorro – based on the code you provided above…
    I now have the descriptions showing under my category images which is great – my next step is to figure out if i can get the description to only appear on hover. Any solutions ?

    …Looking further into my own requirement – i need the caption to be showing as part of the function that shows the category thumbnail. My intention is to hover over the thumbnail and have the caption appear.

    I can handle the css behind making the caption show but i need a function like the above to create the caption at the same point as the thumbnail.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show category description under category image’ is closed to new replies.