[Resolved] Question about Category Page Layouts

Home Forums Support [Resolved] Question about Category Page Layouts

Home Forums Support Question about Category Page Layouts

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #1186093
    Karen

    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

    #1186129
    Leo
    Staff
    Customer Support

    Hi there,

    Just to confirm, so you want to hide the post title, excerpt and read more on category pages?

    Let me know ๐Ÿ™‚

    #1186388
    Karen

    Hi 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

    #1186393
    Karen

    If 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

    #1186566
    Leo
    Staff
    Customer Support

    Try 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/

    #1187243
    Karen

    Thanks 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.

    #1187442
    Leo
    Staff
    Customer Support

    So is the issue solved now?

    I’m happy to help more if you need ๐Ÿ™‚

    #1188106
    Karen

    It’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?

    #1188110
    Karen

    Ok, 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

    #1188190
    Leo
    Staff
    Customer Support

    My PHP code here should set the category archives to have 2 columns:
    https://generatepress.com/forums/topic/question-about-category-page-layouts/#post-1186566

    Did it not work? Did you make sure to add it using one of these methods?
    Adding PHP: https://docs.generatepress.com/article/adding-php/

    #1188959
    Karen

    Hi 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?

    #1188973
    Leo
    Staff
    Customer Support

    Is the code added currently?

    Did you clear and disable WP Rockets after adding it first?

    #1188975
    Karen

    I didn’t disable WP Rocket, but I cleared the cache afterwards. Do I need to disable it first?

    #1188978
    Karen

    And yes, the code is added currently.

    #1188997
    Leo
    Staff
    Customer Support

    We just always ask to turn the caching plugins off so we can inspect the code better:
    https://www.screencast.com/t/O3NDJ5fyH0N

    I 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

Viewing 15 posts - 1 through 15 (of 19 total)
  • You must be logged in to reply to this topic.