Themes: Add the non-encoded form of the queried item slug to the template hierarchy when the slug contains non-ASCII characters.
This affects category, tag, and custom taxonomy archives, and single posts, pages, and custom post types. Fixes #37655 Built from https://develop.svn.wordpress.org/trunk@38583 git-svn-id: http://core.svn.wordpress.org/trunk@38526 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f54dafc2b7
commit
e482549183
|
@ -189,6 +189,12 @@ function get_category_template() {
|
|||
$templates = array();
|
||||
|
||||
if ( ! empty( $category->slug ) ) {
|
||||
|
||||
$slug_decoded = urldecode( $category->slug );
|
||||
if ( $slug_decoded !== $category->slug ) {
|
||||
$templates[] = "category-{$slug_decoded}.php";
|
||||
}
|
||||
|
||||
$templates[] = "category-{$category->slug}.php";
|
||||
$templates[] = "category-{$category->term_id}.php";
|
||||
}
|
||||
|
@ -219,6 +225,12 @@ function get_tag_template() {
|
|||
$templates = array();
|
||||
|
||||
if ( ! empty( $tag->slug ) ) {
|
||||
|
||||
$slug_decoded = urldecode( $tag->slug );
|
||||
if ( $slug_decoded !== $tag->slug ) {
|
||||
$templates[] = "tag-{$slug_decoded}.php";
|
||||
}
|
||||
|
||||
$templates[] = "tag-{$tag->slug}.php";
|
||||
$templates[] = "tag-{$tag->term_id}.php";
|
||||
}
|
||||
|
@ -255,6 +267,12 @@ function get_taxonomy_template() {
|
|||
|
||||
if ( ! empty( $term->slug ) ) {
|
||||
$taxonomy = $term->taxonomy;
|
||||
|
||||
$slug_decoded = urldecode( $term->slug );
|
||||
if ( $slug_decoded !== $term->slug ) {
|
||||
$templates[] = "taxonomy-$taxonomy-{$slug_decoded}.php";
|
||||
}
|
||||
|
||||
$templates[] = "taxonomy-$taxonomy-{$term->slug}.php";
|
||||
$templates[] = "taxonomy-$taxonomy.php";
|
||||
}
|
||||
|
@ -349,8 +367,13 @@ function get_page_template() {
|
|||
$templates = array();
|
||||
if ( $template && 0 === validate_file( $template ) )
|
||||
$templates[] = $template;
|
||||
if ( $pagename )
|
||||
if ( $pagename ) {
|
||||
$pagename_decoded = urldecode( $pagename );
|
||||
if ( $pagename_decoded !== $pagename ) {
|
||||
$templates[] = "page-{$pagename_decoded}.php";
|
||||
}
|
||||
$templates[] = "page-$pagename.php";
|
||||
}
|
||||
if ( $id )
|
||||
$templates[] = "page-$id.php";
|
||||
$templates[] = 'page.php';
|
||||
|
@ -409,6 +432,12 @@ function get_single_template() {
|
|||
$templates = array();
|
||||
|
||||
if ( ! empty( $object->post_type ) ) {
|
||||
|
||||
$name_decoded = urldecode( $object->post_name );
|
||||
if ( $name_decoded !== $object->post_name ) {
|
||||
$templates[] = "single-{$object->post_type}-{$name_decoded}.php";
|
||||
}
|
||||
|
||||
$templates[] = "single-{$object->post_type}-{$object->post_name}.php";
|
||||
$templates[] = "single-{$object->post_type}.php";
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.7-alpha-38582';
|
||||
$wp_version = '4.7-alpha-38583';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue