• 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.

Viewing 1 replies (of 1 total)
  • Thread Starter Gianfranco

    (@gian-ava)

    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”.

Viewing 1 replies (of 1 total)
  • The topic ‘Printing the name of the "taxonomy term" in taxonomy.php’ is closed to new replies.