[Resolved] Masonry for custom post types

Home Forums Support [Resolved] Masonry for custom post types

Home Forums Support Masonry for custom post types

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #422798
    Gerhard

    Hi, I’m using the generate_blog_masonry filter to display certain pages with the masonry layout.

    However, after upgrading to 1.5.2 it’s not working anymore.

    That’s my code:

    add_filter('generate_blog_masonry','generate_blog_enable_post_type_masonry');
    $masonryPages = array(133,266,301);
    function generate_blog_enable_post_type_masonry()
    {
    	global $masonryPages;
    	
    	if(in_array(get_the_ID(),$masonryPages) || is_home())
    	{
    		return 'true';
    	}
    		
    	return $masonry;
    }

    Any help is greatly appreciated!

    #423287
    Tom
    Lead Developer
    Lead Developer

    Hmm, that should be fine.

    Which page isn’t it working on?

    #423318
    Lisa

    Hello. I am having the same issue. Lost custom-post-type masonry when upgrading from GP Premium 1.4.3 to 1.5.2.

    http://sbsginteriordesign.barkingdogweb.com/testimonials/

    // add masonry to custom post type when enabled for blog
    add_filter( 'generate_blog_masonry','sbsg_testimonials_masonry' );
    function sbsg_testimonials_masonry( $masonry )
    {
        if ( is_post_type_archive( 'testimonials' ) ) :
            return 'true';
        endif;
    
        return $masonry;
    }

    Thanks!

    #423735
    Tom
    Lead Developer
    Lead Developer

    Hmm, I don’t have a testimonials CPT, but I did just try this:

    add_filter( 'generate_blog_masonry', 'tu_blog_masonry' );
    function tu_blog_masonry( $masonry ) {
        if ( is_home() ) {
            return 'true';
        }
    
        return $masonry;
    }

    It worked as it should.

    How are you adding the function? Child theme?

    #423747
    Gerhard

    It’s working for standard posts. But on the pages where I use a custom post type it looks like this: https://www.schlafgutmurmel.eu/termine/

    However, on these pages I’m using page templates – I guess they are missing something, a class or some structure.

    #423950
    Lisa

    Yes, my function is in functions.php of a child theme.

    Since you asked, I tested on a local install by moving the function into functions.php of the parent theme instead. Still no masonry for the custom post type.

    Also as a test, I created a few standard posts and a blog page. The masonry for this works even without your function, because masonry is an option in the customizer.

    #424209
    Tom
    Lead Developer
    Lead Developer

    Any chance you can send me temporary admin login details, or better yet duplicate your site into a sub-folder on your website using a plugin like Duplicator?

    #424239
    Lisa

    Thanks! I’ve cloned the site here: http://playground.barkingdogweb.com/

    I will create a user for you and send it to support@generatepress.com

    #424241
    Tom
    Lead Developer
    Lead Developer

    Perfect – thank you! Will figure out what’s going on πŸ™‚

    #424484
    Tom
    Lead Developer
    Lead Developer

    I just released 1.5.3 which should fix this.

    Let me know πŸ™‚

    #424488
    Lisa

    As usual, you rule! Totally working now!

    #424490
    Tom
    Lead Developer
    Lead Developer

    Awesome! Thanks for helping πŸ™‚

    #425983
    Gerhard

    Excellent, everything’s working now, thanks a lot!

    #426058
    Tom
    Lead Developer
    Lead Developer

    Great to hear! πŸ™‚

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