woocommerce_page_title

Woocommerce_page_title function.

Description

(string) woocommerce_page_title( (bool) $echo = true ); 

Returns (string)

Parameters (1)

0. $echo — Optional. (bool) => true
The echo.

Usage

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

Defined (1)

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

/includes/wc-template-functions.php  
  1. function woocommerce_page_title( $echo = true ) { 
  2.  
  3. if ( is_search() ) { 
  4. $page_title = sprintf( __( 'Search results: “%s”', woocommerce ), get_search_query() ); 
  5.  
  6. if ( get_query_var( 'paged' ) ) 
  7. $page_title .= sprintf( __( ' – Page %s', woocommerce ), get_query_var( 'paged' ) ); 
  8.  
  9. } elseif ( is_tax() ) { 
  10.  
  11. $page_title = single_term_title( "", false ); 
  12.  
  13. } else { 
  14.  
  15. $shop_page_id = wc_get_page_id( 'shop' ); 
  16. $page_title = get_the_title( $shop_page_id ); 
  17.  
  18.  
  19. $page_title = apply_filters( 'woocommerce_page_title', $page_title ); 
  20.  
  21. if ( $echo ) 
  22. echo $page_title; 
  23. else 
  24. return $page_title;