Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #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 9 years, 12 months ago by pegasso4444.
    #357241

    Hi 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,
    Elliott

    #357369

    Hi Elliot!
    Sorry, but the code is not working for the manual excerpt.
    See here: http://gyazo.com/a953d5f129b01462f5455a11012a942d

    The 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
    Peter

    #357402

    UPDATE

    This problem is only on the grid portfolios!!

    #357880

    Hi!

    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,
    Yigit

    #405882

    Hi 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,
    Jen

    #406500

    Hi!

    Please edit your portfolio items and edit excerpt manually.

    Cheers!
    Yigit

    #741817

    Hello,

    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]

    #741828

    Hey!

    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,
    Yigit

    #741949

    Hello 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, 9 months ago by saivrindavms.
    #744032

    Hi,

    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,
    Andy

    #755561

    i have added the required details of WP installation

    #758210

    Hey!

    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,
    Ismael

    #1328624

    I 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/

    #1328716

    Hi,


    @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

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘Limit manual excerpt lenght’ is closed to new replies.