I have used a code from the help forum to adjust the number of columns of a custom post types (“template”). This worked. I now see 4 columns in the respective archive. Unfortunately the number of columns in the general post archive (set to 3 in customizer in Generatepress theme) has also changed to 4. How can I ensure that the 4 columns is only applied to the CPT?
add_filter( 'generate_blog_columns','tu_portfolio_columns' );
function tu_portfolio_columns( $columns ) {
if ( is_post_type_archive( 'template' ) ) {
return true;
}
return $columns;
}
add_filter( 'generate_blog_get_column_count', function( $column_width ) {
if ( is_archive ('template') ) {
return '25';
}
return $column_width;
} );
Thanks in advance!