/**
  * load custom fields associate with post type
  */
 public function _hw_load_customfields_from_pt()
 {
     if (!wp_verify_nonce($_REQUEST['nonce'], "load_customfields_from_pt_nonce")) {
         exit("unauthorize");
     }
     global $wpdb, $wp_registered_widgets;
     $customfields = array();
     //all custom fields get from post type
     $sql = array();
     //prepare sql command
     $pt = explode(',', $_GET['pt']);
     /**
      * get widget object by id
      */
     $widget_id = $_GET['widget'];
     //get widget id
     $widget_obj = $wp_registered_widgets[$widget_id];
     $widget_obj = $widget_obj['callback'][0];
     //widget object instance
     if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
         //$result = json_encode($result);
         $mt_keys = HW_POST::generate_posttypes_meta_keys($pt);
         $out = sprintf('<select name="%s" id="%s" multiple style="max-height:500px;width:200px">', esc_attr($widget_obj->get_field_name('more_meta_keys') . '[]'), esc_attr($widget_obj->get_field_id('more_meta_keys')));
         // Holds the HTML markup.
         $structure = array();
         foreach ($mt_keys as $key) {
             $structure[] = sprintf('<option value="%s" key="%s" >%s</option>', esc_attr($key), esc_attr($key), esc_html($key));
         }
         $out .= join("\n", $structure);
         $out .= '</select>';
         echo $out;
     } else {
         header("Location: " . $_SERVER["HTTP_REFERER"]);
     }
     die;
 }
</p>
<p><!-- more meta keys -->
    <label for="<?php 
echo $this->get_field_id("more_meta_keys");
?>
"><?php 
_e('Chọn meta keys');
?>
</label>
<div id="<?php 
echo $this->get_field_id('holder_meta_keys');
?>
">
    <?php 
if (isset($instance['more_meta_keys'])) {
    $mt_keys = HW_POST::generate_posttypes_meta_keys($instance['posttype']);
    $out = sprintf('<select name="%s" id="%s" multiple style="max-height:200px;width:200px">', esc_attr($this->get_field_name('more_meta_keys') . '[]'), esc_attr($this->get_field_id('more_meta_keys')));
    // Holds the HTML markup.
    $structure = array();
    foreach ($mt_keys as $key) {
        $selected = in_array($key, (array) $instance['more_meta_keys']);
        $structure[] = sprintf('<option value="%s" key="%s" ' . ($selected ? 'selected="selected"' : '') . '>%s</option>', esc_attr($key), esc_attr($key), esc_html($key));
    }
    $out .= join("\n", $structure);
    $out .= '</select>';
    echo $out;
}
?>

</div>
<a href="javascript:void(0)" onclick="__hwcpl_object.get_customfields_by_type(jQuery('#<?php