-
AuthorPosts
-
November 24, 2014 at 4:59 pm #356944
Hi!
I am not able to find out on how to limit the length of the manual excerpts to get an even look on the portfolio grids..
They are always display in full length…
Thanks for your help
Peter- This topic was modified 10 years, 1 month ago by pegasso4444.
November 25, 2014 at 12:03 am #357241Hi pegasso4444!
Try adding this to the bottom of your functions.php file.
function new_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'new_excerpt_length' );
Or you can edit the excerpt when editing each portfolio post. If you don’t see the excerpt field then click on “Screen Options” in the top right hand corner and check it to display.
Regards,
ElliottNovember 25, 2014 at 6:58 am #357369Hi Elliot!
Sorry, but the code is not working for the manual excerpt.
See here: http://gyazo.com/a953d5f129b01462f5455a11012a942dThe problem is that all excerpts need to be the same length to make the grid look right!
You say: “Or you can edit the excerpt when editing each portfolio post” – but it is just not possible to have every excerpt the same length…
Thanks for further help on this
PeterNovember 25, 2014 at 8:02 am #357402UPDATE
This problem is only on the grid portfolios!!
November 25, 2014 at 8:22 pm #357880Hi!
Please use following code in Functions.php file
add_filter('avf_postgrid_excerpt_length','avia_change_postgrid_excerpt_length', 10, 1); function avia_change_postgrid_excerpt_length($length) { $length = 100; return $length; }
Regards,
YigitMarch 4, 2015 at 5:18 pm #405882Hi there, I’m also having a problem limiting the excerpt of portfolio items in the grid portfolio. I couldn’t get the custom function above to do anything. Any update on this, or anything else to try?
Thanks for your help,
JenMarch 5, 2015 at 4:42 pm #406500February 2, 2017 at 2:50 pm #741817Hello,
Any filters possible to set max word limit to a manual exerpt displayed in Blog Posts in Template builder ? Otherwise section looks a bit odd. can anyone help ? http://saivrinda.org/home-page2/ check the blog posts section [Latest Updates towards footer area]
February 2, 2017 at 3:19 pm #741828Hey!
Please add following code to Functions.php file in Appearance > Editor
add_filter('avf_postgrid_excerpt_length','avia_change_postgrid_excerpt_length', 10, 1); function avia_change_postgrid_excerpt_length($length) { $length = 100; return $length; }
Regards,
YigitFebruary 2, 2017 at 6:03 pm #741949Hello there Yigit, i have tried the code as you suggested. Not working it seems. check http://saivrinda.org/home-page2/ – Latest Updates section.
I have defined limit as 5 to check if its working.
Any thoughts? should i share login ?- This reply was modified 7 years, 10 months ago by saivrindavms.
February 7, 2017 at 7:16 pm #744032Hi,
Please post us your login credentials (in the “private data” field), so we can take a look at your backend.
Login credentials include:
- The URL to the login screen.
- A valid username (with full administration capabilities).
- As well as a password for that username.
- permission to deactivate plugins if necessary.
Best regards,
AndyMarch 4, 2017 at 9:34 am #755561i have added the required details of WP installation
March 9, 2017 at 8:14 am #758210Hey!
It’s not working because the site is using a very old version of the theme, 3.2.3. Please update to version 4.0. If the current filter is still not working, use this one instead.
add_filter('avf_post_slider_entry_excerpt', 'avf_post_slider_entry_excerpt_mod', 10, 4); function avf_post_slider_entry_excerpt_mod($excp, $prep, $perm, $entry) { $excp = substr($excp, 0, 100); return $excp; }
Best regards,
IsmaelNovember 11, 2021 at 8:32 am #1328624I needed the same thing; to limit the custom excerpt length in the blog element grid view, and Ismael’s function worked for me — thanks, Ismael! Only problem is it’s breaking in the middle of words — what’s the trick to limit the number of words, as opposed to characters, or to prevent the excerpts from breaking in the middle of words? Here’s the page I’m working on https://newissue.wpengine.com/weekly-content/blog/
November 12, 2021 at 4:35 am #1328716Hi,
@sky19er: WordPress has a function called wp_trim_words that can trim any content or strings to any number of words instead of characters. You should be able to incorporate that with the the_excerpt filter to limit the number of words in the post excerpt.// https://developer.wordpress.org/reference/functions/wp_trim_words/
Please feel free to open another thread if you need further assistance. We will close this thread for now.
Have a nice day.
Best regards,
Ismael -
AuthorPosts
- The topic ‘Limit manual excerpt lenght’ is closed to new replies.