Site logo

Archived topic

Display custom post archive in columns

3 replies · Started by Jens on November 23, 2021

Viewing posts 1–4 of 4

Dear support team!

I am working with a three column grid that works perfectly on posts and custom post types, e.g., Courses (see https://live-parentwise-marketing.pantheonsite.io/courses/).

But it does not work on custom post category or tag archives. So I have added the code from via code snippets: https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type

add_filter( 'generate_blog_columns','tu_courses_columns' );
function tu_courses_columns( $columns ) {
    if ( is_post_type_archive( 'courses' ) ) {
        return true;
    }

    return $columns;
}

Unfortunately that still does not work: https://live-parentwise-marketing.pantheonsite.io/course_categories/raise-healthy-children/

Thanks a lot in advance!

Hi there,

try this method

add_filter( 'generate_blog_columns', function( $columns ) {
    if ( 'cpt_slug' === get_post_type() && ! is_singular() ) {
        return true;
    }

    return $columns;
} );

Change the cpt_slug to match your requirements

Glad to hear that - i'll see if that can be added :)

This archived topic is closed to new replies.