From d9d9fedb7a02d82bcfdfa1f1289bbbb5a9cdefc4 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Sat, 19 Nov 2005 20:08:21 +0000 Subject: [PATCH] get_post_mime_type() from skeltoac. git-svn-id: https://develop.svn.wordpress.org/trunk@3169 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions-post.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/wp-includes/functions-post.php b/wp-includes/functions-post.php index 872c029399..517f735ae6 100644 --- a/wp-includes/functions-post.php +++ b/wp-includes/functions-post.php @@ -742,13 +742,8 @@ function generate_page_rewrite_rules() { } } -function get_post_status($post = false) { - global $wpdb, $posts; - - if ( false === $post ) - $post = $posts[0]; - elseif ( (int) $post ) - $post = get_post($post, OBJECT); +function get_post_status($ID = '') { + $post = get_post($ID); if ( is_object($post) ) { 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; } + +// 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; +} + ?>