Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1418309

    Hi there

    I’m using the Masonry element with “Perfect Grid” setting to display a site’s blog posts. The problem is, if the title or description (or both) of a post are too long, it resizes the image, making it look like it’s no longer a “Perfect Grid” (even though technically it is).

    Ideally I’d like the images to have a fixed size/shape, regardless of the screen resolution, and simply (dynamically) modify the length of the description, in order to fit everything and remain a “perfect grid”.

    Is this possible?

    • This topic was modified 1 year ago by adapt. Reason: Clarified what I'm looking for
    • This topic was modified 1 year ago by adapt.
    #1418480

    Hey adapt,

    Thank you for the inquiry.

    You might be able to use the avf_masonry_entry_content filter to adjust the length of the content. Usage example can be found in the following threads.

    // https://kriesi.at/support/topic/show-category-in-masonry-gallery-with-link-to-overview-posts-in-that-category/#post-1362994
    // https://kriesi.at/support/topic/how-to-remove-a-section-not-visible-on-edit-page-and-not-in-the-footer/#post-1369818

    Please provide the site URL in the private field so that we can check the Masonry element.

    Best regards,
    Ismael

    #1418518

    Sure thing Ismael, I’ve included the link to the page below.

    In the meantime I’ll check out the links you provided – thank you!

    #1418696

    Hi,
    Thanks for the link to your page, I checked all of the masonry items and they all seemed to be the same size. Did you manually adjust the titles and content or did you already solve the issue?
    Perhaps you could try this css, it limits the title content area to a specific height and hides the overflow:

    .av-inner-masonry-content-pos,
    .av-inner-masonry-content-pos-content {
    	max-height: 152px;
    	overflow: hidden;
    }

    currently all of the items fit in the 152px height, and I tested with 140px and it worked hiding the extra text. You can try this if you still need a solution.

    Best regards,
    Mike

    #1418703

    That’s perfect Mike – that’s exactly what I was looking for.

    Thank you!

    #1418705

    Actually, is there a way to dynamically display a “…” at the end of the text, if it’s one of the ones that is too long and gets cut off?

    Just so the user can clearly see it’s “continued”, rather than just cutting it short?

    #1418710

    Hi,

    Thank you for the update.

    You can try this filter in the functions.php file to limit the masonry content to 50 characters.

    add_filter("avf_masonry_entry_content", function($content) {
        $limit = 50; 
    
        if (strlen($content) > $limit) {
            $content  = substr($content, 0, $limit);
            $content  .= '...';
        }
    
        return $content;
    }, 10, 1);
    

    You may need to remove the css modification temporarily and adjust the limit if necessary.

    Best regards,
    Ismael

    #1418826

    Thanks Ismael, that’s an excellent solution. The one Mike provided works for now, so I’ll just stick with that, but if we need to make adjustments in the future, I’ll revert to this suggestion, as it’s probably the cleanest.

    Thanks!

    #1418830

    Hi,

    No worries! Glad we could be of help. Please do not hesitate to open another thread if you have more questions about the theme. We will close this one for now.

    Have a nice day.

    Best regards,
    Ismael

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Restrict Masonry gallery title & description’ is closed to new replies.