Thread Starter
yasko
(@yasko)
I find the codes. You can change 30 number !
function short_woocommerce_product_titles_chars( $title, $id ) {
if ( ( is_shop() || is_product_tag() || is_product_category() ) && get_post_type( $id ) === ‘product’ ) {
if ( strlen( $title ) >= 30) { // Kicks in if the product title is longer than 60 characters
return substr( $title, 0, 30 ) . ‘…’; // Shortens it to 10 characters and adds ellipsis at the end
} else {
return $title; // If the title isn’t longer than 60 characters, it will be returned in its full length without the ellipsis
}
} else {
return $title;
}
}
add_filter( ‘the_title’, ‘short_woocommerce_product_titles_chars’, 10, 2 );
// shorten product title
// code goes in functions.php for your child theme
add_filter('the_title', 'modify_title', 10);
function modify_title( $title ) {
if ( is_woocommerce() || is_product_category() ) {
if ( strlen( $title ) > 10 ) {
$title = substr($title, 0, 10).'...';
}
}
return $title;
}
-
This reply was modified 5 years, 5 months ago by
lorro.
Thread Starter
yasko
(@yasko)
Good job @lorro. Good works perfectly !
You are very helpful person. Really I want to be friends everytime. not important websites.
Thank you so much! I dont forget anytime like you helpful person !
Have a great day!