Changeset 7520 for trunk/wp-includes/category-template.php
- Timestamp:
- 03/26/2008 06:37:19 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/category-template.php
r7505 r7520 476 476 477 477 function get_the_tags( $id = 0 ) { 478 return apply_filters( 'get_the_tags', get_the_terms($id, 'post_tag') ); 479 } 480 481 function get_the_tag_list( $before = '', $sep = '', $after = '' ) { 482 return apply_filters( 'the_tags', get_the_term_list(0, 'post_tag', $before, $sep, $after) ); 483 } 484 485 function the_tags( $before = 'Tags: ', $sep = ', ', $after = '' ) { 486 return the_terms( 0, 'post_tag', $before, $sep, $after ); 487 } 488 489 function get_the_terms( $id = 0, $taxonomy ) { 478 490 global $post; 479 491 … … 486 498 $id = (int) $post->ID; 487 499 488 $tags = get_object_term_cache($id, 'post_tag'); 489 if ( false === $tags ) 490 $tags = wp_get_object_terms($id, 'post_tag'); 491 492 $tags = apply_filters( 'get_the_tags', $tags ); 493 if ( empty( $tags ) ) 500 $terms = get_object_term_cache($id, $taxonomy); 501 if ( false === $terms ) 502 $terms = wp_get_object_terms($id, $taxonomy); 503 504 if ( empty( $terms ) ) 494 505 return false; 495 return $tags; 496 } 497 498 function get_the_tag_list( $before = '', $sep = '', $after = '' ) { 499 $tags = get_the_tags(); 500 501 if ( empty( $tags ) ) 506 507 return $terms; 508 } 509 510 function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) { 511 $terms = get_the_terms($id, $taxonomy); 512 513 if ( is_wp_error($terms) ) 514 return $terms; 515 516 if ( empty( $terms ) ) 502 517 return false; 503 518 504 $tag_list = $before; 505 foreach ( $tags as $tag ) { 506 $link = get_tag_link($tag->term_id); 519 foreach ( $terms as $term ) { 520 $link = get_term_link($term, $taxonomy); 507 521 if ( is_wp_error( $link ) ) 508 522 return $link; 509 $tag_links[] = '<a href="' . $link . '" rel="tag">' . $tag->name . '</a>'; 510 } 511 512 $tag_links = join( $sep, $tag_links ); 513 $tag_links = apply_filters( 'the_tags', $tag_links ); 514 $tag_list .= $tag_links; 515 516 $tag_list .= $after; 517 518 return $tag_list; 519 } 520 521 function the_tags( $before = 'Tags: ', $sep = ', ', $after = '' ) { 522 $return = get_the_tag_list($before, $sep, $after); 523 $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>'; 524 } 525 526 $term_links = apply_filters( "term_links-$taxonomy", $term_links ); 527 528 return $before . join($sep, $term_links) . $after; 529 } 530 531 function the_terms( $id, $taxonomy, $before = '', $sep = '', $after = '' ) { 532 $return = get_the_term_list($id, $taxonomy, $before, $sep, $after); 523 533 if ( is_wp_error( $return ) ) 524 534 return false;
Note: See TracChangeset
for help on using the changeset viewer.