- This topic has 18 replies, 2 voices, and was last updated 4 years, 1 month ago by Leo.
-
AuthorPosts
-
March 5, 2020 at 8:28 am #1186093Karen
Hi there,
I was wondering if it was possible to set up category pages to display posts in a grid format with the featured image. I only wanted this on category pages and not my home/archive page of posts. I understand that there is WP show it plugin, but I didn’t want to have to add new pages to display this.
Thanks so much for any help you can provide,
Karen
March 5, 2020 at 9:10 am #1186129LeoStaffCustomer SupportHi there,
Just to confirm, so you want to hide the post title, excerpt and read more on category pages?
Let me know ๐
March 5, 2020 at 1:48 pm #1186388KarenHi Leo,
I don’t want to hide the post title, but I do want to hide the excerpt and read more on the category pages. If it’s possible to set it up where it can show two posts side by side on mobile, that would be great. Thanks so much for the quick response!
Karen
March 5, 2020 at 1:51 pm #1186393KarenIf it helps, this is kind of what I was thinking … https://www.mapleandmango.com/food/
If you look at this website on a mobile device, you can see two featured images side by side.
Thanks again,
karen
March 5, 2020 at 7:37 pm #1186566LeoStaffCustomer SupportTry this CSS:
.category .entry-summary { display: none; }
Adding CSS: https://docs.generatepress.com/article/adding-css/
And this PHP:
add_filter( 'generate_blog_get_column_count', function( $count ) { if ( is_category() ) { return '50'; } return $count; } );
Adding PHP: https://docs.generatepress.com/article/adding-php/
March 6, 2020 at 9:25 am #1187243KarenThanks so much. It did take away the summary on the category pages, but they are still showing as single blog posts instead of a column type grid.
Thanks again for your help though. I can try and play around with this.
March 6, 2020 at 3:39 pm #1187442LeoStaffCustomer SupportSo is the issue solved now?
I’m happy to help more if you need ๐
March 7, 2020 at 11:27 am #1188106KarenIt’s not solved. Thanks for trying to help. The blog posts on the category page still show as single posts, instead of side by side grid type format. Any other code I could try? Is it possible to put wp show it posts shortcode on category pages?
March 7, 2020 at 11:36 am #1188110KarenOk, I was playing around with this a little bit. I set up columns for pages in the customize tab. Is there any way to have the homepage (which is just an archive list of my posts) show the posts NOT in columns?
So basically, I wanted columns for the category pages and NO columns for the homepage archive.
Thanks!
karen
March 7, 2020 at 2:16 pm #1188190LeoStaffCustomer SupportMy PHP code here should set the category archives to have 2 columns:
https://generatepress.com/forums/topic/question-about-category-page-layouts/#post-1186566Did it not work? Did you make sure to add it using one of these methods?
Adding PHP: https://docs.generatepress.com/article/adding-php/March 8, 2020 at 2:40 pm #1188959KarenHi Leo,
Yes, I added the PHP via Code Snippets. But the columns are still not showing up on the category archive pages? Not sure what I’m doing wrong?
March 8, 2020 at 2:53 pm #1188973LeoStaffCustomer SupportIs the code added currently?
Did you clear and disable WP Rockets after adding it first?
March 8, 2020 at 2:55 pm #1188975KarenI didn’t disable WP Rocket, but I cleared the cache afterwards. Do I need to disable it first?
March 8, 2020 at 2:57 pm #1188978KarenAnd yes, the code is added currently.
March 8, 2020 at 3:28 pm #1188997LeoStaffCustomer SupportWe just always ask to turn the caching plugins off so we can inspect the code better:
https://www.screencast.com/t/O3NDJ5fyH0NI think I found the issue though.
Try adding these two snippets together instead:
add_filter( 'generate_blog_columns', function( $columns ) { if ( is_category( ) ) { return true; } return $columns; } ); add_filter( 'generate_blog_get_column_count', function( $count ) { if ( is_category() ) { return '50'; } return $count; } );
and make sure the Blog module is activated here:
https://docs.generatepress.com/article/installing-gp-premium/#activate-your-modules -
AuthorPosts
- You must be logged in to reply to this topic.