Yoast\WP\SEO\Generators

Breadcrumbs_Generator::get_date_archive_crumb()protectedYoast 1.0

Returns the modified date archive crumb.

Метод класса: Breadcrumbs_Generator{}

Хуков нет.

Возвращает

Строку[]. The crumb.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_date_archive_crumb( $crumb );
$crumb(string[]) (обязательный)
The crumb.

Код Breadcrumbs_Generator::get_date_archive_crumb() Yoast 22.4

protected function get_date_archive_crumb( $crumb ) {
	$home_url = $this->url_helper->home();
	$prefix   = $this->options->get( 'breadcrumbs-archiveprefix' );

	if ( \is_day() ) {
		$day           = \esc_html( \get_the_date() );
		$crumb['url']  = $home_url . \get_the_date( 'Y/m/d' ) . '/';
		$crumb['text'] = $prefix . ' ' . $day;
	}
	elseif ( \is_month() ) {
		$month         = \esc_html( \trim( \single_month_title( ' ', false ) ) );
		$crumb['url']  = $home_url . \get_the_date( 'Y/m' ) . '/';
		$crumb['text'] = $prefix . ' ' . $month;
	}
	elseif ( \is_year() ) {
		$year          = \get_the_date( 'Y' );
		$crumb['url']  = $home_url . $year . '/';
		$crumb['text'] = $prefix . ' ' . $year;
	}

	return $crumb;
}