diff --git wp-includes/general-template.php wp-includes/general-template.php
index b586762..2d83d64 100644
|
|
function wp_title($sep = '»', $display = true, $seplocation = '') { |
577 | 577 | $title = single_post_title( '', false ); |
578 | 578 | } |
579 | 579 | |
| 580 | // If there's a post type archive |
| 581 | if ( is_post_type_archive() ) { |
| 582 | $post_type_object = get_post_type_object( get_query_var( 'post_type' ) ); |
| 583 | if ( ! $post_type_object->has_archive ) |
| 584 | $title = post_type_archive_title( '', false ); |
| 585 | } |
| 586 | |
580 | 587 | // If there's a category or tag |
581 | 588 | if ( is_category() || is_tag() ) { |
582 | 589 | $title = single_term_title( '', false ); |
… |
… |
function wp_title($sep = '»', $display = true, $seplocation = '') { |
595 | 602 | $title = $author->display_name; |
596 | 603 | } |
597 | 604 | |
598 | | // If there's a post type archive |
599 | | if ( is_post_type_archive() ) |
| 605 | // Post type archives with has_archive should override terms. |
| 606 | if ( is_post_type_archive() && $post_type_object->has_archive ) |
600 | 607 | $title = post_type_archive_title( '', false ); |
601 | 608 | |
602 | 609 | // If there's a month |
… |
… |
function post_type_archive_title( $prefix = '', $display = true ) { |
696 | 703 | if ( ! is_post_type_archive() ) |
697 | 704 | return; |
698 | 705 | |
699 | | $post_type_obj = get_queried_object(); |
| 706 | $post_type_obj = get_post_type_object( get_query_var( 'post_type' ) ); |
700 | 707 | $title = apply_filters('post_type_archive_title', $post_type_obj->labels->name ); |
701 | 708 | |
702 | 709 | if ( $display ) |
… |
… |
function feed_links_extra( $args = array() ) { |
1670 | 1677 | |
1671 | 1678 | $args = wp_parse_args( $args, $defaults ); |
1672 | 1679 | |
1673 | | if ( is_single() || is_page() ) { |
| 1680 | if ( is_singular() ) { |
1674 | 1681 | $id = 0; |
1675 | 1682 | $post = get_post( $id ); |
1676 | 1683 | |
… |
… |
function feed_links_extra( $args = array() ) { |
1678 | 1685 | $title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], esc_html( get_the_title() ) ); |
1679 | 1686 | $href = get_post_comments_feed_link( $post->ID ); |
1680 | 1687 | } |
| 1688 | } elseif ( is_post_type_archive() ) { |
| 1689 | $post_type_obj = get_post_type_object( get_query_var( 'post_type' ) ); |
| 1690 | $title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name ); |
| 1691 | $href = get_post_type_archive_feed_link( $post_type_obj->name ); |
1681 | 1692 | } elseif ( is_category() ) { |
1682 | 1693 | $term = get_queried_object(); |
1683 | 1694 | |
diff --git wp-includes/query.php wp-includes/query.php
index 04286aa..d5e0b67 100644
|
|
class WP_Query { |
3099 | 3099 | * @return bool |
3100 | 3100 | */ |
3101 | 3101 | function is_post_type_archive( $post_types = '' ) { |
3102 | | if ( empty( $post_types ) || !$this->is_post_type_archive ) |
| 3102 | if ( empty( $post_types ) || ! $this->is_post_type_archive ) |
3103 | 3103 | return (bool) $this->is_post_type_archive; |
3104 | 3104 | |
3105 | | $post_type_object = $this->get_queried_object(); |
| 3105 | $post_type_object = get_post_type_object( $this->get( 'post_type' ) ); |
3106 | 3106 | |
3107 | 3107 | return in_array( $post_type_object->name, (array) $post_types ); |
3108 | 3108 | } |
diff --git wp-includes/template-loader.php wp-includes/template-loader.php
index 7051f34..81de956 100644
|
|
if ( defined('WP_USE_THEMES') && WP_USE_THEMES ) : |
26 | 26 | $template = false; |
27 | 27 | if ( is_404() && $template = get_404_template() ) : |
28 | 28 | elseif ( is_search() && $template = get_search_template() ) : |
| 29 | elseif ( is_post_type_archive() && $template = get_post_type_archive_template() ) : |
29 | 30 | elseif ( is_tax() && $template = get_taxonomy_template() ) : |
30 | 31 | elseif ( is_front_page() && $template = get_front_page_template() ) : |
31 | 32 | elseif ( is_home() && $template = get_home_template() ) : |
diff --git wp-includes/template.php wp-includes/template.php
index 5bee8ad..78557e8 100644
|
|
function get_archive_template() { |
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
| 76 | * Retrieve path of post type archive template in current or parent template. |
| 77 | * |
| 78 | * @since 3.7.0 |
| 79 | * |
| 80 | * @return string |
| 81 | */ |
| 82 | function get_post_type_archive_template() { |
| 83 | $obj = get_post_type_object( get_query_var( 'post_type' ) ); |
| 84 | if ( ! $obj->has_archive ) |
| 85 | return ''; |
| 86 | |
| 87 | return get_archive_template(); |
| 88 | } |
| 89 | |
| 90 | /** |
76 | 91 | * Retrieve path of author template in current or parent template. |
77 | 92 | * |
78 | 93 | * @since 1.5.0 |