- This topic has 7 replies, 5 voices, and was last updated 5 years, 11 months ago by
Leo.
-
AuthorPosts
-
February 28, 2017 at 5:29 am #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?
February 28, 2017 at 9:15 am #285109Tom
Lead DeveloperLead DeveloperI’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 ); }March 2, 2017 at 6:38 am #286093Seppo 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.
March 2, 2017 at 11:01 am #286234Tom
Lead DeveloperLead DeveloperHopefully they decide to. I suggested they use the same method I did in WPSP, so we’ll see.
May 18, 2020 at 7:59 am #1290330wilson
where I paste that code, I have the same problem
May 18, 2020 at 8:03 am #1290336David
StaffCustomer SupportHi there,
if it is still required – this explains the methods for adding the PHP code:
May 18, 2020 at 8:53 am #1290411wilson
it doesn’t work for me
May 18, 2020 at 10:21 am #1290547Leo
StaffCustomer SupportLet’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-1290423Thanks!
-
AuthorPosts
- The topic ‘Excerpt length in Elementor’ is closed to new replies.