Astra_Breadcrumb_Trail::add_singular_items()
Adds singular post items to the items array.
Description
Return
(void)
Source
File: inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php
protected function add_singular_items() { // Get the queried post. $post = get_queried_object(); $post_id = get_queried_object_id(); // If the post has a parent, follow the parent trail. if ( 0 < $post->post_parent ) { $this->add_post_parents( $post->post_parent ); } // If the post doesn't have a parent, get its hierarchy based off the post type. else { $this->add_post_hierarchy( $post_id ); } // Display terms for specific post type taxonomy if requested. if ( ! empty( $this->post_taxonomy[ $post->post_type ] ) ) { $this->add_post_terms( $post_id, $this->post_taxonomy[ $post->post_type ] ); } // End with the post title. if ( $post_title = single_post_title( '', false ) ) { if ( ( 1 < get_query_var( 'page' ) || is_paged() ) || ( get_option( 'page_comments' ) && 1 < absint( get_query_var( 'cpage' ) ) ) ) { $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_permalink( $post_id ) ), $post_title ); } elseif ( true === $this->args['show_title'] ) { $this->items[] = $post_title; } } }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |