• Resolved nickaster

    (@nickaster)


    Howdy, I created a tag.php page to customize my tag archives. I put the following code on the page:

    <?php tag_description( $tagID ); ?>

    Thinking it would show my tag descriptions, but it shows nothing. Is something wrong with that code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • From my notes, this should help:

    <?php
    $term_id='';
      if ( is_tag() ) {
        $term_id = get_query_var('tag_id');
        $taxonomy = 'post_tag';
        $title = 'Tag: ';
      }
      if ( is_category() ) {
        $term_id = get_query_var('cat');
        $taxonomy = 'category';
        $title = 'Category: ';
      }
    if ($term_id) {
      $args ='include=' . $term_id;
      $terms = get_terms( $taxonomy, $args );
      if ($terms) {
        foreach($terms as $term) {
          if ($term->count > 0) {
            echo '<p>' . $title . '<a href="' . get_term_link( $term->term_id, $taxonomy ) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a> has ' . $term->count . ' post(s). </p> ';
          }
        }
      }
    }
    ?>

    Thread Starter nickaster

    (@nickaster)

    ummm…. okay. shoot man, I really don’t know php well enough to make even a dent in that. Why would I need that much code just to show the description of a tag? All I want to do is slap the description of the tag on its page, if the description exists.

    I just tried slapping that code exacting in the template and it just kills the page – stops loading completely when that code strikes.

    Thread Starter nickaster

    (@nickaster)

    Well, I’ll be dammed… here it is:

    <?php echo tag_description(); ?>

    I just needed the “echo” in there. Thanks for the kick in the right direction.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Tag Description on Tag.php’ is closed to new replies.