Community Forums › Forums › Archived Forums › General Discussion › How to limit characters when Display = Entry Excerpts
- This topic has 8 replies, 3 voices, and was last updated 7 years, 7 months ago by Christoph.
-
AuthorPosts
-
July 24, 2016 at 9:28 pm #190151riseUpMember
Hello.
Please go to Genesis --> Theme Settings --> Content Archives where Display = Entry Excerpts.
I am fine with this. However, I would like to limit the number of characters in the above scenario.
Can somebody advise on how I can limit the number of characters for the above specific setting?
Thank you!
http://www.ymphony.comJuly 25, 2016 at 8:25 am #190164ChristophMemberJuly 25, 2016 at 4:42 pm #190187riseUpMemberThat's strange.
I copied and pasted the following into functions.php but no impact...
//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'sp_excerpt_length' );
function sp_excerpt_length( $length ) {
return 100; //* pull first 50 words
}Am I missing something here? Thanks.
July 26, 2016 at 4:19 am #190199Victor FontModeratorWordpress is set to display 55 words in an excerpt by default. You've increased the size of the excerpt by setting the function to return 100 words. Set the return value to less than 50 if you want to decrease the size.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?July 26, 2016 at 5:17 am #190201riseUpMemberHello,
Yes, I have done less than 50 characters such as 49 and 10. Yet, still, no changes to the output.
I"m wondering if there is a setting that is preventing me from changing the number of characters the excerpt can display. I'm puzzled because this is a simple function but no changes. Still would like some assistance on this one...
Thanks!
//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'sp_excerpt_length' );
function sp_excerpt_length( $length ) {
return 10; //* pull first 50 words
}August 12, 2016 at 5:34 pm #191197riseUpMemberHello StudioPress community.
When I copy and pasted the following code into functions.php:
//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'sp_excerpt_length' );
function sp_excerpt_length( $length ) {
return 10; //* pull first 50 words
}...the following fatal error continues to display:
Fatal error: Cannot redeclare sp_excerpt_length() (previously declared in /home/content/p3pnexwpnas06_data03/32/3122732/html/wp-content/themes/streamline-pro/functions.php:104) in /home/content/p3pnexwpnas06_data03/32/3122732/html/wp-content/themes/streamline-pro/functions.php on line 163
Can somebody advise on how to fix this error? Thank you.
August 12, 2016 at 6:15 pm #191199ChristophMemberHi,
you fix this errors by only using the function/filter once.
You have it on line 104 and on line 163.
August 12, 2016 at 7:04 pm #191202riseUpMemberOpps. Thank you.
I was able to delete 1 of them.
When I saved, however, the excerpt does not fall within the number of characters....in this case, 49.
//* Modify the length of post excerpts
add_filter( 'excerpt_length', 'sp_excerpt_length' );
function sp_excerpt_length( $length ) {
return 49; //* pull first 50 words
}For some strange reason, the code is not applying to the homepage post excerpt.
I made sure to go to Genesis --> Theme Settings --> Content Archives --> Display: Entry Excerpts
Any thoughts on this? Thank you!
August 13, 2016 at 7:56 am #191215ChristophMemberAre you using manual excerpts?
The filter only works on automatic excerpts.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.