AngelEyes
Member
Posted 5 months ago #
These are two functions and filters i took straight from the wordpress codex that are supposed to alter the length of my excerpts and the read more text. Neither of these are doing anything as I'd expect. This is in my functions.php file.
function custom_excerpt_length( $length ) {
return 60;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
function custom_excerpt_more( $more ) {
return 'Continue reading recipe';
}
add_filter( 'excerpt_more', 'custom_excerpt_more' );
AngelEyes
Member
Posted 5 months ago #
when I say that they arent doing anything as I'd expect, I mean they aren't doing anything at all.
Does your theme use the_excerpt()?
AngelEyes
Member
Posted 5 months ago #
Hey Esmi,
Yes, I'm using the_excerpt on my archive pages and these functions are not effecting it at all.
The first function has always worked first time for me.
AngelEyes
Member
Posted 5 months ago #
hmm i've made some progress on this. I use Starkers as a base theme and it turned out there was a function earlier on setting the read more text.
there was also one already there for setting the excerpt length but that part of the equation doesn't seem to actually be doing anything. I removed the two functions I'd had before and I successfully have been switching up my read more texts but cant get anything to register on the excerpt_length
AngelEyes
Member
Posted 5 months ago #
This is really killing me...
I've tried a million variations on
function custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
Thats what I have in my functions.php right now. I have no plugins installed. I can't get this to effect my excerpt length no matter what I seem to do. Any ideas what could be blocking this?
AngelEyes
Member
Posted 5 months ago #
for what its worth, I worked around the problem and did this:
[Code moderated as per the Forum Rules. Please use the pastebin]