'arpw_widget random-posts', 'description' => __( 'Enable advanced random posts widget.', 'arpw' ) ); $control_ops = array( 'width' => 800, 'height' => 350, 'id_base' => 'arpw_widget' ); $this->WP_Widget( 'arpw_widget', __( 'Advanced Random Posts', 'arpw' ), $widget_ops, $control_ops ); } /** * Display widget */ function widget( $args, $instance ) { extract( $args, EXTR_SKIP ); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $title_url = esc_url( $instance['title_url'] ); $limit = (int)( $instance['limit'] ); $excerpt = $instance['excerpt']; $length = (int)( $instance['length'] ); $thumb = $instance['thumb']; $thumb_height = (int)( $instance['thumb_height'] ); $thumb_width = (int)( $instance['thumb_width'] ); $cat = $instance['cat']; $tag = $instance['tag']; $date = $instance['date']; $css = wp_filter_nohtml_kses( $instance['css'] ); $css_id = $instance['css_id']; $css_default = $instance['css_default']; echo $before_widget; if ( $css_default == true ) arpw_custom_styles(); // load the custom style. if( $css ) echo ''; if ( ! empty( $title_url ) && ! empty( $title ) ) echo $before_title . '' . $title . '' . $after_title; elseif ( ! empty( $title ) ) echo $before_title . $title . $after_title; global $post; $args = array( 'numberposts' => $limit, 'category__in' => $cat, 'tag__in' => $tag, 'post_type' => 'post', 'orderby' => 'rand' ); $arpwwidget = get_posts( $args ); if( $arpwwidget ) : ?>
/>
/>
/>
/>