Astra_Breadcrumb_Trail::add_week_archive_items()
Adds the items to the trail items array for week archives.
Description
Return
(void)
Source
File: inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php
protected function add_week_archive_items() {
// Add $wp_rewrite->front to the trail.
$this->add_rewrite_front_items();
// Get the year and week.
$year = sprintf( $this->labels['archive_year'], get_the_time( esc_html_x( 'Y', 'yearly archives date format', 'astra' ) ) );
$week = sprintf( $this->labels['archive_week'], get_the_time( esc_html_x( 'W', 'weekly archives date format', 'astra' ) ) );
// Add the year item.
$this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_year_link( get_the_time( 'Y' ) ) ), $year );
// Add the week item.
if ( is_paged() ) {
/** @psalm-suppress InvalidArgument **/
$this->items[] = esc_url( get_archives_link( add_query_arg( array( 'm' => get_the_time( 'Y' ), 'w' => get_the_time( 'W' ) ), home_url() ), $week, false ) );
}
elseif ( true === $this->args['show_title'] ) {
$this->items[] = $week;
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |