defaults = array( 'title' => esc_attr__('Authors', 'essential-widgets'), 'order' => 'ASC', 'orderby' => 'display_name', 'number' => '', 'include' => '', 'exclude' => '', 'optioncount' => false, 'exclude_admin' => false, 'show_fullname' => true, 'hide_empty' => true, 'style' => 'list', 'html' => true, 'feed' => '', 'feed_type' => '', 'feed_image' => '' ); $widget_ops = array( 'classname' => 'essential-widgets ew-author ewauthor', 'description' => esc_html__('Displays a list of author', 'essential-widgets'), ); $control_ops = array( 'id_base' => 'ew-author' ); parent::__construct( 'ew-author', // Base ID __('EW: Authors', 'essential-widgets'), // Name $widget_ops, $control_ops ); } public function form($instance) { // Merge the user-selected arguments with the defaults. $instance = wp_parse_args((array) $instance, $this->defaults); $order = array( 'ASC' => esc_attr__('Ascending', 'essential-widgets'), 'DESC' => esc_attr__('Descending', 'essential-widgets') ); $orderby = array( 'display_name' => esc_attr__('Display Name', 'essential-widgets'), 'email' => esc_attr__('Email', 'essential-widgets'), 'ID' => esc_attr__('ID', 'essential-widgets'), 'nicename' => esc_attr__('Nice Name', 'essential-widgets'), 'post_count' => esc_attr__('Post Count', 'essential-widgets'), 'registered' => esc_attr__('Registered', 'essential-widgets'), 'url' => esc_attr__('URL', 'essential-widgets'), 'user_login' => esc_attr__('Login', 'essential-widgets') ); $style = array( 'list' => esc_attr__('List', 'essential-widgets'), 'none' => esc_attr__('Plain', 'essential-widgets') ); $feed_type = array( '' => '', 'atom' => esc_attr__('Atom', 'essential-widgets'), 'rdf' => esc_attr__('RDF', 'essential-widgets'), 'rss' => esc_attr__('RSS', 'essential-widgets'), 'rss2' => esc_attr__('RSS 2.0', 'essential-widgets') ); ?>

 
defaults); // Output the args's $before_widget wrapper. echo $args['before_widget']; // If a title was input by the user, display it. if (!empty($instance['title'])) echo $args['before_title'] . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $args['after_title']; echo $this->shortcode($instance); // Close the args's widget wrapper. echo $args['after_widget']; } public function shortcode($atts) { // instance the $echo argument and set it to false. $atts['echo'] = false; $ew_author = ''; // Only show this title in block element and not on widget. if ( isset( $atts['is_block'] ) && true === $atts['is_block'] && !empty( $atts['title'] ) ) { $ew_author .= '

' . $atts['title'] . '

'; } // Get the authors list. $authors = str_replace(array("\r", "\n", "\t"), '', wp_list_authors($atts)); $authors = str_replace(' (', ' (', $authors); $authors = str_replace(')', ')', $authors); // If 'list' is the style and the output should be HTML, wrap the authors in a