__( 'Use this widget on single listing page to display Google Map with car location.', 'stm_motors_extends' ) ) // Args. ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( ! empty( $title ) ) { echo $args['before_title'] . esc_html( $title ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } $id = get_the_ID(); $car_lat = get_post_meta( $id, 'stm_lat_car_admin', true ); $car_lng = get_post_meta( $id, 'stm_lng_car_admin', true ); $car_location = get_post_meta( $id, 'stm_car_location', true ); if ( ! empty( $car_lat ) && $car_lng && $car_location ) { stm_dealer_gmap( $car_lat, $car_lng ); } echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form( $instance ) { $title = ''; if ( isset( $instance['title'] ) ) { $title = $instance['title']; } else { $title = ''; } ?>