Site logo

Archived topic

Category page: show all posts as grid/masonry/list for only a specific category

5 replies · Started by Luca on March 20, 2021

Viewing posts 1–6 of 6

Hello,
I'd like to accomplish something like this: https://www.ortodacoltivare.it/ortaggi.html

For one particular category I'd like to list all the posts belonging to it.
I don't mind the type of the list, could be grid or masonry or even a simple list like in the example above.

Is it something already built in GeneratePress? I didn't find anything...
If it isn't, could you please help me achieve this effect? I got basic CSS/HTML/PHP knowledge.

Thank you.

Hi Luca,

Actually with GP Premium 2.0 (open for testing now) and Generateblocks plugin as block editor, it's not difficult to achieve.

Here's a demo video, you can use different content template for different categories.
https://www.youtube.com/watch?v=8byA37OTBRg&ab_channel=GeneratePress

But customizer still controls the grid number, you'll need some CSS to reduce or increase grid numbers in the end. We can help with that once the structure is built.

Let me know if it helps.

Awesome, exactly what I need!
But I don't want to update to an alpha or beta version so I'll wait for it being stable. Do you have a scheduled date?
Can you suggest an alternative if it'll not be ready in few weeks?
Thank you.

Yes, the new feature is very powerful :)

We don't have exact release date yet Unfortuanly, I would guess around 3 weeks, but it really depends on the testing result.

We'll definitely be announcing it when it's released.

Hi Ying,
just installed GP Premium 2.0.2 and watched some tutorials on your YouTube channel.
Awesome!

Definitely would like to know how to built something like in the first post.

Could you help me out to override grid and pagination mechanism?
Please keep in mind it should be used only for a specific category.

Thank you so much.

Hi there,

first off you can change the number of columns for a specific category using this PHP Snippet:

add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
    if ( is_category('your-category-slug') ) {
        return 33;
    }

    return $count;
}

Just change the 33 ( 3 columns ) to a value you require, eg. 25 would be 4 columns.

For the post style for that archive - this video explains how to set that up:

https://www.youtube.com/watch?v=-ZTQP_KA2xE&t=20s

You simply need to set the Block Elements display rules to the Post Category you want it applied to.

This archived topic is closed to new replies.