Home › Forums › WoodMart support forum › Maximum n.of caracter for short description in the product grid
Maximum n.of caracter for short description in the product grid
- This topic has 9 replies, 2 voices, and was last updated 1 year ago by
Aizaz Imtiaz Awan.
-
AuthorPosts
-
February 14, 2024 at 9:12 pm #540146
supergapParticipantHi,
i would like to limit the number of characters of the short description in the grid view. When you go over the product you see the short description. At the moment is cut off. I don’t know the criteria (number of characters) I would like please to set a number of characters and that at the end of the trunked text can be shown two point like-> final word..
How to get it?
Many thanks.February 15, 2024 at 4:10 pm #540445
Aizaz Imtiaz AwanKeymasterHello,
Please add this code to the Theme Settings > Custom CSS > Global:
.wd-more-desc { max-height:100px !important; }
Best Regards.
February 15, 2024 at 10:08 pm #540567
supergapParticipantHi,
thanks for replying.
Perhaps I explain wrong. I was able to set a max-weight (I’m not a magician of CSS, but I can add it). This way just cut the last line, and more or less it seems an error define div height.
I was please asking for a way of limit characters and at the end set by default 2 more characters (..)
example:
If the text is:
“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip”Limit it to a character number limit like:
“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqu.. (two points at the end).I have seen it in a lot of sites, usually in blog posts.
Many Thanks and best regardsFebruary 15, 2024 at 10:15 pm #540568
supergapParticipantHi,
thanks for replying.
Perhaps I explain wrong. I was able to set a max-weight (I’m not a magician of CSS, but I can add it). This way just cut the last line, and more or less it seems an error define div height.
I was please asking for a way of limit characters and at the end set by default 2 more characters (..).
It seems there’s already a character number limit since the the number of characters in the product grid item is less than the entire short description. The text is Character limited already.
example:
If the text is:
“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip”Limit it to a character number limit like:
“Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqu.. (two points at the end).I have seen it in a lot of sites, usually in blog posts.
Many Thanks and best regardslooking around somebody suggest a solution similar to this:
Of course I’m not expert in code to dare using it with out asking my theme support:add_filter(‘woocommerce_short_description’, ‘limit_woocommerce_short_description’, 10, 1);
function limit_woocommerce_short_description($post_excerpt){
if (!is_product()) {
$post_excerpt = substr($post_excerpt, 0, 20);
}
return $post_excerpt;
}February 15, 2024 at 10:27 pm #540571
supergapParticipantor this:
add_filter(‘woocommerce_short_description’, ‘reigel_woocommerce_short_description’, 10, 1);
function reigel_woocommerce_short_description($post_excerpt){
if (!is_product()) {
$post_excerpt = substr($post_excerpt, 0, 10);
}
return $post_excerpt;
}thanks again
February 16, 2024 at 2:10 pm #540705
Aizaz Imtiaz AwanKeymasterHello,
Please add this code to the Theme Settings > Custom CSS > Global:
.wd-product.wd-hover-base .hover-content { display: -webkit-box; -webkit-line-clamp: 3; /* Number of lines to show */ -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
Best Regards.
February 16, 2024 at 3:13 pm #540753
supergapParticipantHi,
thanks for replying
It works fine with 3 line. If I change it with 2 is also Ok. With for it stop working.Pasting in to the CSS field I get some parts in red. Is it ok?
Thnaks agiando.
Attachments:
You must be logged in to view attached files.February 16, 2024 at 4:07 pm #540782
Aizaz Imtiaz AwanKeymasterHello,
Yes, it is ok.
Best Regards.
February 16, 2024 at 5:37 pm #540826
supergapParticipantoK, thanks.
about setting 4 lines..
at the momenti seems it doesn’t work if I set 4.
many thanksFebruary 17, 2024 at 10:44 am #540904
Aizaz Imtiaz AwanKeymasterHello,
Can you please share the WP admin login details of your site so I will check and give you a possible solution?
Best Regards.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register