Closed vgstef closed 2 years ago
I am having a similar issue with the excerpt length on one of my sites... the excerpts lengths does not match with the number that I put into elementor on some of my posts:
Same thing happening to me. Sometimes the first post in Posts widget ingores the excerpt lenght setting and displays the whole excerpt.
It is happening when i add more than one Posts widget and it seems to be dependent on a location of the widget. For example: If the bug is happening on the second Posts widget, i move the second Posts widget above the first Posts widget and the bug switches to the other Posts widget.
+1 Same here Live view (bottom of page) => https://airportspickup.com/
Same problem for me, when don't have any content in excerpt field it's working fine but it's not working when have content in excerpt field.
I have the same issue
Having the same problem
Man I thought I was going nuts...it's not just me.
I'm also having the same problem. It seems the Posts Widget excerpt limit works when the manual excerpt hasn't been entered on the post. This is frustrating as all of my posts have manually excerpts.
Expected functionality The Posts Widget excerpt limit to effect automatically generated excerpts AND a manually entered excerpts.
It seems this case may have been overlooked when developing the widget.
As there are many of us effected by this, can we get a response on when this issue may be addressed? Or a short-term workaround? I would not like to remove manual excerpts from hundreds of posts...
Same here, bit disappointing that nobody seems to fix this after all simple problem.
Hi everyone, I found this that solved the problem for me in the short term. https://smallenvelop.com/limit-post-excerpt-length-in-wordpress/ It seems that the problem only exists when a post has previously had an excerpt.. even if you delete it and save it... which means the code to update and override the excerpt is a once only opportunity. If you only have a few to deal with then go into the classic editor and add a read more tag... otherwise there are two other options for addressing it programmatically.
@MarketingGeek Thanks for the link. Which solution worked for you? I've tried adding a custom excerpt length to functions.php but it did not have an effect on the Post Widget's excerpt limit. I'm keen to hear which solution you implemented and how you got it working.
I have a related issue: Default excerpts are not showing when I use Posts widget in Elementor. If I make a custom excerpt, it will show. I'm a newbie to Wordpress/Elem, but I've make some other test sites that don't have this problem. Now that I'm finally building what I hope will be my actual site, I can't get default excerpts to display. Any ideas? Thx.
Still having this issue. With no workaround I have a dirty solution (css)
This cuts off the excerpt at 4 lines then re-positions the read more button (this can also be done with spacing in Elementor). Styles are then reset for mobile with a single column layout.
Not the most elegant solution but I can see no other workaround right now. Hoping for an update from Elementor.
Add this to your CSS:
.elementor-post__excerpt {
overflow:hidden;
height:105px;
min-height:80px !important;
margin-bottom: 70px !important;
}
.elementor-post__excerpt p:after {
content: ' ...';
}
.elementor-pagination {
margin-top: 30px;
}
@media only screen and (max-width: 768px) {
.elementor-post__excerpt {
overflow:auto;
height:auto;
min-height:150px !important;
margin-bottom: 25px !important;
}
}
I am having the exact same issue. It does not matter what excerpt length I specify - it shows the entire excerpt
Yes, same issue here, the excerpt length specifications does not have any effect.
Got the same issue and mine only works for the first post
I am also having the same problem. Disappointing from Elementor, which I have come to totally count on. what's up Ben?
Ditto. Love this plugin, but some of these "little" things are a bit aggravating.
Any update on the fix? It's really annoying...
I have gone to elementor support a number of times. But not on this issue. They have been very responsive on other issues. You might try that. Sent from BlueMail
On May 11, 2019, 6:30 PM, at 6:30 PM, GRSM notifications@github.com wrote:
Any update on the fix? It's really annoying...
-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/elementor/elementor/issues/5734#issuecomment-491545337
Same thing here. super annoying!
Ticket subject: Re: [elementor/elementor] Length of the excerpt not working in Post widget (elementor pro) (#5734)
Author: nick-panick Date: Tue, 05/14/19 1:34 pm Message: Same thing here. super annoying!
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/elementor/elementor/issues/5734#issuecomment-492239425
It even ignores WP Codex... Whatever length you define has no effect:
function custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
or
add_filter( 'excerpt_length', function($length) { return 20; } );
I'm beginning to think that this is not actually a defect. By definition the excerpt field is intended to provide the option of including custom content for the excerpt as opposed to simply displaying the first [N] characters of the actual post content. I'm guessing that based on that, the "logic" would then follow that it is the author's choice/responsibility to manually control the length of the excerpt.
If you want to control it automatically, don't use the excerpt field. If you want to use the custom excerpt field, don't use a lot of text. I think it may be as simple as that.
If that is indeed the case, then Elementor should provide a toggle for either the auto-truncated excerpt or the custom excerpt.
@rrodkin very interesting analyze, which would make sense. So WP filter would have no effect on excerpt length added into the excerpt field ? (therefore neither Elementor widget). I need to find out.
I agree. It's not working for me neither, at least not as I would expect it. The feature should work as expected, no matter the excerpt was inputted manually, or computed on post content. The excerpt is not here only for posts widget. It can be used as meta-description too. The current behavior appears as a bug because their is no intuitive way to understand how things works unless your read this issue. We could add a checkbox option. "Apply also on manual Excerpt" or similar.
Would be nice to get a proper answer on this matter @matipojo @bainternet @joshmarom so we can move foreward. TYIA
Got the same here...
Apparently it's not a priority. So I'd say if you're going to use the custom excerpt field, just keep it short, problem solved. ;)
Well, I used some CSS code to truncate the line and add ellipsis for the time being.
I added a custom CSS class to post widget, for instance .my-custom-posts
Then I added a custom CSS for it as follow
.my-custom-posts .elementor-post__excerpt p {
overflow: hidden;
position: relative;
line-height: 1.2em;
max-height: 3.6em;
text-align: justify;
margin-right: -1em;
padding-right: 1em;
}
.my-custom-posts .elementor-post__excerpt p::before {
content: '...';
position: absolute;
right: 0;
bottom: 0;
}
.my-custom-posts .elementor-post__excerpt p:after {
content: '';
position: absolute;
right: 0;
width: 1em;
height: 1em;
margin-top: 0.2em;
background: white;
}
Hope it helps
Well, I used some CSS code to truncate the line and add ellipsis for the time being.
I added a custom CSS class to post widget, for instance .my-custom-posts
Then I added a custom CSS for it as follow
.my-custom-posts .elementor-post__excerpt p { overflow: hidden; position: relative; line-height: 1.2em; max-height: 3.6em; text-align: justify; margin-right: -1em; padding-right: 1em; } .my-custom-posts .elementor-post__excerpt p::before { content: '...'; position: absolute; right: 0; bottom: 0; } .my-custom-posts .elementor-post__excerpt p:after { content: ''; position: absolute; right: 0; width: 1em; height: 1em; margin-top: 0.2em; background: white; }
Hope it helps
Hey! This is a nice trick!
I've adapted it for my situation and worked well.
Obrigado
I am 2.4.4
pro user.
my quick fix after take a look at the source code would be.
plugins/elementor-pro/modules/posts/skins/skin-base.php
line 859
change
<?php the_excerpt(); ?>
to
<?php echo wp_trim_words(get_the_excerpt(), $this->get_instance_value('excerpt_length'), '...'); ?>
somehow add_filter
does not make any effect. so, you should comment it out.
add_filter( 'excerpt_more', [ $this, 'filter_excerpt_more' ], 20 );
add_filter( 'excerpt_length', [ $this, 'filter_excerpt_length' ], 20 );
Same issue for me
I patch posts widget. if you like it please give a star. plugin link
it is in the basic category name Jaxer Posts
if you install it.
Fix excerpt length, add load more button. use ajax lazy load. add animation to posts boxes, cards.
Facing the same issue.
@matipojo @bainternet @joshmarom Please add a filter for that!
FWIW, I added the following to the Elementor Pro custom CSS (will convert to class) - this does the following:
Needs some work, but it at least gave me consistent height with 2 or more post widgets in the same row.
/ MOBILE / @media only screen and (min-device-width : 0px) and (max-device-width : 480px) { selector .raven-post { min-height:600px; max-height:600px; }
selector .raven-post-excerpt { min-height:100px; max-height:100px; }
selector .raven-post-excerpt::after { content: ' ...' }
selector .raven-post-button { padding-top:100px; } }
/ DESKTOP / @media only screen and (min-device-width : 481px) and (max-device-width : 9999px) { selector .raven-post { min-height:450px; max-height:450px; }
selector .raven-post-excerpt { min-height:50px; max-height:50px; }
selector .raven-post-excerpt::after { content: ' ...' }
selector .raven-post-button { padding-top:65px; } }
I am
2.4.4
pro user. my quick fix after take a look at the source code would be.plugins/elementor-pro/modules/posts/skins/skin-base.php
line 859
change<?php the_excerpt(); ?>
to<?php echo wp_trim_words(get_the_excerpt(), $this->get_instance_value('excerpt_length'), '...'); ?>
somehow
add_filter
does not make any effect. so, you should comment it out.add_filter( 'excerpt_more', [ $this, 'filter_excerpt_more' ], 20 );
add_filter( 'excerpt_length', [ $this, 'filter_excerpt_length' ], 20 );
I am
2.4.4
pro user. my quick fix after take a look at the source code would be.plugins/elementor-pro/modules/posts/skins/skin-base.php
line 859
change<?php the_excerpt(); ?>
to<?php echo wp_trim_words(get_the_excerpt(), $this->get_instance_value('excerpt_length'), '...'); ?>
somehow
add_filter
does not make any effect. so, you should comment it out.add_filter( 'excerpt_more', [ $this, 'filter_excerpt_more' ], 20 );
add_filter( 'excerpt_length', [ $this, 'filter_excerpt_length' ], 20 );
@seksitha , hoho, you saved my time) There is easier solution
// functions.php // function custom_post_excerpt_length($post_excerpt, $post) { $length = 70; $excerpt = strlen($post_excerpt) > $length ? mb_substr($post_excerpt, 0, $length - 3, "utf-8") . "..." : $post_excerpt; return $excerpt; }
add_filter('get_the_excerpt', 'custom_post_excerpt_length', 20, 2); // end functions.php //
the_excerpt in your_root_folder\wp-includes\post-template.php apply_filters( 'the_excerpt', get_the_excerpt() ); and in same file the function get_the_excerpt ends with applying filter apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); Have a nice day
Hello, It's October 2019 now. Still no fix 1 year later? I just tried to use the new portfolio home page template. I can't get the blog posts to look the same, because the excerpt length is really long. Can we get a fix ASAP, please?
Perhaps an easier solution would be thru CSS - the following applies to Raven post widgets, so you'll need to tweak based on which widget you're using - this is actually preferable to an Elementor fix, as you have exact control over each part of a post widget:
/ MOBILE / @media only screen and (min-device-width : 0px) and (max-device-width : 480px) { selector .raven-post { min-height:600px; max-height:600px; }
selector .raven-post-excerpt { min-height:100px; max-height:100px; }
selector .raven-post-excerpt::after { content: ' ...' }
selector .raven-post-button { position:absolute; top:520px; left: 35%;
align:center; padding-top:15px; padding-bottom:15px; } }
/ DESKTOP / @media only screen and (min-device-width : 481px) and (max-device-width : 9999px) { selector .raven-post { min-height:450px; max-height:450px; }
selector .raven-post-excerpt { min-height:50px; max-height:50px; }
selector .raven-post-excerpt::after { content: ' ...' }
selector .raven-post-button { position:absolute; top:400px; left: 40%;
align:center; padding-top:15px; padding-bottom:15px; } }
Still not fixed, I am very disappointed to Elementor team.
@Olexandr24664 many thanks for this. The snippet works great!
I am
2.4.4
pro user. my quick fix after take a look at the source code would be.plugins/elementor-pro/modules/posts/skins/skin-base.php
line 859
change<?php the_excerpt(); ?>
to<?php echo wp_trim_words(get_the_excerpt(), $this->get_instance_value('excerpt_length'), '...'); ?>
somehowadd_filter
does not make any effect. so, you should comment it out.add_filter( 'excerpt_more', [ $this, 'filter_excerpt_more' ], 20 );
add_filter( 'excerpt_length', [ $this, 'filter_excerpt_length' ], 20 );
I am
2.4.4
pro user. my quick fix after take a look at the source code would be.plugins/elementor-pro/modules/posts/skins/skin-base.php
line 859
change<?php the_excerpt(); ?>
to<?php echo wp_trim_words(get_the_excerpt(), $this->get_instance_value('excerpt_length'), '...'); ?>
somehowadd_filter
does not make any effect. so, you should comment it out.add_filter( 'excerpt_more', [ $this, 'filter_excerpt_more' ], 20 );
add_filter( 'excerpt_length', [ $this, 'filter_excerpt_length' ], 20 );
@seksitha , hoho, you saved my time) There is easier solution
// functions.php // function custom_post_excerpt_length($post_excerpt, $post) { $length = 70; $excerpt = strlen($post_excerpt) > $length ? mb_substr($post_excerpt, 0, $length - 3, "utf-8") . "..." : $post_excerpt; return $excerpt; }
add_filter('get_the_excerpt', 'custom_post_excerpt_length', 20, 2); // end functions.php //
the_excerpt in your_root_folder\wp-includes\post-template.php apply_filters( 'the_excerpt', get_the_excerpt() ); and in same file the function get_the_excerpt ends with applying filter apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); Have a nice day
Thanks, but it can only limit the total number of characters, not number of actual words. You solution works great with Chinese, but not with English(it will trim the last word).
Let's say: 60 characters = 8-10 words (in English, about 6 characters / word), then several words => 1 phrase, several phrases => 1 sentence;
But: 1 character = 1 word (in Chinese), then several characters => 1 phrase, several phrases => 1 sentence.
Is there a better way to deal with both of above situations?
I think you might be over-engineering this. Use CSS to set the height of the excerpt element. I thought I had posted the exact CSS code before…
From: Stephen Zhao notifications@github.com Sent: Wednesday, December 18, 2019 3:12 AM To: elementor/elementor elementor@noreply.github.com Cc: Tanuki imtanuki@gmail.com; Comment comment@noreply.github.com Subject: Re: [elementor/elementor] Length of the excerpt not working in Post widget (elementor pro) (#5734)
I am 2.4.4 pro user. my quick fix after take a look at the source code would be. plugins/elementor-pro/modules/posts/skins/skin-base.php line 859 change <?php the_excerpt(); ?> to <?php echo wp_trim_words(get_the_excerpt(), $this->get_instance_value('excerpt_length'), '...'); ?> somehow add_filter does not make any effect. so, you should comment it out. add_filter( 'excerpt_more', [ $this, 'filter_excerpt_more' ], 20 ); add_filter( 'excerpt_length', [ $this, 'filter_excerpt_length' ], 20 );
I am 2.4.4 pro user. my quick fix after take a look at the source code would be. plugins/elementor-pro/modules/posts/skins/skin-base.php line 859 change <?php the_excerpt(); ?> to <?php echo wp_trim_words(get_the_excerpt(), $this->get_instance_value('excerpt_length'), '...'); ?> somehow add_filter does not make any effect. so, you should comment it out. add_filter( 'excerpt_more', [ $this, 'filter_excerpt_more' ], 20 ); add_filter( 'excerpt_length', [ $this, 'filter_excerpt_length' ], 20 );
@seksitha https://github.com/seksitha , hoho, you saved my time) There is easier solution
// functions.php // function custom_post_excerpt_length($post_excerpt, $post) { $length = 70; $excerpt = strlen($post_excerpt) > $length ? mb_substr($post_excerpt, 0, $length - 3, "utf-8") . "..." : $post_excerpt; return $excerpt; }
add_filter('get_the_excerpt', 'custom_post_excerpt_length', 20, 2); // end functions.php //
the_excerpt in your_root_folder\wp-includes\post-template.php apply_filters( 'the_excerpt', get_the_excerpt() ); and in same file the function get_the_excerpt ends with applying filter apply_filters( 'get_the_excerpt', $post->post_excerpt, $post ); Have a nice day
Thanks, but it can only limit the total number of characters, not number of actual words. You solution works great with Chinese, but not with English(it will trim the last word).
Let's say: 60 characters = 8-10 words (in English, about 6 characters / word), then several words => 1 phrase, several phrases => 1 sentence;
But: 1 character = 1 word (in Chinese), then several characters => 1 phrase, several phrases => 1 sentence.
Is there a better way to deal with both of above situations?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elementor/elementor/issues/5734?email_source=notifications&email_token=AICNOSWWG2QZCEQ7XRKV4H3QZHLOPA5CNFSM4FU7NVMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHFJKHQ#issuecomment-566924574 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AICNOSUV4NZERJ22XBBHP63QZHLOPANCNFSM4FU7NVMA .
I was struggling with the same problem but then I found this from Elementor's own website:
"Why Doesn’t The Excerpt Length Work Consistently in Archive Posts widgets or Posts widgets? When Elementor displays a post, if it has no excerpt, Elementor automatically generates an excerpt from the post’s content. Both the Archive Posts widget and the Posts widget includes an Excerpt Length option to allow you to control the length of this auto-generated excerpt. In both, however, the excerpt length only applies to posts in which no manual excerpt has been entered. The length specified in the Elementor widget is ignored if a manually-generated excerpt exists for a post."
So sadly it's not a bug but intentional behavior.
I was struggling with the same problem but then I found this from Elementor's own website:
"Why Doesn’t The Excerpt Length Work Consistently in Archive Posts widgets or Posts widgets? When Elementor displays a post, if it has no excerpt, Elementor automatically generates an excerpt from the post’s content. Both the Archive Posts widget and the Posts widget includes an Excerpt Length option to allow you to control the length of this auto-generated excerpt. In both, however, the excerpt length only applies to posts in which no manual excerpt has been entered. The length specified in the Elementor widget is ignored if a manually-generated excerpt exists for a post."
So sadly it's not a bug but intentional behavior.
Automatically generated excerpt sucks, that's why we add it manually to match a good article. It's a shame that Elementor only focus on marketing and new features to attract newbies, but barely to fix issues of existing widgets or functions. Features from 3rd party plugins may be better than those from Elementor official in most cases nowadays.
OMG – why are you thrashing over this?
Just fix it with CSS – 5 minutes.
From: Stephen Zhao notifications@github.com Sent: Monday, December 23, 2019 9:16 PM To: elementor/elementor elementor@noreply.github.com Cc: Tanuki imtanuki@gmail.com; Comment comment@noreply.github.com Subject: Re: [elementor/elementor] Length of the excerpt not working in Post widget (elementor pro) (#5734)
I was struggling with the same problem but then I found this from Elementor's own website:
"Why Doesn’t The Excerpt Length Work Consistently in Archive Posts widgets or Posts widgets? When Elementor displays a post, if it has no excerpt, Elementor automatically generates an excerpt from the post’s content. Both the Archive Posts widget and the Posts widget includes an Excerpt Length option to allow you to control the length of this auto-generated excerpt. In both, however, the excerpt length only applies to posts in which no manual excerpt has been entered. The length specified in the Elementor widget is ignored if a manually-generated excerpt exists for a post."
So sadly it's not a bug but intentional behavior.
Automatically generated excerpt sucks, that's why we add it manually to match a good article. It's a shame that Elementor only focus on marketing and new features to attract newbies, but barely to fix issues of existing widgets or functions. Features from 3rd party plugins may be better than those from Elementor official in most cases nowadays.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/elementor/elementor/issues/5734?email_source=notifications&email_token=AICNOSURMHFALTJBK2CK3HLQ2FWHJA5CNFSM4FU7NVMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHSJKAI#issuecomment-568628481 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AICNOSQXSE2NKPMVGYJQDDDQ2FWHJANCNFSM4FU7NVMA .
Hey IMTanuki, I tried using the css fixes above, and they didn't work with my set up. It would be great if Elementor could get around to fixing it someday. There are a lot of Elementor users. 3+ million. I'm sure not all can mess around with css and get it to work. It would be great for an easier solution.
OMG – why are you thrashing over this? Just fix it with CSS – 5 minutes. From: Stephen Zhao notifications@github.com Sent: Monday, December 23, 2019 9:16 PM To: elementor/elementor elementor@noreply.github.com Cc: Tanuki imtanuki@gmail.com; Comment comment@noreply.github.com Subject: Re: [elementor/elementor] Length of the excerpt not working in Post widget (elementor pro) (#5734) I was struggling with the same problem but then I found this from Elementor's own website: "Why Doesn’t The Excerpt Length Work Consistently in Archive Posts widgets or Posts widgets? When Elementor displays a post, if it has no excerpt, Elementor automatically generates an excerpt from the post’s content. Both the Archive Posts widget and the Posts widget includes an Excerpt Length option to allow you to control the length of this auto-generated excerpt. In both, however, the excerpt length only applies to posts in which no manual excerpt has been entered. The length specified in the Elementor widget is ignored if a manually-generated excerpt exists for a post." So sadly it's not a bug but intentional behavior. Automatically generated excerpt sucks, that's why we add it manually to match a good article. It's a shame that Elementor only focus on marketing and new features to attract newbies, but barely to fix issues of existing widgets or functions. Features from 3rd party plugins may be better than those from Elementor official in most cases nowadays. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#5734?email_source=notifications&email_token=AICNOSURMHFALTJBK2CK3HLQ2FWHJA5CNFSM4FU7NVMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHSJKAI#issuecomment-568628481> , or unsubscribe https://github.com/notifications/unsubscribe-auth/AICNOSQXSE2NKPMVGYJQDDDQ2FWHJANCNFSM4FU7NVMA .
That css code is not good enough and you should use em instead of px. I know CSS very well, but I still want to implement it via option of widget or php/js function code in a convenient way.
This issue doesn't happen on all WordPress themes, by the way. This issue usually happens on WordPress themes that have an option to set the excerpt length. You can go to WordPress' theme customizer (Appearance -> Customize) to set the excerpt length. Source: https://www.wppagebuilders.com/excerpt-length-not-working-elementor
Prerequisites
Description
On my website, there are posts with excerpts and some without excepts.
In the post widget (elementor pro), the post excerpt length works for the posts that do not have excerpts, but for the posts that have excerpts, it doesn't work and shows the full except.
See screenshot:
Steps to reproduce
Isolating the problem
Environment
System Info
``` ``` Operating System: | Linux | -- | -- | -- Software: | Apache | MySQL version: | 5.6.41 | PHP Version: | 7.0.31 | PHP Max Input Vars: | 1000 | PHP Max Post Size: | 8M | GD Installed: | Yes | ZIP Installed: | Yes | Write Permissions: | All right | Elementor Library: | Connected