Page 1 of 2

Changing excerpt length

Posted: 08 Nov 2018, 09:55
by hinkydinky
I'm using Suffusion 4.0.4 on WordPress 4.9.7. I can't figure out where to make a change to control the excerpt length.

I'm mainly concerned with its use as the summary for RSS. It's clearly not still set to the default 55 words but everything I've read seems to point me to functions.php in the theme. I'm not finding what I expect to find there.

Any help is appreciated. Here's the current output: http://hinkydinky.net/feed/podcast

Thanks

Re: Changing excerpt length

Posted: 10 Nov 2018, 00:29
by Colin
You are on a very old version of Suffusion. Try updating to the latest version available on this board or on GitHub.

Re: Changing excerpt length

Posted: 10 Nov 2018, 07:19
by hinkydinky
Thanks, I'll update.

Re: Changing excerpt length

Posted: 10 Nov 2018, 09:44
by hinkydinky
Before I move on to editing the functions.php file, I have one little issue with the Suffusion version update. I exported the settings from my old version and imported them into the new version. Most worked. Most that didn't, I was able to adjust. It *says* it's using my custom background color, but it's not. It's using the default #444444 and I can't seem to do anything about this. Any thoughts?

Re: Changing excerpt length

Posted: 10 Nov 2018, 09:58
by hinkydinky
I figured it out. Never mind. D'uh.

Re: Changing excerpt length

Posted: 10 Nov 2018, 11:29
by hinkydinky
OK, so I'm trying to change how much of the manually entered excerpt for a post is employed for the RSS summary. I've tried adding this to the theme's functions.php file but it has no effect.

Code: Select all

function custom_excerpt_length( $length ) {
	return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
Does anyone know how to accomplish what I'm trying to achieve?

Re: Changing excerpt length

Posted: 10 Nov 2018, 19:54
by mbrsolution
Hi, I tested your code and it works for me. I also removed the spaces in ( $length ), so it looks like this ($length). Whether or not this makes a different, I am not sure. However in my dev site it works.

Where did you add the code?

Thank you

Re: Changing excerpt length

Posted: 10 Nov 2018, 19:56
by hinkydinky
Thanks for the reply.

Just to the end of functions.php

Where did you paste it? I can try it without those spaces.

Re: Changing excerpt length

Posted: 10 Nov 2018, 23:49
by Colin
Rather than put it in functions.php put it in a site specific plugin. That way you won't have to edit it again if you update or change themes. This is what you need just replace the xxx

Code: Select all

<?php
/**
 *Plugin Name: Site Plugin for xxxx.com
 *Description: Site specific code changes for xxxx.com.
 * Version: 1.0
 * Author: xxxx
 * Author URI: http://xxx.com
 */
 function custom_excerpt_length($length) {
	return 20;
}
add_filter('excerpt_length', 'custom_excerpt_length', 999);

Re: Changing excerpt length

Posted: 11 Nov 2018, 06:23
by hinkydinky
I appreciate the help, but I'm afraid that you've lost me. Should this be a standalone file? Named what and in what directory? Invoked where and how?

This all may be futile since the my RSS feed clearly is not limited to the default length. I can't find what I did years ago to extend it to the full, manually entered excerpt. It used to use all of it. I think when I updated my site to the WP version I'm using, it began truncating it, but not to the default 55 words. I'm still getting *most* of my manual excerpt, just not all of it.