'widget adore-widget most-read-widget', 'description' => __( 'Retrive Most Read Widgets', 'archive-news' ), ); parent::__construct( 'archive_news_most_read_widget', __( 'Adore Widget: Most Read Widget', 'archive-news' ), $most_read_widget ); } /** * 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 ) { if ( ! isset( $args['widget_id'] ) ) { $args['widget_id'] = $this->id; } $most_read_title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : ''; $most_read_title = apply_filters( 'widget_title', $most_read_title, $instance, $this->id_base ); $viewall_button_label = ( ! empty( $instance['view_all_button_label'] ) ) ? $instance['view_all_button_label'] : ''; $most_read_post_count = isset( $instance['number'] ) ? absint( $instance['number'] ) : 4; $most_read_post_offset = isset( $instance['offset'] ) ? absint( $instance['offset'] ) : ''; $most_read_category = isset( $instance['category'] ) ? absint( $instance['category'] ) : ''; $viewall_button_link = ( ! empty( $instance['view_all_button_link'] ) ) ? $instance['view_all_button_link'] : esc_url( get_category_link( $most_read_category ) ); echo $args['before_widget']; if ( ! empty( $most_read_title || $viewall_button_label ) ) { ?>
8 ) { $instance['number'] = 8; } $instance['offset'] = (int) $new_instance['offset']; $instance['category'] = (int) $new_instance['category']; return $instance; } } }