/** * Displays the metaboxes for a given post type * * @return void * @author Jared Lang **/ function show_meta_boxes($post) { #Register custom post types metaboxes foreach (installed_custom_post_types() as $custom_post_type) { if (post_type($post) == $custom_post_type->options('name')) { $meta_box = $custom_post_type->metabox(); break; } } return _show_meta_boxes($post, $meta_box); }
static function get_url($form) { if (is_numeric($form)) { $form = get_post($form); } $prefix = post_type($form); $x = get_post_meta($form->ID, $prefix . '_url', True); $y = wp_get_attachment_url(get_post_meta($form->ID, $prefix . '_file', True)); if (!$x and !$y) { return '#'; } return $x ? $x : $y; }
/** * Really get the post type. A post type of revision will return its parent * post type. * * @return string * @author Jared Lang * */ function post_type($post) { if (is_int($post)) { $post = get_post($post); } // check post_type field $post_type = $post->post_type; if ($post_type === 'revision') { $parent = (int) $post->post_parent; $post_type = post_type($parent); } return $post_type; }