jQuery(document).ready(function($){mf_use_new_image_gallery();});"); } } /** * Adding the metaboxes */ function mf_post_add_metaboxes() { global $post,$mf_post_values; //if the user are going to add a new link //the var $post is not defined and we do nothing if(!isset($post)) { return false; } $mf_post_values = $this->mf_get_post_values($post->ID); //Getting the post types $post_types = $this->mf_get_post_types( array(), 'names' ); foreach ( $post_types as $post_type ){ if ( post_type_supports($post_type, 'page-attributes') && $post_type != 'page' ) { // If the post type has page-attributes we are going to add // the meta box for choice a template by hand // this is because wordpress don't let choice a template // for any non-page post type add_meta_box( 'mf_template_attribute', __('Template'), array( &$this, 'mf_metabox_template' ), $post_type, 'side', 'default' ); } if( !mf_custom_fields::has_fields($post_type) ) { continue; } //getting the groups (each group is a metabox) $groups = $this->get_groups_by_post_type($post_type); //creating the metaboxes foreach( $groups as $group ) { if( $this->group_has_fields($group['id'] ) ) { add_meta_box( 'mf_'.$group['id'], $group['label'], array( &$this, 'mf_metabox_content' ), $post_type, 'normal', 'default', array( 'group_info' => $group) ); } } } } /** * Fill a metabox with custom fields */ function mf_metabox_content( $post, $metabox ) { global $mf_domain, $mf_post_values; //Getting the custom fields for this metabox $custom_fields = $this->get_custom_fields_by_group($metabox['args']['group_info']['id']); $group_id = $metabox['args']['group_info']['id']; //default markup ?>