-
Author
-
March 2, 2017 at 16:34 #154607
andre_placido
ParticipantHi! I’ve seen many posts regarding the excerpt lenght, and i’ve tried 2 or 3 functions, but none of them worked. I want the excerpt in the wordpress blog page to be larger. Is it possible?
Even if I place a “Read More” tag inside the post, or type a text in the Excerpt area, the lenght is still reduced.
Can you help me? The URL is http://www.agenciabowie.com.br/blog
Thank you!
March 3, 2017 at 23:46 #154720Laura
ModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! ?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 🙂
March 6, 2017 at 17:59 #154906Radu
ModeratorHi,
Please add the next functions to : http://pastebin.com/raw/SHLbs6Bv
The functions needs to be pasted in wp-content/themes/kleo-child/functions.phpCheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionMarch 7, 2017 at 19:51 #155006andre_placido
ParticipantI’ve tried, then cleanup my cache, but it’s still not working 🙁
March 8, 2017 at 15:59 #155065Radu
ModeratorDo you have Kleo child theme installed and activated ? It’s required
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionMarch 22, 2017 at 13:07 #156339andre_placido
ParticipantHi! Sorry for taking so long to answer, and yes, the installed theme is the Child one. I’ll create a temporary user so you can check.
March 22, 2017 at 18:21 #156376Radu
ModeratorHi,
The login credentials are not correct
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionMarch 24, 2017 at 18:30 #156601Radu
ModeratorHi,
Done I’ve replaced the function
See screenshot
I’ve used this functionCOPY CODEif ( ! function_exists( 'kleo_excerpt' ) ) { function kleo_excerpt( $limit = '', $words = false ) { $full_post_content = get_the_content(); $limit = '99999'; $excerpt = wp_strip_all_tags(substr( $full_post_content, 0, $limit )); return '<p>' . $excerpt . '</p>'; } }
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionMarch 27, 2017 at 17:18 #156806andre_placido
ParticipantThanks! It worked, however, it’s not working when I put a “read more” tag or write an excerpt in the proper field for it. Is there a way to fix this?
March 30, 2017 at 15:45 #157219Radu
ModeratorHi,
Please replace all of that code with this one, the excerpt tag will work as it should
COPY CODEif ( ! function_exists( 'kleo_excerpt' ) ) { function kleo_excerpt( $limit = 50, $words = false ) { /*Force excerpt length*/ $limit = 500; $from_content = false; $excerpt_initial = get_the_excerpt(); if ( $excerpt_initial == '' ) { $excerpt_initial = get_the_content(); $from_content = true; } $excerpt_initial = preg_replace( '<code>\[[^\]]*\]</code>', '', $excerpt_initial ); $excerpt_initial = strip_tags( $excerpt_initial ); /* If we got it from get_the_content -> apply length restriction */ if ( $from_content ) { $excerpt_length = apply_filters( 'excerpt_length', $limit ); $excerpt_initial = wp_trim_words( $excerpt_initial, $excerpt_length, '' ); } if ( $words ) { $excerpt = explode( ' ', $excerpt_initial, $limit ); if ( count( $excerpt ) >= $limit ) { array_pop( $excerpt ); $excerpt = implode( " ", $excerpt ) . '...'; } else { $excerpt = implode( " ", $excerpt ) . ''; } } else { $excerpt = substr( $excerpt_initial, 0, $limit ) . ( strlen( $excerpt_initial ) > $limit ? '...' : '' ); } return '' . $excerpt . ' '; } } function kleo_new_excerpt_length( $length ) { return 500; } add_filter( 'excerpt_length', 'kleo_new_excerpt_length' );
You can replace 500 value with your desired excerpt length
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionMarch 30, 2017 at 16:49 #157221andre_placido
ParticipantHi! Sorry, it didn’t work 🙁
It resulted in the error message: “Parse error: syntax error, unexpected ‘;’ in /home/agenc750/public_html/wp-content/themes/kleo-child/functions.php on line 35”
April 3, 2017 at 20:08 #157499Radu
ModeratorHi,
We have some issues with syntax highlighter function
Paste again the code from here : https://pastebin.com/raw/u7x9ZUE7 and replace the limit with your desired character
Let me know
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Bugs & Issues’ is closed to new topics and replies.