• i’m trying to limit the title lenght of my posts in the custom loops i made with Ele Custom Skin.

    I’ve tried using the following script that i found in a related thread here on StackExchange, but to no avail:

    function max_title_length( $title ) {
        $max = 20;
    
        if ( in_the_loop() && strlen( $title ) > $max ) {
            return substr( $title, 0, $max ) . ' …';  
        } else {
            return $title;
        }
    }
    add_filter( 'the_title', 'max_title_length' );

    What am i missing?

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

  • The topic ‘Limit post title lenght in loop’ is closed to new replies.