prefix = framework_get_prefix(); /* Set up the widget options. */ $widget_options = array( 'classname' => 'recent-posts', 'description' => esc_html__( 'Display your site\'s recent posts.', 'wordsmith' ) ); /* Set up the widget control options. */ $control_options = array( 'width' => 200, 'height' => 350 ); /* Create the widget. */ $this->WP_Widget( "{$this->prefix}-recent-posts", __( 'Recent Posts', 'wordsmith' ), $widget_options, $control_options ); } /* Outputs the widget based on the arguments input through the widget controls. */ function widget( $args, $instance ) { extract( $args ); /* Arguments for the widget. */ $args['category'] = $instance['category']; $args['order'] = $instance['order']; $args['orderby'] = $instance['orderby']; /* Output the theme's $before_widget wrapper. */ echo $before_widget; /* If a title was input by the user, display it. */ if ( !empty( $instance['title'] ) ) echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; ?> $instance['category'], 'order' => $instance['order'], 'orderby' => $instance['orderby'], 'post__not_in' => get_option( 'sticky_posts' ), 'posts_per_page' => intval( $instance['limit'] ), 'post_status' => 'publish', 'tax_query' => array( array( 'field' => 'slug', 'operator' => 'NOT IN', 'taxonomy' => 'post_format', 'terms' => array( 'post-format-aside', 'post-format-audio', 'post-format-chat', 'post-format-gallery', 'post-format-image', 'post-format-link', 'post-format-link', 'post-format-quote', 'post-format-status', 'post-format-video' ) ) ) ) ) ); } else { $wp_query = new WP_Query( apply_filters( 'widget_posts_args', array( 'cat' => $instance['category'], 'meta_key' => 'Views', 'order' => $instance['order'], 'orderby' => 'meta_value_num', 'post__not_in' => get_option( 'sticky_posts' ), 'posts_per_page' => intval( $instance['limit'] ), 'post_status' => 'publish', 'tax_query' => array( array( 'field' => 'slug', 'operator' => 'NOT IN', 'taxonomy' => 'post_format', 'terms' => array( 'post-format-aside', 'post-format-audio', 'post-format-chat', 'post-format-gallery', 'post-format-image', 'post-format-link', 'post-format-link', 'post-format-quote', 'post-format-status', 'post-format-video' ) ) ) ) ) ); } ?> have_posts() ) : ?>