Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #495322

    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.

    #495834

    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

    #495848

    Hi Yigit,

    This stems the excerpt length which is handy too but I need to stem the length of av-masonry-entry-title.

    Thanks.

    #496284

    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

    #498669

    ok, thanks. Can this be applied in a copy of masonry_entries.php in a child theme?

    #498997

    Hi!

    Unfortunately, this is not possible. You will have to update the file every time you upgrade the theme. Create a change log or note of some sort in case you update the theme.

    Regards,
    Ismael

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.