'recent_post_widget', 'description' => __('Recent Post With Their Feature Image','andrina-lite'), ); parent::__construct('recent_post_widget', __('Recent Post With Thumbnail','andrina-lite'), $widget_ops); } /** * Outputs the content of the widget * * @param array $args * @param array $instance */ public function widget($args, $instance) { echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } $_max = $instance['numb_post']; $_max = $_max-1; $query_args = array( 'posts_per_page' => $_max, 'no_found_rows' => true, 'post_status' => 'publish', ); $r = new WP_Query(apply_filters('rpwwt_widget_posts_args', $query_args)); if ($r->have_posts()) : // translate repeately used texts once (for more performance) $this->in_categories_text = _x('In', 'In {categories}', 'andrina-lite'); $text = ', '; $this->comma_text = $text; $text = 'By %s'; $this->author_text = $text; ?>

$len) { // get post_title in desired length $post_title = mb_substr($post_title, 0, $len); // append ellipses $post_title .= $more; } return $post_title; } } /** * Register widget on init * * @since 1.0 */ function andrina_register_recent_posts_widget_with_thumbnails() { register_widget('Andrina_Recent_Posts_Widget_With_Thumbnails'); } add_action('widgets_init', 'andrina_register_recent_posts_widget_with_thumbnails', 1); ?>