Ticket #13058: 13058-3.diff
| File 13058-3.diff, 3.0 KB (added by blepoxp, 3 years ago) |
|---|
-
wp-includes/link-template.php
568 568 * @return string Link to the feed for the category specified by $cat_id. 569 569 */ 570 570 function get_category_feed_link($cat_id, $feed = '') { 571 $cat_id = (int) $cat_id; 571 return get_taxonomy_feed_link($cat_id, 'category', $feed); 572 } 572 573 573 $category = get_category($cat_id); 574 /** 575 * Retrieve the feed link for a taxonomy. 576 * 577 * Returns a link to the feed for all post in a given taxonomy. A specific feed 578 * can be requested or left blank to get the default feed. 579 * 580 * @since 3.0 581 * 582 * @param int $term_id ID of a category. 583 * @param string $taxonomy Optional. Taxonomy of $term_id 584 * @param string $feed Optional. Feed type. 585 * @return string Link to the feed for the taxonomy specified by $term_id and $taxonomy. 586 */ 587 function get_taxonomy_feed_link( $term_id, $taxonomy='category', $feed = '' ) { 588 global $wp_rewrite; 589 590 $term_id = ( int ) $term_id; 574 591 575 if ( empty($category) || is_wp_error($category) ) 592 $term = get_term( $term_id, $taxonomy ); 593 594 if ( empty( $term ) || is_wp_error( $term ) ) 576 595 return false; 577 596 578 if ( empty( $feed) )597 if ( empty( $feed ) ) 579 598 $feed = get_default_feed(); 580 599 581 $permalink_structure = get_option( 'permalink_structure');600 $permalink_structure = get_option( 'permalink_structure' ); 582 601 583 602 if ( '' == $permalink_structure ) { 584 $link = home_url("?feed=$feed&cat=" . $cat_id); 603 $link = home_url(); 604 if ( 'category' == $taxonomy ) { 605 $link = add_query_arg( array( 'feed' => $feed, 'cat' => $term_id ), $link ); 606 } else { 607 $t = get_taxonomy( $taxonomy ); 608 $link = add_query_arg( array( 'feed' => $feed, $t->query_var => $term->slug ), $link ); 609 } 585 610 } else { 586 $link = get_ category_link($cat_id);587 if ( $feed == get_default_feed() )611 $link = get_term_link( $term_id, $term->taxonomy ); 612 if ( $feed == get_default_feed() ) 588 613 $feed_link = 'feed'; 589 614 else 590 615 $feed_link = "feed/$feed"; 591 616 592 $link = trailingslashit( $link) . user_trailingslashit($feed_link, 'feed');617 $link = trailingslashit( $link ) . user_trailingslashit( $feed_link, 'feed' ); 593 618 } 594 619 595 $link = apply_filters('category_feed_link', $link, $feed); 620 if ( 'category' == $taxonomy ) 621 $link = apply_filters( 'category_feed_link', $link, $feed ); 622 else 623 $link = apply_filters( 'taxonomy_feed_link', $link, $feed, $taxonomy ); 624 596 625 597 626 return $link; 598 627 } -
wp-includes/classes.php
1452 1452 if ( empty($feed_image) ) 1453 1453 $link .= '('; 1454 1454 1455 $link .= '<a href="' . get_ category_feed_link($category->term_id, $feed_type) . '"';1455 $link .= '<a href="' . get_taxonomy_feed_link( $category->term_id, $category->taxonomy, $feed_type ) . '"'; 1456 1456 1457 1457 if ( empty($feed) ) 1458 1458 $alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';