function __construct()
 {
     //Check Role
     if (!current_user_can('edit_pages')) {
         return;
     }
     parent::__construct();
     $this->init();
 }
            wp_reset_query();
        }
        echo json_encode($result);
        die;
    }
    function ot_post_select_ajax_unit_types($array, $id)
    {
        return apply_filters('post_select_ajax', $array, $id);
    }
    function ot_add_custom_option_types($types)
    {
        $types['post_select_ajax'] = __('Post Select Ajax', ST_TEXTDOMAIN);
        return $types;
    }
}
$a = new STCustomOptiontree();
$a->init();
if (!function_exists('ot_type_post_select_ajax')) {
    function ot_type_post_select_ajax($args = array())
    {
        $st_custom_ot = new STCustomOptiontree();
        $url = $st_custom_ot->url;
        wp_enqueue_script('st_post_select_ajax', $url . '/js/st_post_select_ajax.js', array('select2', 'select2-lang'), null, true);
        wp_enqueue_style('st_post_select_ajax', $url . '/css/post_select_ajax.css', array('select2'));
        $default = array('field_post_type' => 'st_hotel', 'field_desc' => __('Search for a Item', ST_TEXTDOMAIN));
        $args = wp_parse_args($args, $default);
        extract($args);
        $post_type = $field_post_type;
        /* verify a description */
        $has_desc = $field_desc ? true : false;
        /* format setting outer wrapper */