Archived topic
Masonry on custom post type stopped working after update
15 replies · Started by Thomas on May 15, 2019
Hi there,
we have using the build in masonry support for a custom post type for a year now, but with one of the recent updates it stopped working.
All plugins, themes, etc are up to date.
Example URL for Admins: The column on the right side should be 3 columns in masonry mode.
Thanks in advance!
Hi there,
Hmm something weird is happening on that page.
Any caching plugins or server cache?
If so can you try clear them first?
If not then can you quickly go through #1 here to eliminate any plugin conflicts:
https://docs.generatepress.com/article/debugging-tips/
Let me know :)
Whats the weird thing? Looks good to me? See Screenshot here: https://screenshots.firefox.com/bpMjAToM4zFDgbjm/kupf.at
Thats what it should look like at the moment (sans the masonry for the right column).
Ad debugging:
Deactivated all plugins, no difference.
WP Debug: No issues.
No white Screen, enough memory.
Ad theme: Well, its a custom theme template, so switching doesn't work.
Ad Error log: nothing major.
When I look through the other support questions, it seems like I'm not the only one with issues with masonry. I suppose its a degression in a recent update of gp.
Oh, an no caching plugin, some serverside caching I think (but I have no access to it, and i never experienced problems with it).
Little bit confused. Is the link you provided a single post?
That's what the code is suggesting.
What code are you using to make it masonry?
What version are you upgrading from?
Any chance you can disable all plugins except GP Premium for us to have a look?
Might need setup a staging site if we need to do further debugging.
Thanks and We will get it sorted :)
Little bit confused. Is the link you provided a single post?
--> It is single view of the custom post type "zeitungsausgabe" which is linked to a number of posts of a different post type (called zeitungsartikel). As said, it worked like a charm until recently
What code are you using to make it masonry?
function kupf_portfolio_masonry( $masonry ) {
if ( is_singular( 'zeitungsausgabe' ) ) {
return 'true';
}
return $masonry;
}
add_filter( 'generate_blog_masonry','kupf_portfolio_masonry' );
function kupf_blog_page_columns( $columns ) {
if ( is_singular( 'zeitungsausgabe' ) ) {
return true;
}
return $columns;
}
add_filter( 'generate_blog_columns', 'kupf_blog_page_columns' );
function kupf_add_singular_post_classes( $classes ) {
if ( get_post_type() == 'zeitungsartikel' && is_singular("zeitungsausgabe") ) {
$classes[] = 'generate-columns';
$classes[] = 'tablet-grid-50';
$classes[] = 'mobile-grid-100';
$classes[] = 'grid-parent';
$classes[] = 'grid-33';
$classes[] = 'zeitungsausgabe-grid';
}
return $classes;
}
add_filter( 'post_class', 'kupf_add_singular_post_classes' );
What version are you upgrading from?
We upgrade pretty frequently, but I can't pinpoint it on a certain date, as it is possible that we didn't catch it right away. But I'm pretty sure the problem popped up in the last few weeks.
Any chance you can disable all plugins except GP Premium for us to have a look?
Nope, sorry. Its a production website with heavy traffic. And as said, I did test it, and it isn't a conflict with another plugin.
Ad date: Regarding to archive.org, it at least looked normal on 31.3.2019: https://web.archive.org/web/20190331172208/https://kupf.at/zeitung/166/
There are no newer captures though.
So that means its an issue with the gp premium plugin, because the theme got last updated in january, right?
I could try to do a rollback with the plugin, but I don't know how to access older versions. Maybe you can help me here?
I've forwarded this to Tom.
He will get back to you :)
Thanks for your patience!
Great, thanks!
Are you using this filter anywhere?: generate_blog_get_column_count
It seems to be set to 3 instead of 33.
Yeah, thats it!
Funny thing: I didn't change it, it was set to 3 for the whole time. But I added the comment "Doesn't seem to work", so I excluded it above in my code listing =)
So I suppose something got fixed with this filter in an update, leading to my code to kick in and, well, fail? =)
Exactly - we fixed the bug in 1.8 :)
Lol, see my old report: https://generatepress.com/forums/topic/allow-me-to-enable-masonry-on-single-templates/
Another little thing: I cant get the generate_blog_get_column_count filter to work. But it doesn’t seem to work – I have to set the setting in the options table.
=)
Ah yes - all fixed! Glad it's working now :)
Thanks again, love your support!