Site logo

[Resolved] Change masonry horizontalOrder to true?

Home Forums Support [Resolved] Change masonry horizontalOrder to true?

Home Forums Support Change masonry horizontalOrder to true?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2047956
    Addison

    I’m working on a custom post gallery where the client wants the order of the posts to be as accurate as possible while still using a masonry layout. After a little digging, I’ve found the Masonry has this option:

    https://masonry.desandro.com/options.html#horizontalorder

    Does anyone know if there’s a way to affect this via a filter? Or even with a little JavaScript? I’m still digging on my own, but I wanted to check and see if someone else has already dealt with this.

    Thanks!

    -Addison

    #2048034
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You should be able to do it like this:

    add_filter( 'generate_blog_masonry_init', function( $args ) {
        $args['horizontalOrder'] = true;
    
        return $args;
    } );

    Let us know 🙂

    #2048073
    Addison

    Thanks, Tom! That did the trick. I didn’t see it in the docs, but I should have snooped around in the files a little more. I figured there would be something there.

    #2048181
    Tom
    Lead Developer
    Lead Developer

    No problem! Glad I could help 🙂

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