[Resolved] Excerpt length in Elementor

Home Forums Support [Resolved] Excerpt length in Elementor

Home Forums Support Excerpt length in Elementor

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #284990
    Seppo Puusa

    I bought GP Pro to work with Elementor. So far the theme is fantastic, but I ran into a problem when using Elementor. In GP, I set the excerpt length to 55 words, which is ok for the blog page. But I want to feature a few categories on the home page, which I can easily do with Elementor. The problem I’m running into is that the excerpt length set in GP takes precedence over the setting in Elementor. I’d like to reduce the excerpt length to 10 or 20 words on the home page, but the setting in Elementor has no effect.

    Any idea on how to get over this?

    #285109
    Tom
    Lead Developer
    Lead Developer

    I’ve actually spoken the Elementor devs about this.

    They’re using the excerpt_length filter, which is a global filter inside WordPress.

    Instead, they should be building their own excerpt function as I did in WP Show Posts.

    Right now, the GP excerpt length overwrites the Elementor length, as it should in my opinion. If it was the other way around, whatever length you have set in Elementor would apply to the GP blog, archives, categories etc..

    You can tell GP to take a back seat to Elementor like this:

    add_action( 'after_setup_theme','tu_change_excerpt_length' );
    function tu_change_excerpt_length() {
        remove_filter( 'excerpt_length', 'generate_excerpt_length', 999 );
        remove_filter( 'excerpt_length', 'generate_excerpt_length', 20 );
        add_filter( 'excerpt_length', 'generate_excerpt_length', 15 );
    }
    #286093
    Seppo Puusa

    Thanks for the reply. I’ll wait for the Elementor guys to provide a solution to this from their end. I agree that the settings in GP should take priority.

    #286234
    Tom
    Lead Developer
    Lead Developer

    Hopefully they decide to. I suggested they use the same method I did in WPSP, so we’ll see.

    #1290330
    wilson

    where I paste that code, I have the same problem

    #1290336
    David
    Staff
    Customer Support

    Hi there,

    if it is still required – this explains the methods for adding the PHP code:

    https://docs.generatepress.com/article/adding-php/

    #1290411
    wilson

    it doesn’t work for me

    #1290547
    Leo
    Staff
    Customer Support

    Let’s stick with the new topic you’ve opened as this one is super old:
    https://generatepress.com/forums/topic/i-am-having-trouble-with-extract-length-i-am-using-elementor/#post-1290423

    Thanks!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Excerpt length in Elementor’ is closed to new replies.