/** * Get the user-visible widget html. * @param Array $args General widget configuration. Often shared between all widgets on the site. * @param Array $instance Configuration of this Widget. Unique to this invocation. * @return string The complete A-Z Widget HTML ready for echoing to the page. */ function get_the_section_a_z_widget($args, $instance) { $instance = wp_parse_args($instance, array('title' => '', 'post' => 0)); if ($instance['post']) { $target = get_post((int) $instance['post']); } else { return null; } $title = $instance['title']; if (empty($title)) { $title = $target->post_title; } $apply_styling = isset($instance['apply-styling']) && true === $instance['apply-styling'] ? true : false; $a_z_query = new A_Z_Listing(); $ret = $args['before_widget']; // WPCS: XSS OK. $ret .= $args['before_title']; // WPCS: XSS OK. $ret .= esc_html($title); $ret .= $args['after_title']; // WPCS: XSS OK. $ret .= '<div class="az-letters">'; $ret .= $a_z_query->get_the_letters(get_permalink($target), $apply_styling ? 'default-style' : null); $ret .= '<div class="clear empty"></div></div>'; $ret .= $args['after_widget']; // WPCS: XSS OK. return $ret; }