function widget_most_recommended_posts($args) { extract($args); $options = get_option("most_recommended_posts"); if (!is_array($options)) { $options = array('title' => __('Most recommended posts', 'dot'), 'number' => __('5', 'dot'), 'show_count' => '0'); } $title = $options['title']; $numberOf = $options['number']; $show_count = $options['show_count']; echo $before_widget; echo $before_title . $title . $after_title; echo '<ul class="mostrecommendedposts">'; most_recommended_posts($numberOf, '<li>', '</li>', $show_count); echo '</ul>'; echo $after_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) { $numberOf = $instance['number']; $show_count = $instance['show_count']; $title = $instance['title']; $before_widget = $args['before_widget']; $after_widget = $args['after_widget']; $before_title = $args['before_title']; $after_title = $args['after_title']; $widget_before = $before_widget; $widget_before .= $before_title . $title . $after_title; echo wp_kses_post($widget_before); echo '<ul class="mostrecommendedposts">'; most_recommended_posts($numberOf, '<li>', '</li>', $show_count); echo '</ul>'; echo wp_kses_post($after_widget); }