instance = $instance; $this->args = $this->update_args( $args ); $this->term = $term; $this->id_base = $id_base; $this->init(); } /** * Output the featured term. * @since 3.1.0 */ private function init() { if ( ! empty( $this->instance['title'] ) ) { echo wp_kses_post( $this->args['before_title'] . apply_filters( 'widget_title', $this->instance['title'], $this->instance, $this->id_base ) . $this->args['after_title'] ); } $title = displayfeaturedimagegenesis_get_term_meta( $this->term, 'headline' ); if ( ! $title ) { $title = $this->term->name; } $permalink = get_term_link( $this->term ); $this->do_image( $title, $permalink ); $this->do_title( $title, $permalink ); $this->do_content(); $this->do_archive_link(); } /** * Echo the term image with markup. * * @param $term_id * @param $title * @param $permalink */ private function do_image( $title, $permalink ) { $term_image = displayfeaturedimagegenesis_get_term_image( $this->instance['term'] ); if ( ! $term_image ) { return; } $image = wp_get_attachment_image( $term_image, $this->instance['image_size'], false, array( 'alt' => $title, ) ); if ( $this->instance['show_image'] && $image ) { $role = empty( $this->instance['show_title'] ) ? '' : 'aria-hidden="true" tabindex="-1"'; printf( '%s', esc_url( $permalink ), esc_html( $title ), esc_attr( $this->instance['image_alignment'] ), $role, wp_kses_post( $image ) ); } } /** * Echo the term title with markup. * * @param $title * @param $permalink */ private function do_title( $title, $permalink ) { if ( ! $this->instance['show_title'] ) { return; } if ( empty( $this->instance['show_title'] ) ) { return; } $title_output = sprintf( '