get_page_by_title()

git-svn-id: https://develop.svn.wordpress.org/trunk@4425 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-10-26 19:55:10 +00:00
parent 661e5dedc3
commit 1d570ec675
1 changed files with 10 additions and 0 deletions

View File

@ -946,6 +946,16 @@ function get_page_by_path($page_path, $output = OBJECT) {
return NULL;
}
function get_page_by_title($page_title, $output = OBJECT) {
global $wpdb;
$page_title = $wpdb->escape($page_title);
$page = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$page_title' AND post_type='page'");
if ( $page )
return get_page($page, $output);
return NULL;
}
function &get_page_children($page_id, $pages) {
global $page_cache;