admin/mf_post.php
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)
          );
        }
      }
    }
  }
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)
          );
        }
      }
    }
  }
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 ) ) ; } } } }
Adding the metaboxes
Adding the metaboxes