[Resolved] Disable masonry for other content types

Home Forums Support Disable masonry for other content types

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #84276
    Eric Bunch

    My client asked that I update their old site and they like the masonry look for the blog. The problem I’m facing is that they have other content types installed via the functions file. Masonry works great for the blog, but the other content types are displayed in masonry format as well.

    Is there a way to force masonry to only work with blog posts? Or is there a way to disable masonry for other content types?

    Thanks for all the great work you’re doing!

    #84356
    Tom
    Lead Developer
    Lead Developer

    Hi Eric,

    I’m working on a way to easily add/remove masonry from categories/archives/custom post types in the next version of Blog/Premium – I’ll update this thread if I manage to include it 🙂

    #84372
    Tom
    Lead Developer
    Lead Developer

    Ok, I’ve included a new filter in Blog/Premium where you can choose where to enable/disable masonry with a PHP snippet.

    Note: This will only work with Generate Blog 1.2.5 and GP Premium 1.2 and onward.

    This example will enable Masonry only on the “Posts page” set in “Settings > Reading”:

    add_filter('generate_blog_masonry','generate_blog_enable_blog_masonry');
    function generate_blog_enable_blog_masonry()
    {
            // If we're on the posts page, enable masonry
    	if ( is_home() )
    		return 'true';
    	
            // Otherwise, disable it
    	return 'false';
    }

    This example would enable masonry within WooCommerce:

    add_filter('generate_blog_masonry','generate_blog_enable_woocommerce_masonry');
    function generate_blog_enable_woocommerce_masonry()
    {
            // If we're in WooCommerce, enable masonry
    	if ( is_woocommerce() )
    		return 'true';
    	
            // Otherwise, disable it
    	return 'false';
    }

    All WordPress conditionals can be used: http://codex.wordpress.org/Conditional_Tags

    Thanks for the kick in the butt to get this done!

    #93758
    Eric Bunch

    Hi Tom, thanks so much for jumping on this. I really do appreciate all the great work you put in this theme!

    Eric

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