This topic has 7 replies, 3 voices, and was last updated 8 years, 5 months ago ago by Rose Tyler
Hello, I want only certain number of display characters for product heading. Imported products from amazon for example have a very long title and changed the design, moved container is the result that I want to avoid, how do I do that? thank you
Hello,
Please provide us with link to the page and wp-admin access in Private Content to check this issue more deeply.
Regards,
Robert Hall
Hello,
Also, you can try to add something like the following code in your child theme functions.php file.
add_filter( 'the_title', 'shorten_my_title', 10, 2 );
function shorten_my_title( $title, $id ) {
if ( is_shop() && get_post_type( $id ) === 'product' && strlen( $title ) > 50 ) {
return substr( $title, 0, 50 ) . '...'; // change 50 to the number of characters you want to show
} else {
return $title;
}
}
Regards,
Rose Tyler.
hey, thanks. Can you give me a code how I can show product container of a uniform size?
You’re welcome!
If you want to make equal size for all the product images, either upload images with the same sizes or enable Hard Crop in WooCommerce-> Settings-> Product -> Display and Regenerate thumbnails after that.
Regards,
Rose Tyler.
Ok thank you. Can i use the code for the product heading for breadcrumb heading too ?
No, this code does not work for all the headings and breadcrumbs. You need to change it depending on where exactly you want to make titles shorter. We just gave you the point into the right direction and now you can change the code according to your needs. If you need additional customization you can order our customization service https://www.8theme.com/customization-services/
Regards,
Rose Tyler.
You must be logged in to reply to this topic.Log in/Sign up