esc_html__( 'Displays recent posts', 'almighty' ), ) ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { echo $args['before_widget']; if ( ! empty( $instance['title'] ) ) { $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); echo $args['before_title'] . $title . $args['after_title']; } $post_category = ! empty( $instance['post_category'] ) ? $instance['post_category'] : 0; ?>
'name', 'hide_empty' => 0, 'taxonomy' => 'category', 'name' => $this->get_field_name('post_category'), 'id' => $this->get_field_id('post_category'), 'selected' => $post_category, 'show_option_all' => __( 'All Categories','almighty' ), ); wp_dropdown_categories( $cat_args ); ?>
'post', 'post_status' => 'publish', 'cat' => $args['post_category'], 'posts_per_page' => $args['no_of_recent_posts'], ); $content_length = absint($args['recent_content_length']); break; default: break; } if (!empty($post_args) && is_array($post_args)) { $post_data = new WP_Query($post_args); if ($post_data->have_posts()) { echo '