A little clarification:
- taxonomy is a container of terms
- term is the classification of an object (post, project, property)
“Post Categories” is a taxonomy. The Categories inside are
terms.
UPDATE
For single posts:
Use the code you posted, in the single.php
file (or the template file for this custom post type), but you should change ‘custom taxonomy name
‘ to the correct taxonomy slug.
You can easily get the slug, by going in the backend, then go in the taxonomy page as you normally would to add more terms.
In the url you’ll see the slug of the taxonomy after &taxonomy=
eg.
http://www.example.com/wp-admin/edit-tags.php?taxonomy=the_taxonomy_nameis_here&post_type=properties
Make sure that it’s after the beginning of the loop if(have_posts()): while(have_posts()) : the_post()
For term pages:
Use this code in the taxonomy page (eg. category.php
, archive.php
or what your template uses for this taxonomy)
global $wp_query;
$term = $wp_query->queried_object;
echo '<h1>'.$term->name.'</h1>';