[Resolved] Allow me to enable masonry on single templates

Home Forums Support [Resolved] Allow me to enable masonry on single templates

Home Forums Support Allow me to enable masonry on single templates

  • This topic has 1 reply, 2 voices, and was last updated 6 years ago by Tom.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #532610
    Thomas

    Hi there,

    I use a combination of custom post types, where I show an archive of an post type B in the single view of post type A.

    I know that this probably is an edge case, but thats what filters are for. But: While I can add the post classes via the post_class filter, activate columns via generate_blog_columns and activate masonry via generate_blog_masonry, I have to do modify your plugin files for it work.
    Because: In gp-premium/blog/columns.php you have the line
    $columns = ( is_singular() ) ? false : $columns;
    When I comment that out, it is working as it should. If you would for example move that a few lines up, so the line with the filter is the last thing that gets called, that would be great!

    Another little thing: I cant get the generate_blog_get_column_count filter to work. I tried it with

    function kupf_generate_blog_get_column_count ($count) {
    	$count = 3;
    	return $count;
    }
    add_filter ('generate_blog_get_column_count', 'kupf_generate_blog_get_column_count'); 

    But it doesn’t seem to work – I have to set the setting in the options table.

    #533093
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    That shouldn’t matter technically, as you can turn the columns on regardless of masonry:

    add_filter( 'generate_blog_columns', function( $columns ) {
        if ( is_singular( 'whatever' ) ) {
            return true;
        }
    
        return $columns;
    } );

    So that should turn on columns for your template.

    Then you can do this:

    add_filter( 'generate_blog_masonry', function( $masonry ) {
        if ( is_singular( 'whatever' ) ) {
            return 'true';
        }
    
        return $masonry;
    } );

    Does that not work?

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