WC_Breadcrumb::add_crumbs_page()
Page trail.
Method of the class: WC_Breadcrumb{}
No Hooks.
Return
null
. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->add_crumbs_page();
WC_Breadcrumb::add_crumbs_page() WC Breadcrumb::add crumbs page code WC 8.7.0
protected function add_crumbs_page() { global $post; if ( $post->post_parent ) { $parent_crumbs = array(); $parent_id = $post->post_parent; while ( $parent_id ) { $page = get_post( $parent_id ); $parent_id = $page->post_parent; $parent_crumbs[] = array( get_the_title( $page->ID ), get_permalink( $page->ID ) ); } $parent_crumbs = array_reverse( $parent_crumbs ); foreach ( $parent_crumbs as $crumb ) { $this->add_crumb( $crumb[0], $crumb[1] ); } } $this->add_crumb( get_the_title(), get_permalink() ); $this->endpoint_trail(); }