admin/mf_posttype.php
public function edit_post_type() {

    if(!isset($_GET['post_type']) ){
      $this->mf_flash( 'Oops! something was wrong, you will be redirected a safe place in a few seconds' );
    }

    $post_type = $this->get_post_type($_GET['post_type']);

    if( !$post_type ){
      $this->mf_flash('error');
    }else{

      $data = $this->fields_form();

      $post_type_support = array();
      if( isset($post_type['support']) ){
        foreach($post_type['support'] as $k => $v){
          array_push($post_type_support,$k);
        }
        $data['posttype_support'] = $post_type_support;
      }

      $post_type_taxonomy = array();
      if( isset($post_type['taxonomy']) ){
        foreach($post_type['taxonomy'] as $k => $v){
          array_push($post_type_taxonomy,$k);
        }
        $data['posttype_taxonomy'] = $post_type_taxonomy;
      }
      // update fields
      $perm = array('core','option','label');
      foreach($post_type as $key => $value){
        if( in_array($key,$perm) ){
          foreach($value as $id => $val){
            $data[$key][$id]['value'] = $val;
          }
        }
      }

      $this->form_post_type($data);
    }
  }
public function edit_post_type() {

    if(!isset($_GET['post_type']) ){
      $this->mf_flash( 'Oops! something was wrong, you will be redirected a safe place in a few seconds' );
    }

    $post_type = $this->get_post_type($_GET['post_type']);

    if( !$post_type ){
      $this->mf_flash('error');
    }else{

      $data = $this->fields_form();

      $post_type_support = array();
      if( isset($post_type['support']) ){
        foreach($post_type['support'] as $k => $v){
          array_push($post_type_support,$k);
        }
        $data['posttype_support'] = $post_type_support;
      }

      $post_type_taxonomy = array();
      if( isset($post_type['taxonomy']) ){
        foreach($post_type['taxonomy'] as $k => $v){
          array_push($post_type_taxonomy,$k);
        }
        $data['posttype_taxonomy'] = $post_type_taxonomy;
      }
      // update fields
      $perm = array('core','option','label');
      foreach($post_type as $key => $value){
        if( in_array($key,$perm) ){
          foreach($value as $id => $val){
            $data[$key][$id]['value'] = $val;
          }
        }
      }

      $this->form_post_type($data);
    }
  }
public function edit_post_type ( ) { if ( ! isset ( $ _GET [ 'post_type' ] ) ) { $ this -> mf_flash ( 'Oops! something was wrong, you will be redirected a safe place in a few seconds' ) ; } $ post_type = $ this -> get_post_type ( $ _GET [ 'post_type' ] ) ; if ( ! $ post_type ) { $ this -> mf_flash ( 'error' ) ; } else { $ data = $ this -> fields_form ( ) ; $ post_type_support = array ( ) ; if ( isset ( $ post_type [ 'support' ] ) ) { foreach ( $ post_type [ 'support' ] as $ k => $ v ) { array_push ( $ post_type_support , $ k ) ; } $ data [ 'posttype_support' ] = $ post_type_support ; } $ post_type_taxonomy = array ( ) ; if ( isset ( $ post_type [ 'taxonomy' ] ) ) { foreach ( $ post_type [ 'taxonomy' ] as $ k => $ v ) { array_push ( $ post_type_taxonomy , $ k ) ; } $ data [ 'posttype_taxonomy' ] = $ post_type_taxonomy ; } // update fields $ perm = array ( 'core' , 'option' , 'label' ) ; foreach ( $ post_type as $ key => $ value ) { if ( in_array ( $ key , $ perm ) ) { foreach ( $ value as $ id => $ val ) { $ data [ $ key ] [ $ id ] [ 'value' ] = $ val ; } } } $ this -> form_post_type ( $ data ) ; } }
Edit post type
Edit post type