Shaun Brown
Member
Posted 1 year ago #
Curious, Is it possible to have (2) different excerpt lengths controlled via your functions.php template? ie. Currently, I am using
function new_excerpt_length($length) {
return 55;
}
to filter how many characters I want to show up for each post...however, what Id like to do is feature the excerpt much shorter in my "works" category in order to tailor it to my design. So is it possible to add yet another function in order to make it pass that set of arguments twice, but for different pages, categories, etc?
Shaun Brown
Member
Posted 1 year ago #
Thanks, Ill check it out.
try something like:
function new_excerpt_length($length) {
if(in_category('works')) return 25;
else return 55;
}
you could expand this with more (elseif) conditional statements.
Shaun Brown
Member
Posted 1 year ago #
Very cool, this is perfect.
Hey Al - is it possible to replace the "in_category" to something that calls a "tag" instead? I know there is isnt an "in_tag", at least to my knowledge...so what could you use to accomplish the same task if its at all possible?
Thanks again.
-SB
Shaun Brown
Member
Posted 1 year ago #
Ouch man...lol. Yes, apparently I suck I finding the stuff I need though on occasion hence the beauty of the forums. Sorry if Im putting you out, I really appreciate the help though.
-SB