• Looking for a way to limit the post title character length. There are plenty of ways to do this site wide via adding PHP to the functions.php file, however I only want to do it on my Ele custom loops. Thoughts?

Viewing 1 replies (of 1 total)
  • Same spirit as @mjhay, I’m trying to find a way, but no results with ECS.

    I tried something like this in functions.php :

    
    <pre><code>add_filter( 'get_the_excerpt', function( $excerpt, $post ) {
        if ( has_excerpt( $post ) ) {
            $excerpt_length = apply_filters( 'excerpt_length', 25 );
            $excerpt_more   = apply_filters( 'excerpt_more', ' ' . '[&hellip;]' );
            $excerpt        = wp_trim_words( $excerpt, $excerpt_length, $excerpt_more );
        }
        return $excerpt;
    }, PHP_INT_MAX, 2 );
    
    </code></pre>

    It works with the standard ‘posts’ widget from Elementor, but not ECS loop.

    I wonder if this lines in ele-custom-skin/skins/skin-custom.php would help :

    
    // Add a custom skin for the POSTS widget
        add_action( 'elementor/widget/posts/skins_init', function( $widget ) {
           $widget->add_skin( new Skin_Posts_ECS( $widget ) );
        } );
    // Add a custom skin for the POST Archive widget
        add_action( 'elementor/widget/archive-posts/skins_init', function( $widget ) {
           $widget->add_skin( new Skin_Archive_ECS( $widget ) );
        } );
    • This reply was modified 3 years, 3 months ago by freuxdesbois.
Viewing 1 replies (of 1 total)
  • The topic ‘Post Title Character Limit’ is closed to new replies.