From 781df194f594ec73a59f2dac7e30f2bb4fc1d48a Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Sat, 13 Dec 2003 17:53:42 +0000 Subject: [PATCH] Fix to have post title where post_name is specified but post ID is not. git-svn-id: https://develop.svn.wordpress.org/trunk@610 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/template-functions.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/template-functions.php b/wp-includes/template-functions.php index 4be867a471..bc513a3ff6 100644 --- a/wp-includes/template-functions.php +++ b/wp-includes/template-functions.php @@ -73,8 +73,11 @@ function get_bloginfo($show='') { } function single_post_title($prefix = '', $display = true) { - global $p; - if (intval($p)) { + global $p, $name, $wpdb, $tableposts; + if (intval($p) || '' != $name) { + if (!$p) { + $p = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_name = '$name'"); + } $post_data = get_postdata($p); $title = $post_data['Title']; $title = apply_filters('single_post_title', $title);