Make WordPress Core


Ignore:
Timestamp:
05/23/2007 03:57:20 AM (19 years ago)
Author:
ryan
Message:

Add get_terms() and get_term(). Move more of tagging to taxonomy. see #4189

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category-template.php

    r5444 r5521  
    312312        $counts = $tag_links = array();
    313313        foreach ( (array) $tags as $tag ) {
    314                 $counts[$tag->cat_name] = $tag->tag_count;
    315                 $tag_links[$tag->cat_name] = get_tag_link( $tag->cat_ID );
     314                $counts[$tag->name] = $tag->count;
     315                $tag_links[$tag->name] = get_tag_link( $tag->term_id );
    316316        }
    317317
     
    385385function get_tag_link( $tag_id ) {
    386386        global $wp_rewrite;
    387         $catlink = $wp_rewrite->get_tag_permastruct();
    388 
    389         $category = &get_category($tag_id);
    390         $category_nicename = $category->category_nicename;
     387        $taglink = $wp_rewrite->get_tag_permastruct();
     388
     389        $tag = &get_term($tag_id, 'post_tag');
     390        $slug = $tag->slug;
    391391
    392392        if ( empty($catlink) ) {
    393393                $file = get_option('home') . '/';
    394                 $catlink = $file . '?tag=' . $category_nicename;
     394                $taglink = $file . '?tag=' . $slug;
    395395        } else {
    396 
    397                 $catlink = str_replace('%tag%', $category_nicename, $catlink);
    398                 $catlink = get_option('home') . user_trailingslashit($catlink, 'category');
    399         }
    400         return apply_filters('tag_link', $catlink, $tag_id);
     396                $taglink = str_replace('%tag%', $slug, $taglink);
     397                $taglink = get_option('home') . user_trailingslashit($taglink, 'category');
     398        }
     399        return apply_filters('tag_link', $taglink, $tag_id);
    401400}
    402401
     
    427426        $tag_list = $before;
    428427        foreach ( $tags as $tag )
    429                 $tag_links[] = '<a href="' . get_tag_link($tag->cat_ID) . '">' . $tag->cat_name . '</a>';
     428                $tag_links[] = '<a href="' . get_tag_link($tag->term_id) . '">' . $tag->slug . '</a>';
    430429
    431430        $tag_links = join( $sep, $tag_links );
Note: See TracChangeset for help on using the changeset viewer.