Site logo

Archived topic

BLOG MASONRY disable on on categories

4 replies · Started by FunkyCss on October 21, 2021

Viewing posts 1–5 of 5

Hello I have created my Blog page ( Hidden Link Bellow ) Where I have enabled Masonry.

What I want to do is to disable Masonry when it comes to categories,

I have created AJAX filtering inside the blog page to show my categories as links and when click them with ajax to bring the template of category.

My issue comes with masonry when i click a link of the category to bring the posts but they are invisible.

So I want to know if there is any solution on this or if It cant be solved with enabled masonry everywhere if I can disabled it except the actuall blog page.

Now if you visit the my website you will notice that it actually works as I have disabled masonry , but I would like to have it.

Actually there is any way to reload the masonry with my ajax filtering ?

This would be the best.

Hi there,

you can disable Masonry using the option_generate_blog_settings filter;

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

for example:

add_filter( 'option_generate_blog_settings', 'db_disable_masonry_categories' );
function db_disable_masonry_categories( $options ) {
    if ( is_category() ) {
	$options['masonry'] = false;
    }
  
    return $options;
}

Hello David,

Thanks a ton for the filter , this works for my sitiuation , AJAX works and Masonry in Blog the same.

I think I have found a solution for Masonry to reload with AJAX and if it is correct I will post it here for somebody else.

Once again thank you so much for that support!

You are the best guys!!

Glad to hear that!

This archived topic is closed to new replies.