Archived topic
Customize Category Archive and Blog Post page separately
5 replies · Started by Victoria on September 13, 2020
I'd like my blog post page to be a single column. I'd like my category page to have 2 columns and a masonry grid. Is there a way to customize them separately? Right now, my blog and category page both change when I am adjusting the blog layout customizer.
https://thebuildits.com/category/diy-projects/
https://thebuildits.com/blog/
Hi there,
All the blog options in the customizer are filterable with these two filters:
https://docs.generatepress.com/article/option_generate_blog_settings/
https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns
See some examples of the usages:
https://generatepress.com/forums/search/option_generate_blog_settings/
Let me know if you need help with the code :)
Okay, that makes sense. Yes, I'd love some help with the code, please! I'd like to get my category page 'DIY Projects' to be 2 columns, in a masonry grid, with 'read more' buttons. If it's possible I'd like the first post to be featured. Thanks for helping a newbie like me!
Try this PHP snippet:
add_filter( 'generate_blog_get_column_count', function( $count ) {
if ( is_category( 'diy-projects' ) {
return '50';
}
return $count;
} );
add_filter( 'option_generate_blog_settings', function( $options ) {
if ( is_category( 'diy-projects' ) ) {
$options['column_layout'] = true;
$options['featured_column'] = true;
$options['masonry'] = true;
}
return $options;
} );
Adding PHP: https://docs.generatepress.com/article/adding-php/
The read more buttons should still apply as I see them on the Blog page as well.
Let me know if this helps :)
That was perfect. Thanks so much!
No problem :)