Changeset 15825 for trunk/wp-includes/category-template.php
- Timestamp:
- 10/17/2010 05:41:22 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r15677 r15825 11 11 * 12 12 * @since 1.0.0 13 * @ uses apply_filters() Calls 'category_link' filter on category link and category ID.13 * @see get_term_link() 14 14 * 15 15 * @param int $category_id Category ID. … … 17 17 */ 18 18 function get_category_link( $category_id ) { 19 global $wp_rewrite; 20 $catlink = $wp_rewrite->get_category_permastruct(); 21 22 if ( empty( $catlink ) ) { 23 $catlink = home_url('?cat=' . $category_id); 24 } else { 25 $category = &get_category( $category_id ); 26 if ( is_wp_error( $category ) ) 27 return $category; 28 $category_nicename = $category->slug; 29 30 if ( $category->parent == $category_id ) // recursive recursion 31 $category->parent = 0; 32 elseif ($category->parent != 0 ) 33 $category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename; 34 35 $catlink = str_replace( '%category%', $category_nicename, $catlink ); 36 $catlink = home_url( user_trailingslashit( $catlink, 'category' ) ); 37 } 38 return apply_filters( 'category_link', $catlink, $category_id ); 19 return get_term_link((int)$category_id, 'category'); 39 20 } 40 21 … … 771 752 * 772 753 * @since 2.3.0 773 * @ uses apply_filters() Calls 'tag_link' with tag link and tag ID as parameters.754 * @see get_term_link() 774 755 * 775 756 * @param int $tag_id Tag (term) ID. … … 777 758 */ 778 759 function get_tag_link( $tag_id ) { 779 global $wp_rewrite; 780 $taglink = $wp_rewrite->get_tag_permastruct(); 781 782 $tag = &get_term( $tag_id, 'post_tag' ); 783 if ( is_wp_error( $tag ) ) 784 return $tag; 785 $slug = $tag->slug; 786 787 if ( empty( $taglink ) ) { 788 $file = get_option( 'home' ) . '/'; 789 $taglink = $file . '?tag=' . $slug; 790 } else { 791 $taglink = str_replace( '%tag%', $slug, $taglink ); 792 $taglink = get_option( 'home' ) . user_trailingslashit( $taglink, 'category' ); 793 } 794 return apply_filters( 'tag_link', $taglink, $tag_id ); 760 return get_term_link( (int)$tag_id, 'post_tag'); 795 761 } 796 762
Note: See TracChangeset
for help on using the changeset viewer.