Archived topic
Category descripction woocomerce homepage
14 replies · Started by Escobar on October 4, 2020
Is there a way to limit by words or by characters the description of the woocommerce categories on the home page?
When setting showing a short description on the home page for articles is fine, but for categories it shows the full description and is sometimes too long.
website is: https://herramientasbazarot.com
Hi there,
you could limit the number of lines that are displayed in Category archive short descriptions with this CSS:
body:not(.single-product) .product-category .woocommerce-product-details__short-description {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
Unfortunately it seems that it does not work in the home page which is where I need it
Do you want it just applied to the H2 in the description?
If so try this:
body.home .product-category .woocommerce-product-details__short-description h2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
}
I have cleared the cache and inserted the css but nothing
Change this:
-webkit-line-clamp: 2; to -webkit-line-clamp: 1;
It will change the number of lines from 2 to 1.
Now it seems is working...but not in https://www.mivestuariolaboral.com. I dont know why?
Would there be some way to show only the text in h2? that would be enough
Try this CSS to remove all summary content aside from the H2:
body.home .product-category .woocommerce-product-details__short-description > *:not(h2) {
display: none;
}
You're great!!!
The only detail is that what is in h3 continues to appear, that is, if instead of h3 it is a normal paragraph it is hidden, otherwise not.
See here please: https://www.mivestuariolaboral.com
NO, I was wrong, what happens is that I have to circle the h3, h4 ... with <p style = "text-align...
If I do that with the rest of the text (h3. H4 ...) and shortcodes that I have inserted, it works perfectly.
Is that working correctly now ?
If I enclose the text or shortcode in the <p> tags it works perfectly.
You are great !!! Thank you very much.
Glad to hear that
Please, How can i do the same but in category and subcategories pages?
Try adding this CSS :
.archive .woocommerce-product-details__short-description {
display: none;
}