woocommerce_breadcrumb

Output the WooCommerce Breadcrumb.

Description

woocommerce_breadcrumb( (array) $args = array() ); 

Parameters (1)

0. $args — Optional. (array) => array()
The args.

Usage

  1. if ( !function_exists( 'woocommerce_breadcrumb' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-template-functions.php'; 
  3.  
  4. // The args. 
  5. $args = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = woocommerce_breadcrumb($args); 
  9.  

Defined (1)

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

/includes/wc-template-functions.php  
  1. function woocommerce_breadcrumb( $args = array() ) { 
  2. $args = wp_parse_args( $args, apply_filters( 'woocommerce_breadcrumb_defaults', array( 
  3. 'delimiter' => ' / ',  
  4. 'wrap_before' => '<nav class="woocommerce-breadcrumb">',  
  5. 'wrap_after' => '</nav>',  
  6. 'before' => '',  
  7. 'after' => '',  
  8. 'home' => _x( 'Home', 'breadcrumb', woocommerce ),  
  9. ) ) ); 
  10.  
  11. $breadcrumbs = new WC_Breadcrumb(); 
  12.  
  13. if ( ! empty( $args['home'] ) ) { 
  14. $breadcrumbs->add_crumb( $args['home'], apply_filters( 'woocommerce_breadcrumb_home_url', home_url() ) ); 
  15.  
  16. $args['breadcrumb'] = $breadcrumbs->generate(); 
  17.  
  18. /** 
  19. * @hooked WC_Structured_Data::generate_breadcrumblist_data() - 10 
  20. */ 
  21. do_action( 'woocommerce_breadcrumb', $breadcrumbs, $args ); 
  22.  
  23. wc_get_template( 'global/breadcrumb.php', $args );