Hi,
there are lots of post showing how to get rid of date and featured image in the latest news widget, and cut the length of the excerpt. But how to shorten the length of the title? An ideal solution would be to cut it off at xx characters and add “…” at the end. But just cutting off would do as well.
Best regards,
Holger
Hey Holger!
You need to change the php code in:
enfold->framework->php->class-framework-widgets.php
At line 519 you find:
echo "<a class='news-link' title='".get_the_title()."' href='".get_permalink()."'>";
Replace this with:
$title = get_the_title();
if(strlen($title) > 30)
{
$title = substr($title, 0, 27).'...';
}
echo "<a class='news-link' title='".$title."' href='".get_permalink()."'>";
Best regards,
Günter
Hi Günter,
doesn’t seem to work. Probably my fault – I looked into the page source and realized, that the title got indeed truncated. What I meant is the headline – didn’t know that this is what is displayed. Here’s a link to see what I mean: http://infotropic.ru/?page_id=3288
Best regards,
Holger
Hey!
You just have to go down the code and replace
get_the_title()
with
$title
in lines
528 echo "<strong class='news-headline'>".get_the_title();
545 echo "<strong class='news-headline'>".get_the_title()."</strong>";
Regards,
Günter
Günter, now it works perfect. Thanks a lot. Problem solved.
Best regards,
Holger