Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #975777

    Propulsion: How do I reduce the standard length of a portfolio excerpt shown on a portfolio page?

    #975929

    Hey,

    Please add following code to bottom of Functions.php file in Appearance > Editor

    add_filter('excerpt_length', 'pr_shorter_excerpt_length');
    function kp_shorter_excerpt_length($length) {
    return 30; }

    Best regards,
    Yigit

    #976061

    Thanks. The code as you have written it makes the excerpt disappear. Where do I input the number of lines I need?

    #976119

    Hi,

    Please replace “30” with excerpt length you would like to display.

    Best regards,
    Yigit

    #976381

    It doesn’t matter what number is used, I still get no excerpt text at all, just [..] and the ‘read more’ when you roll over the title.

    #976887

    Hi pjwalker6,

    Can you give us admin and ftp access? so we can inspect on it further and try to debug it.
    Just post the login details in private content so it’s only visible to you and the moderators.

    Best regards,
    Nikko

    #976908

    Thanks, see private details

    #976968

    Hi,

    I added following code to your functions.php file:

    
    
    function custom_short_excerpt($excerpt){
    	$limit = 200;
    
    	if (strlen($excerpt) > $limit) {
    		$excerpt = substr($excerpt, 0, strpos($excerpt, ' ', $limit));
    	}
    
    	return $excerpt . '...<br/>';
    }
    
    add_filter('the_excerpt', 'custom_short_excerpt');
    

    Please note my code does not truncate words and the excerpt length may vary. You can change the excerpt length by replacing the value 200 with a lower or higher value.

    If you want to fully control the excerpt length (exact number of characters) you can use this code instead:

    
    function custom_short_excerpt($excerpt){
    	return substr($excerpt, 0, 200)  . '...<br/>';
    }
    add_filter('the_excerpt', 'custom_short_excerpt');
    

    Best regards,
    Dude

    • This reply was modified 7 months, 3 weeks ago by  Dude.
Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.