_get_current_taxonomy example

/** * Outputs the content for the current Tag Cloud widget instance. * * @since 2.8.0 * * @param array $args Display arguments including 'before_title', 'after_title', * 'before_widget', and 'after_widget'. * @param array $instance Settings for the current Tag Cloud widget instance. */
    public function widget( $args$instance ) {
        $current_taxonomy = $this->_get_current_taxonomy( $instance );

        if ( ! empty( $instance['title'] ) ) {
            $title = $instance['title'];
        } else {
            if ( 'post_tag' === $current_taxonomy ) {
                $title = __( 'Tags' );
            } else {
                $tax   = get_taxonomy( $current_taxonomy );
                $title = $tax->labels->name;
            }
        }

        
Home | Imprint | This part of the site doesn't use cookies.