Site logo

Archived topic

Posts in list view and columns

3 replies · Started by John on August 13, 2021

Viewing posts 1–4 of 4

Hi all,

On my website I would like to have on all pages the posts in list view, except for one page. On this one I want the posts of one category in grid-view.

How can I arrange that?

Like tho hear from you.

Kind regards
John

Hi there,

The simplest method would be to set up the Customizer > Layout > Blog for the Grid view.

Then you can use this filter to enable/disable the feature.

https://docs.generatepress.com/article/generate_blog_columns/

For example this snippet will disable the Columns on ALL archives apart from the Category archive with your-category slug:

add_filter( 'generate_blog_columns','tu_portfolio_columns' );
function tu_portfolio_columns( $columns ) {
    if ( !is_category( 'your-category' ) ) {
        return false;
    }

    return $columns;
}

Thanks David,

I'm gonna try that.

Kind regards
John

You're welcome

This archived topic is closed to new replies.