'widget_tpg_post_grid', 'description' => esc_html__( 'Display the post grid.', 'the-post-grid' ), ]; parent::__construct( 'widget_tpg_post_grid', esc_html__( 'The Post Grid', 'the-post-grid' ), $widget_ops ); } /** * display the widgets on the screen. */ public function widget( $args, $instance ) { extract( $args ); $id = ( ! empty( $instance['id'] ) ? absint( $instance['id'] ) : null ); echo $before_widget; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped if ( ! empty( $instance['title'] ) ) { echo $args['before_title'] . apply_filters( 'widget_title', ( isset( $instance['title'] ) ? $instance['title'] : 'The Post Grid' ) ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } if ( ! empty( $id ) ) { echo do_shortcode( '[the-post-grid id="' . absint( $id ) . '" ]' ); } echo $after_widget; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } public function form( $instance ) { $scList = Fns::getAllTPGShortCodeList(); $defaults = [ 'title' => 'The Post Grid', 'id' => null, ]; $instance = wp_parse_args( (array) $instance, $defaults ); ?>