'property-search', 'description' => __( 'Display property search dropdown', 'agentpress-listings' ), ); $control_ops = array( 'width' => 200, 'height' => 250, 'id_base' => 'property-search', ); parent::__construct( 'property-search', __( 'AgentPress - Listing Search', 'agentpress-listings' ), $widget_ops, $control_ops ); } /** * Widget. * * @param array $args Arguments. * @param array $instance Instance. */ public function widget( $args, $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'button_text' => __( 'Search Properties', 'agentpress-listings' ), ) ); global $_agentpress_taxonomies; $listings_taxonomies = $_agentpress_taxonomies->get_taxonomies(); $before_widget = $args['before_widget']; $after_widget = $args['after_widget']; $before_title = $args['before_title']; $after_title = $args['after_title']; echo wp_kses_post( $before_widget ); if ( $instance['title'] ) { echo wp_kses_post( $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title ); } echo ''; echo wp_kses_post( $after_widget ); } /** * Update. * * @param array $new_instance New instance. * @param array $old_instance Old instance. * * @return array New instance. */ public function update( $new_instance, $old_instance ) { return $new_instance; } /** * Form. * * @param array $instance Instance. */ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'button_text' => __( 'Search Properties', 'agentpress-listings' ), ) ); global $_agentpress_taxonomies; $listings_taxonomies = $_agentpress_taxonomies->get_taxonomies(); $new_widget = empty( $instance ); printf( '

', esc_attr( $this->get_field_id( 'title' ) ), esc_html__( 'Title:', 'agentpress-listings' ), esc_attr( $this->get_field_id( 'title' ) ), esc_attr( $this->get_field_name( 'title' ) ), esc_attr( $instance['title'] ), 'width: 95%;' ); ?>
$data ) { $terms = get_terms( $tax ); if ( empty( $terms ) ) { continue; } $checked = isset( $instance[ $tax ] ) && $instance[ $tax ]; printf( '

', esc_attr( $this->get_field_id( 'tax' ) ), esc_attr( $this->get_field_name( $tax ) ), checked( 1, $checked, 0 ), esc_html( $data['labels']['name'] ) ); } printf( '

', esc_attr( $this->get_field_id( 'button_text' ) ), esc_html__( 'Button Text:', 'agentpress-listings' ), esc_attr( $this->get_field_id( 'button_text' ) ), esc_attr( $this->get_field_name( 'button_text' ) ), esc_attr( $instance['button_text'] ), 'width: 95%;' ); } }