Reply To: Disable masonry for other content types

Home Forums Support Disable masonry for other content types Reply To: Disable masonry for other content types

Home Forums Support Disable masonry for other content types Reply To: Disable masonry for other content types

#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!