Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

Columns in custom post type archive

  • I am trying to add columns to a custom post type archive that has been create as a GP content template and displayed conditionally in the concert archive.

    //Add columns to concert archive
    add_filter( 'generate_concert_columns', function( $columns ) {
        if ( is_post_type_archive( 'concert' ) ) {
            return true;
        }
    
        return $columns;
    } );
    
    //Set concert archive columns to 2
    add_filter( 'generate_blog_get_column_count','gm_concert_column_count' );
    function gm_concert_column_count( $count  ) {
        if ( is_post_type_archive( 'concert' ) ) {
             return 50;
        }
    
        return $count;
    }

    I am not sure why I don’t get the columns in the front end, though, code should be correct, right?

  • Ah, generate_concert_columns should be generate_blog_columns, I am outta here, nothing to see, lol!

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