jetpack_breadcrumbs

Plugin Name: Site Breadcrumbs Plugin URI: https://wordpress.com Description: Quickly add breadcrumbs to the single view of a hierarchical post type or a hierarchical taxonomy.

Description

jetpack_breadcrumbs(); 

Usage

  1. if ( !function_exists( 'jetpack_breadcrumbs' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'jetpack-by-wordpress-com/modules/theme-tools/site-breadcrumbs.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = jetpack_breadcrumbs(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/modules/theme-tools/site-breadcrumbs.php  
  1. function jetpack_breadcrumbs() { 
  2. if ( ! is_page() || is_front_page() ) { 
  3. return; 
  4.  
  5. global $post; 
  6.  
  7. $ancestors = array_reverse( get_post_ancestors( $post->ID ) ); 
  8.  
  9. $before = '<nav class="entry-breadcrumbs">'; 
  10. $after = '</nav>'; 
  11.  
  12. $home = '<a href="' . esc_url( home_url( "/" ) ) . '" class="home-link" rel="home">' . __( 'Home', jetpack ) . '</a>'; 
  13.  
  14. $breadcrumb = ''; 
  15.  
  16. if ( $ancestors ) { 
  17. foreach ( $ancestors as $ancestor ) { 
  18. $breadcrumb .= '<a href="' . esc_url( get_permalink( $ancestor ) ) . '">' . esc_html( get_the_title( $ancestor ) ) . '</a>'; 
  19.  
  20. $breadcrumb .= '<span class="current-page">' . esc_html( get_the_title( $post->ID ) ) . '</span>'; 
  21.  
  22. echo $before . $home . $breadcrumb . $after;