Skip to main content
7 events
when toggle format what by license comment
Jul 23, 2021 at 0:41 answer added Geoff Cordner timeline score: 0
Jul 14, 2021 at 9:50 comment added Sally CJ You can put them in an array, e.g. $lists = [ get_the_term_list( ... ), get_the_term_list( ... ) ];, then join them using your divider: echo implode( ' / ', array_filter( $lists ) );. Alternatively, you can use wp_get_post_terms() to get the terms in your taxonomies, then manually loop through the array items and echo a link for each term. Just remember that, wp_get_post_terms() does not cache the results, so get_the_terms() is preferred when looping over a posts query result.
Jul 14, 2021 at 6:26 comment added Geoff Cordner @SallyCJ Thanks. That's what I'm doing now. I need to figure out how to output the divider " / " so that it only appears if both get_the_term_lists return something: <?php echo get_the_term_list( $post->ID, 'cities', '', ' / ', '' ); ?> / <?php echo get_the_term_list( $post->ID, 'policy', '', ' / ', '' ); ?>
Jul 14, 2021 at 6:00 answer added Nayan timeline score: 2
Jul 14, 2021 at 5:42 comment added Sally CJ There are the term_links-<taxonomy> and the_terms filter hooks, but how about just call the function once for each the taxonomies.. so echo get_the_term_list( $post->ID, 'policy', '', ' / ', '' ); for the policy taxonomy.
Jul 14, 2021 at 5:17 review First posts
Jul 16, 2021 at 5:12
Jul 14, 2021 at 5:15 history asked Geoff Cordner CC BY-SA 4.0