• Hi,

    I’ve designed my custom loop but the some of my products have too long name, so I need to shorten them in the shop. I can do this with custom function.php but it won’t work on the loop I have created. When using any other skin (classic, cards…) it works. Can you help me on this? Below is a code I used, which is correct but it doesn’t work on custom skin. Can someone help me please!! I’m in a hurry with my project and would really like to use my own skin.

    add_filter( ‘the_title’, ‘shorten_woo_product_title’, 10, 2 );
    function shorten_woo_product_title( $title, $id ) {
    if ( ! is_singular( array( ‘product’ ) ) && get_post_type( $id ) === ‘product’ ) {
    return wp_trim_words( $title, 1, ‘…’ ); // change last number to the number of words you want
    } else {
    return $title;
    }
    }

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Product title limit not working with custom skin’ is closed to new replies.