Changing excerpt length

General questions pertaining to how certain issues can be resolved. This forum is closed with effect from February 2019. Please post future requests on https://github.com/sayontan/suffusion.
Forum rules
This forum is closed with effect from February 2019. Please post future requests on https://github.com/sayontan/suffusion.

1. No offensive language and no mocking
2. Please do a thorough search before you post something. Trust us, there is a high probability that the question you are asking has been asked previously.
3. No soliciting. You cannot post here soliciting bids for people offer you quotes, or even offer money to people for some work. You will be moderated if you do so. If you are looking for help, please post your request on http://jobs.wordpress.net or http://codepoet.com
4. Please be reasonable. You are getting software and support. For free. Complicated requests from a general purpose theme are not welcome and some volunteers might lose patience with you.
5. Please do your due diligence. If you posted a query and we answered with a link, take the trouble to go through the link contents.
6. Please post with complete information. Requests for help MUST be accompanied with your URL, particularly if you are asking something like "Why am I seeing a blank space?"
hinkydinky
Posts: 8
Joined: 08 Nov 2018, 09:35

Changing excerpt length

Post by hinkydinky » 08 Nov 2018, 09:55

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

Colin
Posts: 5066
Joined: 27 Oct 2009, 10:46

Re: Changing excerpt length

Post by Colin » 10 Nov 2018, 00:29

You are on a very old version of Suffusion. Try updating to the latest version available on this board or on GitHub.

hinkydinky
Posts: 8
Joined: 08 Nov 2018, 09:35

Re: Changing excerpt length

Post by hinkydinky » 10 Nov 2018, 07:19

Thanks, I'll update.

hinkydinky
Posts: 8
Joined: 08 Nov 2018, 09:35

Re: Changing excerpt length

Post by hinkydinky » 10 Nov 2018, 09:44

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?

hinkydinky
Posts: 8
Joined: 08 Nov 2018, 09:35

Re: Changing excerpt length

Post by hinkydinky » 10 Nov 2018, 09:58

I figured it out. Never mind. D'uh.

hinkydinky
Posts: 8
Joined: 08 Nov 2018, 09:35

Re: Changing excerpt length

Post by hinkydinky » 10 Nov 2018, 11:29

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?

mbrsolution
Posts: 92
Joined: 01 Jan 2012, 15:58
Location: Australia
Contact:

Re: Changing excerpt length

Post by mbrsolution » 10 Nov 2018, 19:54

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

hinkydinky
Posts: 8
Joined: 08 Nov 2018, 09:35

Re: Changing excerpt length

Post by hinkydinky » 10 Nov 2018, 19:56

Thanks for the reply.

Just to the end of functions.php

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

Colin
Posts: 5066
Joined: 27 Oct 2009, 10:46

Re: Changing excerpt length

Post by Colin » 10 Nov 2018, 23:49

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);

hinkydinky
Posts: 8
Joined: 08 Nov 2018, 09:35

Re: Changing excerpt length

Post by hinkydinky » 11 Nov 2018, 06:23

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.

Locked