Ticket #18614: 18614.2.diff
File 18614.2.diff, 4.2 KB (added by , 13 years ago) |
---|
-
wp-includes/template-loader.php
22 22 $template = false; 23 23 if ( is_404() && $template = get_404_template() ) : 24 24 elseif ( is_search() && $template = get_search_template() ) : 25 elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) : 25 26 elseif ( is_tax() && $template = get_taxonomy_template() ) : 26 27 elseif ( is_front_page() && $template = get_front_page_template() ) : 27 28 elseif ( is_home() && $template = get_home_template() ) : -
wp-includes/theme.php
793 793 } 794 794 795 795 /** 796 * Retrieve path of post type archive template in current or parent template. 797 * 798 * @since 3.4.0 799 * 800 * @return string 801 */ 802 function get_post_type_archive_template() { 803 $obj = get_post_type_object( get_query_var( 'post_type' ) ); 804 if ( ! $obj->has_archive ) 805 return ''; 806 807 return get_archive_template(); 808 } 809 810 /** 796 811 * Retrieve path of author template in current or parent template. 797 812 * 798 813 * @since 1.5.0 -
wp-includes/query.php
3023 3023 if ( empty( $post_types ) || !$this->is_post_type_archive ) 3024 3024 return (bool) $this->is_post_type_archive; 3025 3025 3026 $post_type_object = $this->get_queried_object();3026 $post_type_object = get_post_type_object( $this->get('post_type') ); 3027 3027 3028 3028 return in_array( $post_type_object->name, (array) $post_types ); 3029 3029 } -
wp-includes/general-template.php
542 542 $title = single_post_title( '', false ); 543 543 } 544 544 545 // If there's a post type archive 546 if ( is_post_type_archive() ) { 547 $post_type_object = get_post_type_object( get_query_var( 'post_type' ) ); 548 if ( ! $post_type_object->has_archive ) 549 $title = post_type_archive_title( '', false ); 550 } 551 545 552 // If there's a category or tag 546 553 if ( is_category() || is_tag() ) { 547 554 $title = single_term_title( '', false ); … … 560 567 $title = $author->display_name; 561 568 } 562 569 563 // If there's a post type archive564 if ( is_post_type_archive() )570 // Post type archives with has_archive should override terms. 571 if ( is_post_type_archive() && $post_type_object->has_archive ) { 565 572 $title = post_type_archive_title( '', false ); 573 } 566 574 567 575 // If there's a month 568 576 if ( is_archive() && !empty($m) ) { … … 661 669 if ( ! is_post_type_archive() ) 662 670 return; 663 671 664 $post_type_obj = get_queried_object(); 672 $post_type_obj = get_post_type_object( get_query_var('post_type') ); 673 665 674 $title = apply_filters('post_type_archive_title', $post_type_obj->labels->name ); 666 675 667 676 if ( $display ) … … 1633 1642 'authortitle' => __('%1$s %2$s Posts by %3$s Feed'), 1634 1643 /* translators: 1: blog name, 2: separator(raquo), 3: search phrase */ 1635 1644 'searchtitle' => __('%1$s %2$s Search Results for “%3$s” Feed'), 1645 /* translators: 1: blog name, 2: separator(raquo), 3: generic feed */ 1646 'generic' => __('%1$s %2$s %3$s Feed'), 1636 1647 ); 1637 1648 1638 1649 $args = wp_parse_args( $args, $defaults ); 1639 1650 1640 if ( is_sing le() || is_page() ) {1651 if ( is_singular() ) { 1641 1652 $id = 0; 1642 1653 $post = &get_post( $id ); 1643 1654 … … 1645 1656 $title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) ); 1646 1657 $href = get_post_comments_feed_link( $post->ID ); 1647 1658 } 1659 } elseif ( is_post_type_archive() ) { 1660 $post_type_obj = get_post_type_object( get_query_var('post_type') ); 1661 1662 $title = sprintf( $args['generic'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name ); 1663 $href = get_post_type_archive_feed_link( $post_type_obj->name ); 1648 1664 } elseif ( is_category() ) { 1649 1665 $term = get_queried_object(); 1650 1666