Use $wp_query->get_queried_object() in single_post_title(). Fixes #11731

git-svn-id: http://svn.automattic.com/wordpress/trunk@13502 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-02-28 13:00:27 +00:00
parent 57c4fe34bd
commit 9f1b20ba95
1 changed files with 11 additions and 11 deletions

View File

@ -640,17 +640,17 @@ function wp_title($sep = '»', $display = true, $seplocation = '') {
* @return string|null Title when retrieving, null when displaying or failure.
*/
function single_post_title($prefix = '', $display = true) {
global $wpdb, $post;
if ( ! $post ) {
$p = get_query_var('p');
$name = get_query_var('name');
if ( intval($p) || '' != $name ) {
if ( !$p )
$p = $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_name = %s", $name));
$post = & get_post($p);
}
}
$title = apply_filters('single_post_title', $post->post_title, $post);
global $wp_query, $post;
if ( ! $post )
$_post = $wp_query->get_queried_object();
else
$_post = $post;
if ( !isset($_post->post_title) )
return;
$title = apply_filters('single_post_title', $_post->post_title, $_post);
if ( $display )
echo $prefix . $title;
else