Product heading woocommerce - by physio07

This topic has 7 replies, 3 voices, and was last updated 8 years, 5 months ago ago by Rose Tyler

  • Avatar: physio07
    physio07
    Participant
    June 23, 2016 at 07:00

    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

    6 Answers
    Avatar: Robert Hall
    Robert Hall
    Support staff
    June 23, 2016 at 08:02

    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

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 23, 2016 at 09:02

    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.

    Avatar: physio07
    physio07
    Participant
    June 23, 2016 at 09:33

    hey, thanks. Can you give me a code how I can show product container of a uniform size?

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 23, 2016 at 09:56

    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.

    Avatar: physio07
    physio07
    Participant
    June 23, 2016 at 13:39

    Ok thank you. Can i use the code for the product heading for breadcrumb heading too ?

    Avatar: Rose Tyler
    Rose Tyler
    Support staff
    June 23, 2016 at 14:27

    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.

  • Viewing 7 results - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.