• I have a code witch diplay list of sub-subcategories form subcategory 8, but href is “www.mypage.com/?taxonomy=&term=” only this part of this code is wrong, as U can see this link is broken. What’s wrong?

    <?php if ( is_category('8') ) {
    	       	foreach (get_the_category('cat_ID=8') as $category); ?>
    
    		<?php
    $cat = get_query_var('cat');
    $categories=get_categories('child_of='.$cat);
    if ($categories) {
      foreach($categories as $term) {
        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> ';
        echo 'Category description is:' . $term->description;
      }
    }
    ?>
    
     <?php } else	<?php if ( is_category('8') ) {
    	       	foreach (get_the_category('cat_ID=8') as $category); ?>
    
    		<?php
    $cat = get_query_var('cat');
    $categories=get_categories('child_of='.$cat);
    if ($categories) {
      foreach($categories as $term) {
        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> ';
        echo 'Category description is:' . $term->description;
      }
    }
    ?>
    
     <?php } else
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘What’s wrong with get_term_link’ is closed to new replies.