- This topic has 7 replies, 2 voices, and was last updated 2 years, 12 months ago by
Leo.
-
AuthorPosts
-
April 5, 2015 at 9:35 am #95752
anamoore
Hello! I want to use/activate masonry but only for categories. I have 6 categories. Further more, I want to show only a single widget on those categories when masonry is activated. Can you please help me?
April 5, 2015 at 11:56 pm #95911Tom
Lead DeveloperLead DeveloperComing soon!: http://generatepress.com/forums/topic/disable-masonry-for-other-content-types/#post-84372
As for showing widgets on specific categories/pages, this plugin may help: https://wordpress.org/plugins/display-widgets/
April 11, 2015 at 8:23 am #97654anamoore
I can’t figure out how to activate masonry for categories… plus not showing sidebars on them…
About the plugin, thank you very much!
April 11, 2015 at 8:49 am #97685Tom
Lead DeveloperLead DeveloperHi there,
The code snippets below will enable masonry on categories only, and remove the sidebars as well:
add_filter('generate_blog_masonry','generate_blog_enable_category_masonry'); function generate_blog_enable_category_masonry() { // If we're on a category, enable masonry if ( is_category() ) return 'true'; // Otherwise, disable it return 'false'; } add_filter('generate_sidebar_layout','generate_category_sidebar'); function generate_category_sidebar($layout) { if ( is_category() ) : return 'no-sidebar'; endif; return $layout; }
April 11, 2015 at 10:25 am #97737anamoore
thank you very much, you are very kind!
April 11, 2015 at 12:03 pm #97761Tom
Lead DeveloperLead DeveloperYou’re welcome! 🙂
October 1, 2020 at 2:21 pm #1468068computerati
Hi Tom,
Thank you for this great theme.add_filter('generate_blog_masonry','generate_blog_enable_category_masonry'); function generate_blog_enable_category_masonry() { // If we're on a category, enable masonry if ( is_category() ) return 'true'; // Otherwise, disable it return 'false'; } add_filter('generate_sidebar_layout','generate_category_sidebar'); function generate_category_sidebar($layout) { if ( is_category() ) : return 'no-sidebar'; endif; return $layout; }
where would I add this code? in which file?
I have the latest gp theme and premium installed.I am trying to create a documentation / KB kind of site and would like the categories to be displayed in masonry but with fixed width / height (clickable).
3 boxes / columns like card layout to display my selected categories and a search bar in the middle of the page.
thanks
October 1, 2020 at 2:43 pm #1468102Leo
StaffCustomer SupportThat code can be added with one of these methods:
Adding PHP: https://docs.generatepress.com/article/adding-php/Code Snippets plugin is the easiest if you aren’t using a child theme already.
Please open a new topic if you need further help with this as this topic is very old.
Thanks!
-
AuthorPosts
- You must be logged in to reply to this topic.