Site logo

Archived topic

How can I achieve Masonry on my blog page?

9 replies · Started by Michelle on February 14, 2023

Viewing posts 1–10 of 10

The excerpts on my blog page vary in length because I am using custom excerpts. Is there a way to make the blog layout masonry so the blog posts beneath don't have varying gaps above?

https://imgur.com/xnzoobE

https://imgur.com/btGOIA2

Or--alternatively, how can I make my excerpts end evenly? (Perhaps character counts instead of word counts?)

Thank you, but I'm using query loops and elements (also Custom excerpts). The word count settings work, but since long words have several characters and short words have few, the excerpts don't have the same amount of lines so the Read More buttons are not uniform across grids. Any design advice is appreciated.

I see. Query Loops don't have a Masonry feature yet.

Does this excerpt length setting not work?: https://share.getcloudapp.com/llugPv2X

Moreover, in the upcoming update for GB which should come out hopefully before the month ends, you should be able to align the Read More button you have at the bottom for the posts in the Query.

The update will be wonderfully helpful!

As for the excerpt length setting shown in your screenshot: Right now I have it set at 25. It isn't 25 characters, it isn't 25 words, so what is "25" referring to? I have a grid of 3 across. The left excerpt, middle, and right are all different lengths.

https://imgur.com/N6rrJle

If I change the setting to 50, they all show longer excerpts, but none of them are the same.

UPDATE-- I found that manual excerpts work well with excerpt length settings because they truncate off when they reach the set length but CUSTOM excerpts sometimes show in their entirety, ignoring the excerpt length settings.

It's word count, not character count.

I see. You're using a Custom Excerpt. This overrides the excerpt count settings.

You can try adding trim-cu-excerpt to the Headling Block for the excerpt.

Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

Then, add this snippet:

add_filter('generateblocks_dynamic_content_output', function($content, $attributes, $block){
	if ( ! is_admin() && ! empty( $attributes['className'] ) && strpos( $attributes['className'], 'trim-cu-excerpt' ) !== false ) {
		$content = substr($content,0,30) . '...';
	}
	return $content;
}, 10, 3);

FERNANDO! You're a genius!

I am so happy with this. It looks so much better.

Thank you!

Thank you again!

Yes, you're correct. That value alters the excerpt length.

You're welcome, Michelle!

This archived topic is closed to new replies.