2
votes

I am using Advanced Custom Fields in wordpress and have created 2 taxonomies for the Custom Post type - Attorney. The Taxonomies are Practice Areas and Admitted to Practice. I also have a template created to display the information for each attorney called single-attorneys.php

I am using the code:

< ? php the_taxonomies('practice_areas'); ? >

But I want to display each Taxonomy in a seperate line not all together like you see here in the Admitted to Practice area

What am I missing?

3
Ok so I am using: <?php the_taxonomies( $post->id, 'practice_areas', 'Practice Areas:', ', ', '') ?> - See page: glankler.biz/attorneys/jeremy-g-alpert and scroll to the bottom - which is working. I would like to remove the first Practice area and the and between them. I would like to add a break between all listed taxonomies. Is this possible? Thanks again for all the help this code is a little beyond my experience.Krissi williams

3 Answers

1
votes

I think you need like this:

<?php get_the_term_list( $post->id, 'practice_areas', 'Practice Areas:', ', ', '') ?>

and

<?php get_the_term_list( $post->id, 'admitted_to_practice', 'Admitted to Practice:', ', ', '') ?>
0
votes

You may adjust the output format of the_taxonomies by "before" or "after" argument

<? php the_taxonomies( "after=<br>" ); ?>
0
votes

The template tag "the_taxonomies" takes 5 parameters

1.Post 2.before 3.sep 4.after 5.template

Think you have passed the wrong parameter(the taxonomy itself ).

Echos "get_the_taxonomies" after parsing the args and joining seperator

To get rid of taxonomy Name , just edit the template param from the default '%s: %l.' to '% %l' . As that is parsed through wp_sprintf , a wrapper for sprintf the 'and' will still be there . There is a filter to wp_sprintf_l to change this and the code will look like this.

function remove_and( $separators ) {
    $separators[ 'between_last_two' ] = ' ';
    return $separators;
}
add_filter( 'wp_sprintf_l', 'remove_and' );

Think you should better use "get_the_term_list " where you can style it as you wish.