__( 'Business booster recent post', 'business-booster' ), ), array( 'width' => 600, ) ); } /** * Outputs the content for the current widget instance. * * Display arguments */ function widget( $args, $instance ) { echo $args['before_widget']; $widget_id = $args['widget_id']; global $wpdb,$post; $business_booster_post_catid = isset($instance['business_booster_post_select_category'])?$instance['business_booster_post_select_category']:''; $business_booster_recent_posts = isset($instance['business_booster_recent_posts'])?$instance['business_booster_recent_posts']:''; if($business_booster_recent_posts=='') { $business_booster_recent_posts='-1'; } $category_names = get_category_by_slug($business_booster_post_catid ); if ( $category_names instanceof WP_Term ) { $category_name= esc_html($category_names->name); }else{ $category_name= esc_html_e('All Categories','business-booster'); } $args_recent_post = array( 'posts_per_page' => absint($business_booster_recent_posts), 'offset' => 0, 'category_name' => esc_html($business_booster_post_catid), 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish', 'suppress_filters' => true ); $posts_array = get_posts( $args_recent_post ); ?>