src/class-extended-cpt-admin.php
public function glance_items( array $items ) : array {

		$pto = get_post_type_object( $this->cpt->post_type );

		if ( ! current_user_can( $pto->cap->edit_posts ) ) {
			return $items;
		}
		if ( $pto->_builtin ) {
			return $items;
		}

		# Get the labels and format the counts:
		$count = wp_count_posts( $this->cpt->post_type );
		$text  = self::n( $pto->labels->singular_name, $pto->labels->name, (int) $count->publish );
		$num   = number_format_i18n( $count->publish );

		# This is absolutely not localisable. WordPress 3.8 didn't add a new post type label.
		$url = add_query_arg( [
			'post_type' => $this->cpt->post_type,
		], admin_url( 'edit.php' ) );
		$text = '<a href="' . esc_url( $url ) . '" class="cpt-' . esc_attr( $this->cpt->post_type ) . '-count">' . esc_html( $num . ' ' . $text ) . '</a>';

		# Go!
		$items[] = $text;

		return $items;

	}
public function glance_items( array $items ) : array {

		$pto = get_post_type_object( $this->cpt->post_type );

		if ( ! current_user_can( $pto->cap->edit_posts ) ) {
			return $items;
		}
		if ( $pto->_builtin ) {
			return $items;
		}

		# Get the labels and format the counts:
		$count = wp_count_posts( $this->cpt->post_type );
		$text  = self::n( $pto->labels->singular_name, $pto->labels->name, (int) $count->publish );
		$num   = number_format_i18n( $count->publish );

		# This is absolutely not localisable. WordPress 3.8 didn't add a new post type label.
		$url = add_query_arg( [
			'post_type' => $this->cpt->post_type,
		], admin_url( 'edit.php' ) );
		$text = '<a href="' . esc_url( $url ) . '" class="cpt-' . esc_attr( $this->cpt->post_type ) . '-count">' . esc_html( $num . ' ' . $text ) . '</a>';

		# Go!
		$items[] = $text;

		return $items;

	}
public function glance_items ( array $ items ) : array { $ pto = get_post_type_object ( $ this -> cpt -> post_type ) ; if ( ! current_user_can ( $ pto -> cap -> edit_posts ) ) { return $ items ; } if ( $ pto -> _builtin ) { return $ items ; } # Get the labels and format the counts: $ count = wp_count_posts ( $ this -> cpt -> post_type ) ; $ text = self :: n ( $ pto -> labels -> singular_name , $ pto -> labels -> name , ( int ) $ count -> publish ) ; $ num = number_format_i18n ( $ count -> publish ) ; # This is absolutely not localisable. WordPress 3.8 didn't add a new post type label. $ url = add_query_arg ( [ 'post_type' => $ this -> cpt -> post_type , ] , admin_url ( 'edit.php' ) ) ; $ text = '<a href="' . esc_url ( $ url ) . '" class="cpt-' . esc_attr ( $ this -> cpt -> post_type ) . '-count">' . esc_html ( $ num . ' ' . $ text ) . '</a>' ; # Go! $ items [ ] = $ text ; return $ items ; }
Add our post type to the 'At a Glance' widget on the WordPress 3.8+ dashboard.

@param  array $items Array of items to display on the widget.
@return array        Updated array of items.
Add our post type to the At a Glance widget on the WordPress 3 . 8 + dashboard .