Fix $id arg processing for get_the_title(). Also, mark "Protected:" for translation. Bug 706. Props: morganiq
git-svn-id: http://svn.automattic.com/wordpress/trunk@2099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
80373058d9
commit
d3c2c2852f
|
@ -41,13 +41,17 @@ function the_title($before = '', $after = '', $echo = true) {
|
|||
|
||||
function get_the_title($id = 0) {
|
||||
global $post, $wpdb;
|
||||
$title = $post->post_title;
|
||||
|
||||
if ( 0 != $id )
|
||||
$title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID = $id");
|
||||
|
||||
if ( !empty($post->post_password) ) { // if there's a password
|
||||
$title = 'Protected: ' . $title;
|
||||
if ( 0 != $id ) {
|
||||
$id_post = $wpdb->get_row("SELECT post_title, post_password FROM $wpdb->posts WHERE ID = $id");
|
||||
$title = $id_post->post_title;
|
||||
if (!empty($id_post->post_password))
|
||||
$title = sprintf(__('Protected: %s'), $title);
|
||||
}
|
||||
else {
|
||||
$title = $post->post_title;
|
||||
if (!empty($post->post_password))
|
||||
$title = sprintf(__('Protected: %s'), $title);
|
||||
}
|
||||
return $title;
|
||||
}
|
||||
|
@ -57,7 +61,7 @@ function get_the_guid( $id = 0 ) {
|
|||
$guid = $post->guid;
|
||||
|
||||
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);
|
||||
return $guid;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue