Site logo

Archived topic

How To Disable Sidebar Per Category

5 replies · Started by Sharif on May 13, 2017

Viewing posts 1–6 of 6

Hi,
Is there any solution how to disable sidebars per category?
Regards,

Thanks Leo,
Cool. Solved my problem.
Here comes another question in my mind.
Is there any snippet if I disable sidebar per category it will be disabled authomatically in all posts of that category so I should not go post per post to disable sidebar?
Regards,

Hi,
I want to disable sidebar in more than one category using snippet provided in this URL:
https://docs.generatepress.com/article/sidebar-layout/#using-a-function
I see that sidebar is disabled in one category but not in all of them.
I also added three sniipets for three categories seperately but code snippet plugin did not accept more than one.
I have three categories and slugs are math, physics and chemistry and changed if ( is_category() ) to if ( is_category('math','physics','chemistry') ) but it did not work for all of them.
Regards,

You could do this:

if ( is_category( array( 'test', 'example', 20, 'one-more' ) ) ) {
    return false;
}
This archived topic is closed to new replies.