Tagged: characters
Looking to restrict titles in the Masonry element to a specific number of characters for layout control.
For example:
Title “Lorem ipsum dolor sit amet, consectetur adipiscing elit”
would be restricted to 20 characters and have “…” appended.
“Quisque pharetra int…”
Preffered approach child theme functions.php or child theme edited template but core template edit at a push.
Any way of acheiving this – would be very useful!
Many thanks.
Hey M1000000!
Please add following code to Functions.php file in Appearance > Editor
add_filter( 'avf_masonry_excerpt_length', 'masonry_excerpt_length');
function masonry_excerpt_length() {
$excerpt = 100;
return $excerpt;
}
Best regards,
Yigit
Hi Yigit,
This stems the excerpt length which is handy too but I need to stem the length of av-masonry-entry-title.
Thanks.
Hey!
There is no available filter for that so you will have to modify the theme core files directly. Edit the config-templatebuilder > avia-shortcodes > masonry_entries.php, look for this code:
$items .= "<h3 class='av-masonry-entry-title entry-title' {$markup}>{$the_title}</h3>";
Replace it with:
$the_title = substr($the_title, 0, 10) . "...";
$items .= "<h3 class='av-masonry-entry-title entry-title' {$markup}>{$the_title}</h3>";
Best regards,
Ismael
ok, thanks. Can this be applied in a copy of masonry_entries.php in a child theme?