When post_terms_<taxonomy>
dynamic data tag is used in Bricks in an element like the “Meta Data”, the linked terms are separated by commas by default.
Note: The Separator control you see in the above screenshot is not for the individual terms, but rather the items of that element.
If you would like these to be replaced with another like | or spaces or remove them completely, we can use the bricks/dynamic_data/post_terms_separator
filter like this:
add_filter( 'bricks/dynamic_data/post_terms_separator', function( $sep, $post, $taxonomy ) {
return ' | ';
}, 10, 3 );
To remove the separator(s):
add_filter( 'bricks/dynamic_data/post_terms_separator', function( $sep, $post, $taxonomy ) {
return '';
}, 10, 3 );
If you would like to limit to specific taxonomies:
add_filter( 'bricks/dynamic_data/post_terms_separator', function( $sep, $post, $taxonomy ) {
if ( $taxonomy === 'testimonial_type' ) {
return '';
}
return $sep;
}, 10, 3 );
where testimonial_type
is the name of the taxonomy.
3 comments
Álvaro Massana de Castro
In parent terms it creates a separation with a "-" of some sort. How could we change the separator for parent terms? It would be great if it could be like:
term1 (subterm1, subterm2, subterm3), term2 term1 (subterm1, subterm2, subterm3), etc. Thank you,
Niels Tieman
Would this work on relationships as well? Currently they are shown as a list.
Sridhar Katakam
Can you provide more details? using ACF or Meta Box? What's the dynamic data tag being used?