Astra_Breadcrumb_Trail::add_user_archive_items()
Adds the items to the trail items array for user (author) archives.
Description
Return
(void)
Source
File: inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php
protected function add_user_archive_items() {
global $wp_rewrite;
// Add $wp_rewrite->front to the trail.
$this->add_rewrite_front_items();
// Get the user ID.
$user_id = get_query_var( 'author' );
// If $author_base exists, check for parent pages.
if ( ! empty( $wp_rewrite->author_base ) && ! is_post_type_archive() ) {
$this->add_path_parents( $wp_rewrite->author_base );
}
// Add the author's display name to the trail end.
if ( is_paged() ) {
$this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_author_posts_url( $user_id ) ), get_the_author_meta( 'display_name', $user_id ) );
}
elseif ( true === $this->args['show_title'] ) {
$this->items[] = get_the_author_meta( 'display_name', $user_id );
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |