get_page_by_title()

git-svn-id: http://svn.automattic.com/wordpress/trunk@4425 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2006-10-26 19:55:10 +00:00
parent c476029674
commit 209ca583ff
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;