Archived topic
Allow me to enable masonry on single templates
1 reply · Started by Thomas on March 27, 2018
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.
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?