Archived topic
Custom taxonomies
9 replies · Started by Matteo on May 8, 2020
Hello,
I'd like to display the custom taxonomy archives in two columns instead of one.
Eg.:
https://china-underground.com/wp/collection/johnnie-to/
I'd like to display the filmography of each director with a two column layout, instead having just one column.
How can I do this?
Thanks again for your amazing template
Hi there,
Is this what you are looking for?
https://docs.generatepress.com/article/using-columns-in-the-blog/#adding-columns-to-your-custom-post-type
Let me know :)
Hi,
thanks! Do I need to add it via php snippet?
Best
Hi there,
yes the add_filter code is a PHP Snippet ... this article explains how to add:
Hello,
thanks again. In this case should I use this code in a snippet?
add_filter( 'generate_blog_get_column_count','tu_search_column_count' );
function tu_search_column_count( $count ) {
if ( is_tax() ) {
return 50;
}
return $count;
}
Thanks
Do I need to change the tu_search_column_count to something else?
Thanks
Is this correct?
That code is correct. You do not need to change tu_search_column_count but you can do to make it more meaningful eg.
matteo_tax_column_count
Make sure to change it in both places :)
Hello,
thank you! I added and activated the snippet. However in the custom taxonomy archives I still see one column instead of two. What am I doing wrong?
Eg;
https://china-underground.com/wp/actor/andy-lau/
https://china-underground.com/wp/collection/fruit-chan/
Thanks again!
Hi there,
Try this:
add_filter( 'generate_blog_columns', function( $columns ) {
if ( is_tax() ) {
return true;
}
return $columns;
} );
add_filter( 'generate_blog_get_column_count', function( $count ) {
if ( is_tax() ) {
return '50';
}
return $count;
} );
Hello,
thank you so much! At the end I chose the 3 column layout, I think it's great:
https://china-underground.com/wp/actor/shu-qi/
Thanks again for your amazing support
Glad we could help :)