[Resolved] CPT > Changing the number of columns

Home Forums Support [Resolved] CPT > Changing the number of columns

Home Forums Support CPT > Changing the number of columns

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1923560
    Brenden

    I followed the instructions provided here – https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns, but I can’t get it to work. Here is my code.

    add_filter( 'option_generate_blog_settings', function( $settings ) {
        if ( is_post_type_archive( 'priorities' ) ) {
            $settings['columns'] = '33';
        }
    
        return $settings;
    } );

    While troubleshooting, I also tried this code below which did work, but I don’t want to use the Customizer setting because I need the CPT to be different from the Posts.

    add_filter( 'generate_blog_columns','tu_portfolio_columns' );
    function tu_portfolio_columns( $columns ) {
        if ( is_post_type_archive( 'priorities' ) ) {
            return true;
        }
    
        return $columns;
    }
    #1923564
    Leo
    Staff
    Customer Support

    Hi there,

    Not sure if I fully understand.

    You will need both of those snippets in order to apply columns to CPT.

    The code should not change what you have in the customizer though?

    Let me know what I’m missing here.

    #1923568
    Brenden

    Ah, that makes sense. My problem was that I was only trying one of those snippets at a time, but not both at the same time. From the documentation it was not clear to me that I needed to use both of those snippets together.

    Everything is working as desired now though. Thank you!

    #1923572
    Leo
    Staff
    Customer Support

    No problem 🙂

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