[Resolved] Blog Masonry Layout present on non-Blog Archives

Home Forums Support [Resolved] Blog Masonry Layout present on non-Blog Archives

Home Forums Support Blog Masonry Layout present on non-Blog Archives

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1354554
    Scott

    I am using the current version of the theme (2.4.2) and GP Premium (1.10.0).

    When I enable Masonry Layout for the blog, it makes the events column on my /events page, which is an Archive, but has nothing to do with the blog, take on a skinny-column.

    If I turn off Masonry, the Events page returns to normal. That page is handled by The Events Calendar and is completely stock (no modifications). It appears to me that since this is classified as an Archive, the Masonry View CSS and JS are being loaded. And, since the HTML markup is structurally similar, it’s modifying the layout.

    Is there a way to correct this by either :

    a: Restrict the Masonry View to my blog Front Page and Blog Archives by dequeuing js/css for my Events page
    or
    b: Get the CSS to override the Masonry View CSS on my Events archive page.

    Thanks for your time.

    #1354757
    David
    Staff
    Customer Support

    Hi there,

    you can use the blog options filter to disable the masonry under different conditions:

    https://docs.generatepress.com/article/option_generate_blog_settings/

    Here’s an example of disabling masonry on a CPT – just need to add the correct name of the events post type:

    add_filter( 'option_generate_blog_settings', 'db_disable_masonry_cpt_archive' );
    function db_disable_masonry_cpt_archive( $options ) {
        if ( is_post_type_archive( 'my_custom_post_type' ) ) {
            $options['masonry'] = false;
        }
    }
    #1358636
    Scott

    Hey David –

    Thank you for the help. I tried what you had and it was close — I needed to set $options[‘column_layout’] to false and return $options…

    add_filter( 'option_generate_blog_settings', 'fabric_disable_masonry_cpt_archive' );
    function fabric_disable_masonry_cpt_archive( $options ) {
        if ( is_post_type_archive( 'tribe_events' ) ) {
    			  $options['column_layout'] = false;
            $options['masonry'] = false;
        }
    	return $options;
    }
    

    Just wanted to respond in case anyone needs to solve the same issue in the future.

    #1358779
    David
    Staff
    Customer Support

    Glad to hear that – thanks for sharing your solution.

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