From 498be1cae92d37cf8c28a17bebd4ddf290ea7bb1 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 15 Dec 2014 07:32:26 +0000 Subject: [PATCH] Avoid repeatedly calling is_tax( 'post_format', '...' ) in get_the_archive_title(). see #21995. Built from https://develop.svn.wordpress.org/trunk@30854 git-svn-id: http://core.svn.wordpress.org/trunk@30844 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/general-template.php | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index e789013c48..8655ceed21 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -1151,24 +1151,26 @@ function get_the_archive_title() { $title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) ); } elseif ( is_day() ) { $title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) ); - } elseif ( is_tax( 'post_format', 'post-format-aside' ) ) { - $title = _x( 'Asides', 'post format archive title' ); - } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { - $title = _x( 'Galleries', 'post format archive title' ); - } elseif ( is_tax( 'post_format', 'post-format-image' ) ) { - $title = _x( 'Images', 'post format archive title' ); - } elseif ( is_tax( 'post_format', 'post-format-video' ) ) { - $title = _x( 'Videos', 'post format archive title' ); - } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) { - $title = _x( 'Quotes', 'post format archive title' ); - } elseif ( is_tax( 'post_format', 'post-format-link' ) ) { - $title = _x( 'Links', 'post format archive title' ); - } elseif ( is_tax( 'post_format', 'post-format-status' ) ) { - $title = _x( 'Statuses', 'post format archive title' ); - } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) { - $title = _x( 'Audio', 'post format archive title' ); - } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) { - $title = _x( 'Chats', 'post format archive title' ); + } elseif ( is_tax( 'post_format' ) ) { + if ( is_tax( 'post_format', 'post-format-aside' ) ) { + $title = _x( 'Asides', 'post format archive title' ); + } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) { + $title = _x( 'Galleries', 'post format archive title' ); + } elseif ( is_tax( 'post_format', 'post-format-image' ) ) { + $title = _x( 'Images', 'post format archive title' ); + } elseif ( is_tax( 'post_format', 'post-format-video' ) ) { + $title = _x( 'Videos', 'post format archive title' ); + } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) { + $title = _x( 'Quotes', 'post format archive title' ); + } elseif ( is_tax( 'post_format', 'post-format-link' ) ) { + $title = _x( 'Links', 'post format archive title' ); + } elseif ( is_tax( 'post_format', 'post-format-status' ) ) { + $title = _x( 'Statuses', 'post format archive title' ); + } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) { + $title = _x( 'Audio', 'post format archive title' ); + } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) { + $title = _x( 'Chats', 'post format archive title' ); + } } elseif ( is_post_type_archive() ) { $title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) ); } elseif ( is_tax() ) { @@ -1201,8 +1203,7 @@ function get_the_archive_title() { */ function the_archive_description( $before = '', $after = '' ) { $description = get_the_archive_description(); - - if ( ! empty( $description ) ) { + if ( $description ) { echo $before . $description . $after; } } @@ -1215,7 +1216,6 @@ function the_archive_description( $before = '', $after = '' ) { * @return string Archive description. */ function get_the_archive_description() { - /** * Filter the archive description. *