| 2131 | * Retrieve a post given its title. |
| 2132 | * |
| 2133 | * @uses $wpdb |
| 2134 | * |
| 2135 | * @param string $post_title Post title |
| 2136 | * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A. |
| 2137 | * @return mixed Post data if successful (type depends on $output) | Null if no posts found |
| 2138 | */ |
| 2139 | function get_post_by_title($post_title, $output = OBJECT) { |
| 2140 | global $wpdb; |
| 2141 | $post = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_title = %s AND post_type='post'", $post_title )); |
| 2142 | if ( $post ) |
| 2143 | return get_post($post, $output); |
| 2144 | |
| 2145 | return null; |
| 2146 | } |
| 2147 | |
| 2148 | /** |