-
Author
-
January 17, 2016 at 08:51 #98915ale7qParticipant
I am outputting my group’s main topics post onto the front page of kleo through post grid. I am trying to limit the lengths of excerpts using the one’s I saw in the forum (your reply get excerpt function which I placed in the function.php but no change). In fact I can’t find a place to limit the length of excerpts. Neither can I find that in the post template php. I also found your other replies but it showed errors when I placed in my function php.
Maybe my particular case is different since I am outputting a Group topic post. How to do it.
January 18, 2016 at 07:09 #99023LauraModeratorHello, i understand the issue, can you share admin credentials so i can check it out?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
January 19, 2016 at 16:47 #99302LauraModeratorHello, added this
COPY CODEfunction custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
To functions.php 🙂 You can change it as you prefer ( 20 )
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
January 20, 2016 at 04:32 #99452ale7qParticipantHi,
Thanks a lot. Just one more favour, how to change the limits to number of character instead of words words.
January 21, 2016 at 18:24 #99780LauraModeratorHello, try maybe this one
COPY CODEfunction get_excerpt(){ $excerpt = get_the_content(); $excerpt = preg_replace(" (\[.*?\])",'',$excerpt); $excerpt = strip_shortcodes($excerpt); $excerpt = strip_tags($excerpt); $excerpt = substr($excerpt, 0, 40); $excerpt = substr($excerpt, 0, strripos($excerpt, " ")); $excerpt = trim(preg_replace( '/\s+/', ' ', $excerpt)); return $excerpt; }
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
February 27, 2016 at 09:54 #107041ale7qParticipantSorry but it did not work — the length did not change at all. Do you another suggestion?
February 27, 2016 at 22:24 #107145LauraModeratorHello, you may need to contact a freelancer to check it out for you
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
February 28, 2016 at 06:46 #107183ale7qParticipantI was hoping you can just give another codes that I can try.
I am searching this site. Maybe there are some clues somewhere but I could not see them.
February 28, 2016 at 20:06 #107258LauraModeratorHello, try this maybe
COPY CODEfunction excerpt($limit) { $excerpt = explode(' ', get_the_excerpt(), $limit); if (count($excerpt)>=$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt).'.'; } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('@\[[^\]]*\]@','',$excerpt); return $excerpt; }
If it doesn’t work you will need to contact a developer 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
November 22, 2016 at 19:49 #145030CafonautaParticipantHi,
Is this the preferred way to limit post excerpt lenght on post grid?COPY CODEfunction custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
Does it affect only post grid excerpt?
Thanks
November 24, 2016 at 11:51 #145194LauraModeratorHello, i do not understand your question, does it work for you? You can test the code and check it out 🙂
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
-
AuthorPosts
The forum ‘General questions’ is closed to new topics and replies.