Is there any code that can make all slugs belonging to a specific taxonomy display the same way?
You can certainly do this.
Example:
add_filter( 'generate_blog_columns','tu_products_columns' );
function tu_products_columns( $columns ) {
$term = get_queried_object();
$taxonomy = $term->taxonomy;
$termSlug = $term->slug;
if ( is_post_type_archive( 'products' ) || $taxonomy == 'kind' ) {
return true;
}
return $columns;
}
The condition if ( is_post_type_archive( 'products' ) || $taxonomy == 'kind' )
checks if the current page is of products post type archive of products
or is of taxonomy kind
.
If you want to add multiple custom post type, you simply change is_post_type_archive( 'products' )
to is_post_type_archive( array( 'products', 'another_post_type_1', 'another_post_type_slug_2' ) )
.
If you want to include multiple taxonomies, create an array listing all the taxonomies you want and then have it checked by in_array() function instead of using $taxonomy == 'kind'
.
Example:
add_filter( 'generate_blog_columns','tu_products_columns' );
function tu_products_columns( $columns ) {
$term = get_queried_object();
$taxonomy = $term->taxonomy;
$termSlug = $term->slug;
$tax_list_included = array('kind','another_taxonomy1' ,'another_taxonomy2');
if ( is_post_type_archive( 'products' ) || in_array($taxonomy, $tax_list_included) ) {
return true;
}
return $columns;
}