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
This commit is contained in:
Matt Mullenweg 2003-12-13 17:53:42 +00:00
parent 57afaea33d
commit 781df194f5

View File

@ -73,8 +73,11 @@ function get_bloginfo($show='') {
} }
function single_post_title($prefix = '', $display = true) { function single_post_title($prefix = '', $display = true) {
global $p; global $p, $name, $wpdb, $tableposts;
if (intval($p)) { if (intval($p) || '' != $name) {
if (!$p) {
$p = $wpdb->get_var("SELECT ID FROM $tableposts WHERE post_name = '$name'");
}
$post_data = get_postdata($p); $post_data = get_postdata($p);
$title = $post_data['Title']; $title = $post_data['Title'];
$title = apply_filters('single_post_title', $title); $title = apply_filters('single_post_title', $title);