single_cat_title

Display or retrieve page title for category archive.

Description

(string|void) single_cat_title( (string) $prefix = '', (bool) $display = true ); 

Useful for category template files for displaying the category page title. The prefix does not automatically place a space between the prefix, so if there should be a space, the parameter value will need to have it at the end.

Returns (string|void)

Title when retrieving.

Parameters (2)

0. $prefix — Optional. (string) => ''
What to display before the title.
1. $display — Optional. (bool) => true
Optional, default is true. Whether to display or retrieve title.

Usage

  1. if ( !function_exists( 'single_cat_title' ) ) { 
  2. require_once ABSPATH . WPINC . '/general-template.php'; 
  3.  
  4. // Optional. What to display before the title. 
  5. $prefix = ''; 
  6.  
  7. // Optional, default is true. Whether to display or retrieve title. 
  8. $display = true; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = single_cat_title($prefix, $display); 
  12.  

Defined (1)

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

/wp-includes/general-template.php  
  1. function single_cat_title( $prefix = '', $display = true ) { 
  2. return single_term_title( $prefix, $display );