get_post_mime_type() from skeltoac.

git-svn-id: http://svn.automattic.com/wordpress/trunk@3169 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-11-19 20:08:21 +00:00
parent ed7b824257
commit 51b8a36906
1 changed files with 13 additions and 7 deletions

View File

@ -742,13 +742,8 @@ function generate_page_rewrite_rules() {
} }
} }
function get_post_status($post = false) { function get_post_status($ID = '') {
global $wpdb, $posts; $post = get_post($ID);
if ( false === $post )
$post = $posts[0];
elseif ( (int) $post )
$post = get_post($post, OBJECT);
if ( is_object($post) ) { if ( is_object($post) ) {
if ( ('attachment' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) ) if ( ('attachment' == $post->post_status) && $post->post_parent && ($post->ID != $post->post_parent) )
@ -759,4 +754,15 @@ function get_post_status($post = false) {
return false; return false;
} }
// Takes a post ID, returns its mime type.
function get_post_mime_type($ID = '') {
$post = & get_post($ID);
if ( is_object($post) )
return $post->post_mime_type;
return false;
}
?> ?>