Astra_Breadcrumb_Trail::add_post_type_archive_items()
Adds the items to the trail items array for post type archives.
Description
Return
(void)
Source
File: inc/addons/breadcrumbs/class-astra-breadcrumb-trail.php
protected function add_post_type_archive_items() { // Get the post type object. $post_type_object = get_post_type_object( get_query_var( 'post_type' ) ); if ( false !== $post_type_object->rewrite ) { // If 'with_front' is true, add $wp_rewrite->front to the trail. if ( $post_type_object->rewrite['with_front'] ) { $this->add_rewrite_front_items(); } // If there's a rewrite slug, check for parents. if ( ! empty( $post_type_object->rewrite['slug'] ) ) { $this->add_path_parents( $post_type_object->rewrite['slug'] ); } } // Add the post type [plural] name to the trail end. if ( is_paged() || is_author() ) { $this->items[] = sprintf( '<a href="%s">%s</a>', esc_url( get_post_type_archive_link( $post_type_object->name ) ), post_type_archive_title( '', false ) ); } elseif ( true === $this->args['show_title'] ) { $this->items[] = post_type_archive_title( '', false ); } // If viewing a post type archive by author. if ( is_author() ) { $this->add_user_archive_items(); } }
Expand full source code Collapse full source code View on Trac
Changelog
Version | Description |
---|---|
1.0.0 | Introduced. |