src/Component/DataProvider/Breadcrumbs.php
/**
	 * Generate breadcrumb trail.
	 *
	 * @return array of breadcrumbs
	 */
Generate breadcrumb trail.
@return array of breadcrumbs
Generate breadcrumb trail . @return array of breadcrumbs
public function generate() {
		$conditionals = array(
			'is_home',
			'is_404',
			'is_attachment',
			'is_single',
			'is_product_category',
			'is_product_tag',
			'is_shop',
			'is_page',
			'is_post_type_archive',
			'is_category',
			'is_tag',
			'is_author',
			'is_date',
			'is_tax'
		);
		if ((!is_front_page() && !is_post_type_archive()) || is_paged()) {
			foreach ( $conditionals as $conditional ) {
				if ( function_exists($conditional) && call_user_func( $conditional ) ) {
					call_user_func( array( $this, 'add_crumbs_' . substr( $conditional, 3 ) ) );
					break;
				}
			}
			$this->search_trail();
			$this->paged_trail();
			return $this->get_breadcrumb();
		}
		$postType = get_query_var('post_type');
		if (is_post_type_archive() && isset($this->postTypes[$postType]) ) {
			foreach ($this->postTypes[$postType]->generate() as $crumb) {
				$this->add_crumb($crumb['name'], $crumb['link']);
			}
		}
		return $this->get_breadcrumb();
	}
public function generate ( ) { $ conditionals = array ( 'is_home' , 'is_404' , 'is_attachment' , 'is_single' , 'is_product_category' , 'is_product_tag' , 'is_shop' , 'is_page' , 'is_post_type_archive' , 'is_category' , 'is_tag' , 'is_author' , 'is_date' , 'is_tax' ) ; if ( ( ! is_front_page ( ) && ! is_post_type_archive ( ) ) || is_paged ( ) ) { foreach ( $ conditionals as $ conditional ) { if ( function_exists ( $ conditional ) && call_user_func ( $ conditional ) ) { call_user_func ( array ( $ this , 'add_crumbs_' . substr ( $ conditional , 3 ) ) ) ; break ; } } $ this -> search_trail ( ) ; $ this -> paged_trail ( ) ; return $ this -> get_breadcrumb ( ) ; } $ postType = get_query_var ( 'post_type' ) ; if ( is_post_type_archive ( ) && isset ( $ this -> postTypes [ $ postType ] ) ) { foreach ( $ this -> postTypes [ $ postType ] -> generate ( ) as $ crumb ) { $ this -> add_crumb ( $ crumb [ 'name' ] , $ crumb [ 'link' ] ) ; } } return $ this -> get_breadcrumb ( ) ; }
Generate breadcrumb trail.
Generate breadcrumb trail .