theme; if ( ! empty( $atts['theme'] ) ) { $theme = $atts['theme']; } $theme = $this->is_theme_available( $theme ); if ( ! empty( $atts['post_count'] ) ) { $limit = intval( $atts['post_count'] ); } else { $limit = $this->count; } $posts = $this->get_posts_to_display(); if ( empty( $posts ) ) { return ''; } if ( 'curated' === $this->sort && apply_filters( 'monsterinsights_popular_posts_widget_curated_shuffle', true ) ) { // Randomize the order. shuffle( $posts ); } $theme_styles = $this->get_theme_props( $theme )->get_theme(); $label_text = ''; if ( isset( $theme_styles['styles']['label'] ) ) { $label_text = isset( $atts['label_text'] ) ? esc_html($atts['label_text']) : esc_html($theme_styles['styles']['label']['text']); } if ( isset( $atts['widget_title'] ) ) { $show_title = (bool) $atts['widget_title']; $title_text = empty( $atts['widget_title_text'] ) ? '' : $atts['widget_title_text']; } else { $show_title = $this->title; $title_text = $this->title_text; } $html = '