gian-ava
Member
Posted 1 year ago #
I just need to print the "name" of the taxonomy term in taxonomy.php.
I want to write: Sorting events in "taxonomy-name"
I read all there is out there in the Codex (get_term) and I thought that this should work.
<?php
$term = get_term( 'countries', 'agenda' );
$name = $term->name;
print_r($name);
?>
But it doesn't.
This should be such a basic thing to achieve, but I am wasting hours on it.
gian-ava
Member
Posted 1 year ago #
Also trying this:
<?php if( term_exists( 'countries', 'agenda' ) ) { echo 'This is by country'; } ?>
<?php if( term_exists( 'martial_arts', 'agenda' ) ) { echo 'This is by style'; } ?>
But it doesn't print anything.
And this:
<?php if( get_term( 'countries', 'agenda' ) ) { echo 'This is by country'; } ?>
<?php if( get_term( 'martial_arts', 'agenda' ) ) { echo 'This is by style'; } ?>
But it prints it both, wether the taxonomy is "countries" or "martial_arts".