__( "Filter by terms of a preset taxonomy") ); parent::__construct('atf_taxonomy_widget', __('AGP Ajax Taxonomy Filter'), $widget_ops); add_action( "wp_ajax_atf_post_type_select", array($this, 'doAtfPostTypeSelect') ); add_action( "wp_ajax_nopriv_atf_post_type_select", array($this, 'doAtfPostTypeSelect')); } /** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { //if (!$instance['is_ajax'] || is_post_type_archive($instance['post_type'])) { echo $args['before_widget']; if (!empty( $instance['title'])) { echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ). $args['after_title']; } echo Atf()->getTemplate('atf', $this->id); echo $args['after_widget']; //} } /** * Outputs the options form on admin * * @param array $instance The widget options */ public function form( $instance ) { $title = !empty($instance['title']) ? $instance['title'] : ''; $post_type = !empty($instance['post_type']) ? $instance['post_type'] : 'post'; $taxonomy = !empty($instance['taxonomy']) ? $instance['taxonomy'] : ''; $is_ajax = !empty( $instance['is_ajax'] ) ? (bool) $instance['is_ajax'] : false; $is_multi_select = !empty( $instance['is_multi_select'] ) ? (bool) $instance['is_multi_select'] : false; $content_selector = !empty($instance['content_selector']) ? $instance['content_selector'] : ''; ?>

renderTitleField($title); ?>

renderPostTypeField($post_type); ?>

renderTaxonomyField($post_type, $taxonomy); ?>

renderIsAjaxField($is_ajax); ?>
renderIsMultiSelectField($is_multi_select); ?>

renderContentSelectorField($content_selector); ?>

initJS();?> true, '_builtin' => false); $output = 'names'; $operator = 'and'; $types = array_merge( array('post'), get_post_types( $args, $output, $operator )); ?> > > number = $number; $obj->renderTaxonomyField($post_type); } else { http_response_code(500); } die(); } }