Make WordPress Core


Ignore:
Timestamp:
03/31/2007 06:16:12 AM (18 years ago)
Author:
matt
Message:

All the query stuff we need for tag= URLs to work.

File:
1 edited

Legend:

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

    r5111 r5149  
    3939    }
    4040    return apply_filters('category_link', $catlink, $category_id);
     41}
     42
     43function get_tag_link( $tag_id ) {
     44    global $wp_rewrite;
     45    $catlink = $wp_rewrite->get_category_permastruct();
     46
     47    $category = &get_category($tag_id);
     48    $category_nicename = $category->category_nicename;
     49
     50    if ( empty($catlink) ) {
     51        $file = get_option('home') . '/';
     52        $catlink = $file . '?tag=' . $category_nicename;
     53    } else {
     54
     55        $catlink = str_replace('%tag%', $category_nicename, $catlink);
     56        $catlink = get_option('home') . user_trailingslashit($catlink, 'category');
     57    }
     58    return apply_filters('tag_link', $catlink, $category_id);
    4159}
    4260
     
    183201    $return = $before;
    184202    foreach ( $tags as $tag )
    185         $tag_links[] = '<a href="' . get_category_link($tag->cat_ID) . '">' . $tag->cat_name . '</a>';
     203        $tag_links[] = '<a href="' . get_tag_link($tag->cat_ID) . '">' . $tag->cat_name . '</a>';
    186204
    187205    $tag_links = join( $sep, $tag_links );
Note: See TracChangeset for help on using the changeset viewer.