/** * ajax callback to get taxonomies for specific post type */ public function _hw_change_taxonomies_posttype() { if (!wp_verify_nonce($_REQUEST['nonce'], "hw_change_posttype_taxonomies_nonce")) { exit("No naughty business please"); } if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $post_types = $_REQUEST['posttype']; #if(is_string($post_types)) $post_types = preg_split('#[\s,]+#',$post_types); HW_HOANGWEB::load_class('HW_POST'); $data = HW_POST::get_posttypes_taxonomies($post_types); //get all taxonomies assigned to post types //get all posts by post types $posts_result = HW_POST::get_all_posts_by_posttypes($post_types); //$html = '<select'; $result['data'] = $data; $result['posts'] = $posts_result; $result = json_encode($result); echo $result; } else { header("Location: " . $_SERVER["HTTP_REFERER"]); } die; }
/** * scrollbar */ $scrollbar_skin_setting = isset($instance['scrollbar_skin_setting']) ? $instance['scrollbar_skin_setting'] : null; //scrollbar skin options $scrollbar_skin = isset($instance['scrollbar_skin']) ? $instance['scrollbar_skin'] : ''; //scrollbar skin //scrollbar skin options output, this should call before display select tag for scrollbar selector in order to make skin change event work $scrollbar_skin_options = $this->skin->get_skin_instance('scrollbar')->prepare_skin_options_fields('scrollbar_skin_setting', $scrollbar_skin_setting, $scrollbar_skin); //get taxonomies by specific post types if (isset($instance['posttype'])) { HW_HOANGWEB::load_class('HW_POST'); $pts_taxonomies = HW_POST::get_posttypes_taxonomies($instance['posttype'], true); //get all taxonomies from post types //get all posts by choose post types $posts_data = HW_POST::get_all_posts_by_posttypes($instance['posttype']); } else { $taxonomies = get_taxonomies('', 'objects'); $pts_taxonomies = array(); foreach ($taxonomies as $name => $tax) { $pts_taxonomies[$name] = $tax->labels->name . " ({$name})"; } //posts empty data $posts_data = array(); } //list all users of current blog $blogusers = get_users('orderby=nicename'); ?> <p> <label for="<?php echo $this->get_field_id("widget_title");