I’m not sure if I understand you correctly. Could you explain it a bit further and give some example? That would help me a lot.
Thread Starter
Alkorr
(@alkorr)
Hi thaikolja, sure. Let’s say my secondary titles usually contain 60 to 80 characters, but to fit my homepage design, I need to show shortened secondary titles (only 30 characters), how can I do that? It is possible to do it for Post Titles (there are plenty of snippets and plugins) but I have no idea how to do it with your plugin.
Hope it helps 🙂
A very primitive solution to limit the output would be this (placed into functions.php of your theme):
/**
* Limits the secondary title to a
* maximum of 30 characters.
*
* @param $secondary_title
*
* @return string
*/
function limit_secondary_title_characters($secondary_title) {
return (string)substr($secondary_title, 0, 30);
}
add_filter("get_secondary_title", "limit_secondary_title_characters");
Please note that this will affect all secondary titles on your website unless you add some filtering.
Please report back.
-
This reply was modified 8 years, 11 months ago by
thaikolja.
-
This reply was modified 8 years, 11 months ago by
thaikolja.