Astra_Breadcrumb_Trail::add_blog_items()
Adds items for the posts page (i.e., is_home()) to the items array.
Description
Return
(void)
Source
File: inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php
protected function add_blog_items() {
// Get the post ID and post.
$post_id = get_queried_object_id();
$post = get_post( $post_id );
// If the post has parents, add them to the trail.
if ( 0 < $post->post_parent ) {
$this->add_post_parents( $post->post_parent );
}
// Get the page title.
$title = get_the_title( $post_id );
// Add the posts page item.
if ( is_paged() ) {
$this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), $title );
}
elseif ( $title && true === $this->args['show_title'] ) {
$this->items[] = $title;
}
}
Expand full source code Collapse full source code View on Trac
Changelog
| Version | Description |
|---|---|
| 1.0.0 | Introduced. |