Fix $id arg processing for get_the_title(). Also, mark "Protected:" for translation. Bug 706. Props: morganiq
git-svn-id: https://develop.svn.wordpress.org/trunk@2099 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
adf9a63fc8
commit
871e575d73
@ -41,13 +41,17 @@ function the_title($before = '', $after = '', $echo = true) {
|
|||||||
|
|
||||||
function get_the_title($id = 0) {
|
function get_the_title($id = 0) {
|
||||||
global $post, $wpdb;
|
global $post, $wpdb;
|
||||||
$title = $post->post_title;
|
|
||||||
|
if ( 0 != $id ) {
|
||||||
if ( 0 != $id )
|
$id_post = $wpdb->get_row("SELECT post_title, post_password FROM $wpdb->posts WHERE ID = $id");
|
||||||
$title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $id");
|
$title = $id_post->post_title;
|
||||||
|
if (!empty($id_post->post_password))
|
||||||
if ( !empty($post->post_password) ) { // if there's a password
|
$title = sprintf(__('Protected: %s'), $title);
|
||||||
$title = 'Protected: ' . $title;
|
}
|
||||||
|
else {
|
||||||
|
$title = $post->post_title;
|
||||||
|
if (!empty($post->post_password))
|
||||||
|
$title = sprintf(__('Protected: %s'), $title);
|
||||||
}
|
}
|
||||||
return $title;
|
return $title;
|
||||||
}
|
}
|
||||||
@ -57,7 +61,7 @@ function get_the_guid( $id = 0 ) {
|
|||||||
$guid = $post->guid;
|
$guid = $post->guid;
|
||||||
|
|
||||||
if ( 0 != $id )
|
if ( 0 != $id )
|
||||||
$title = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE ID = $id");
|
$guid = $wpdb->get_var("SELECT guid FROM $wpdb->posts WHERE ID = $id");
|
||||||
$guid = apply_filters('get_the_guid', $guid);
|
$guid = apply_filters('get_the_guid', $guid);
|
||||||
return $guid;
|
return $guid;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user