__( 'A widget that shows Random posts', 'accesspress-mag' ) ) ); } /** * Helper function that holds widget fields * Array is used in update and form functions */ private function widget_fields() { $fields = array( 'random_posts_title' => array( 'accesspress_mag_widgets_name' => 'random_posts_title', 'accesspress_mag_widgets_title' => __( 'Title', 'accesspress-mag' ), 'accesspress_mag_widgets_field_type' => 'title', ), 'random_posts_count' => array( 'accesspress_mag_widgets_name' => 'random_posts_count', 'accesspress_mag_widgets_title' => __( 'Number of Posts', 'accesspress-mag' ), 'accesspress_mag_widgets_field_type' => 'select', 'accesspress_mag_widgets_field_options' => array( '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9',) ), ); return $fields; } /** * 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 ) { extract( $args ); $random_posts_title = $instance['random_posts_title']; $random_posts_count = $instance['random_posts_count']; echo $before_widget; ?>