Tagged: woocommerce
hi there
i need some help on limiting the characters or length that shows on the product descriptions of the products on the Product Overview page
and the product grid if possible. as you can see on my page.. they have different length that shows the thumbnails in different sizes.
thank you
Hey fluidsuccess,
I checked the page and I think the description isn’t really the problem but some images needs to be adjusted, try to upload images with a width and height of atleast 300px.
Best regards,
Nikko
hi nikko
thanks for the reply. i think i can handle the images. what im asking is the text title/ description. i want to limit the text that shows there somehow and make them all uniform like say showing only 2 lines. see even if i have the same thumbnail images in one row..they still dont have the same height because some title/descriptions are longer. can you help?
Hi,
Try adding this code at the bottom of functions.php:
function short_product_titles_chars( $title, $id ) {
if ( ( is_shop() || is_product_tag() || is_product_category() ) && get_post_type( $id ) === 'product' ) {
if ( strlen( $title ) >= 75) {
return substr( $title, 0, 75 ) . '...';
} else {
return $title;
}
} else {
return $title;
}
}
add_filter( 'the_title', 'short_product_titles_chars', 10, 2 );
Just change 75 (limit to number of characters). Hope this helps.
Best regards,
Nikko
hey nikko
i think this did the trick! this is what im looking for.
thanks