• Hi
    I have outputed the Taxonomy for a post item using the_taxonomies(); but it also outputs ‘Tags:’ as well first then the taxonomy.

    Is it possible to get rid of the ‘Tags:’ bit and just show the actual Taxonomy?

    Kind regards

    Colin

Viewing 2 replies - 1 through 2 (of 2 total)
  • Either a CSS trick might hide it or you could dig around in the code and excise that string but…

    Hacking the core ‘ain’t smart’. The next update will replace it again if that section gets changed.

    So, look at a function for the child side of your theme or else a plugin.

    Thread Starter ecohostingservices

    (@ecohostingservices)

    Thanks for your reply.

    I have looked around and found similar code but is there a way of shorting it as I have 2 custom taxonomies.

    <?php
         $terms_servant = get_the_terms( get_the_ID(), 'servant');
         $terms_gentry = get_the_terms( get_the_ID(), 'gentry');
         if ( !empty( $terms_servant ) || !empty($terms_gentry) && !is_wp_error( $terms ) ) {
           if ($terms_servant) {
              echo "<ul>";
              foreach ( $terms_servant as $term ) {
                 echo "<li>" . $term->name . "</li>";
                 }
           }
           echo "</ul>";
           if ($terms_gentry) {
                echo "<ul>";
                foreach ( $terms_gentry as $term ) {
                   echo "<li>" . $term->name . "</li>";
                }
           }
           echo "</ul>"; 
          }
    ?>

    It just seems that I am repeating some of the code, it does work but needs some styling which shouldn’t be a problem.

    I could have used ‘else’ instead of the 2 if statements and at the end have the closing ‘‘.

    Thanks

    Colin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Getting the Taxonomy for a Post but does it have to show ‘Tags:’?’ is closed to new replies.