I recently discovered that a justified masonry post layout is built directly into WordPress, but it just needs enqueued to work.
Add this simple snippet in a plugin like Code Snippets or Advanced Scripts to enqueue it:
wp_enqueue_script('masonry');Then, in your JS, include this (can also be added in Code Snippets or Advanced Scripts):
(function($) {
// init Masonry
$('.masonry-gallery').masonry({
// options
itemSelector: '.masonry-item',
gutter: 30,
percentPosition: true,
horizontalOrder: true
});
}(jQuery));
Using Oxygen Builder, you can create a masonry gallery with the Repeater element.
.masonry-gallery to the main div inside the repeater (you can use whatever class you like—just make sure it's the same in the JS)..masonry-item to this (again... this can be anything, just make sure it matches the class in the JS).