- This topic has 13 replies, 3 voices, and was last updated 6 years, 11 months ago by Tom.
-
AuthorPosts
-
November 12, 2017 at 11:47 pm #422798Gerhard
Hi, I’m using the generate_blog_masonry filter to display certain pages with the masonry layout.
However, after upgrading to 1.5.2 it’s not working anymore.
That’s my code:
add_filter('generate_blog_masonry','generate_blog_enable_post_type_masonry'); $masonryPages = array(133,266,301); function generate_blog_enable_post_type_masonry() { global $masonryPages; if(in_array(get_the_ID(),$masonryPages) || is_home()) { return 'true'; } return $masonry; }
Any help is greatly appreciated!
November 13, 2017 at 9:11 am #423287TomLead DeveloperLead DeveloperHmm, that should be fine.
Which page isn’t it working on?
November 13, 2017 at 10:13 am #423318LisaHello. I am having the same issue. Lost custom-post-type masonry when upgrading from GP Premium 1.4.3 to 1.5.2.
http://sbsginteriordesign.barkingdogweb.com/testimonials/
// add masonry to custom post type when enabled for blog add_filter( 'generate_blog_masonry','sbsg_testimonials_masonry' ); function sbsg_testimonials_masonry( $masonry ) { if ( is_post_type_archive( 'testimonials' ) ) : return 'true'; endif; return $masonry; }
Thanks!
November 13, 2017 at 10:44 pm #423735TomLead DeveloperLead DeveloperHmm, I don’t have a testimonials CPT, but I did just try this:
add_filter( 'generate_blog_masonry', 'tu_blog_masonry' ); function tu_blog_masonry( $masonry ) { if ( is_home() ) { return 'true'; } return $masonry; }
It worked as it should.
How are you adding the function? Child theme?
November 13, 2017 at 11:17 pm #423747GerhardIt’s working for standard posts. But on the pages where I use a custom post type it looks like this: https://www.schlafgutmurmel.eu/termine/
However, on these pages I’m using page templates – I guess they are missing something, a class or some structure.
November 14, 2017 at 5:07 am #423950LisaYes, my function is in functions.php of a child theme.
Since you asked, I tested on a local install by moving the function into functions.php of the parent theme instead. Still no masonry for the custom post type.
Also as a test, I created a few standard posts and a blog page. The masonry for this works even without your function, because masonry is an option in the customizer.
November 14, 2017 at 9:18 am #424209TomLead DeveloperLead DeveloperAny chance you can send me temporary admin login details, or better yet duplicate your site into a sub-folder on your website using a plugin like Duplicator?
November 14, 2017 at 9:38 am #424239LisaThanks! I’ve cloned the site here: http://playground.barkingdogweb.com/
I will create a user for you and send it to support@generatepress.com
November 14, 2017 at 9:40 am #424241TomLead DeveloperLead DeveloperPerfect – thank you! Will figure out what’s going on π
November 14, 2017 at 4:13 pm #424484TomLead DeveloperLead DeveloperI just released 1.5.3 which should fix this.
Let me know π
November 14, 2017 at 4:30 pm #424488LisaAs usual, you rule! Totally working now!
November 14, 2017 at 4:31 pm #424490TomLead DeveloperLead DeveloperAwesome! Thanks for helping π
November 16, 2017 at 7:09 am #425983GerhardExcellent, everything’s working now, thanks a lot!
November 16, 2017 at 8:38 am #426058TomLead DeveloperLead DeveloperGreat to hear! π
-
AuthorPosts
- You must be logged in to reply to this topic.