__( 'A widget to show recent posts', 'beka' ), ) ); } // Creating widget front-end // This is where the action happens public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $recent_posts_count = intval( $instance['recent_posts_count'] ); $show_thumb = (int) $instance['show_thumb']; $show_cat = (int) $instance['show_cat']; // before and after widget arguments are defined by themes echo $args['before_widget']; if ( ! empty( $title ) ) echo $args['before_title'] . $title . $args['after_title']; ?>
'Recent Posts', 'recent_posts_count' => 4, 'show_thumb' => 1, 'show_cat' => 1, ); $instance = wp_parse_args( (array) $instance, $defaults ); $show_thumb = isset( $instance[ 'show_thumb' ] ) ? esc_attr( $instance[ 'show_thumb' ] ) : 1; $show_cat = isset( $instance[ 'show_cat' ] ) ? esc_attr( $instance[ 'show_cat' ] ) : 1; // Widget admin form ?>