twentyfourteen_wp_title

Create a nicely formatted and more specific title element text for output in head of document, based on current view.

Description

(string) twentyfourteen_wp_title( (string) $title, (string) $sep ); 

Returns (string)

The filtered title.

Parameters (2)

0. $title (string)
Default title text for current view.
1. $sep — Optional. (string)
Separator.

Usage

  1. if ( !function_exists( 'twentyfourteen_wp_title' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4. // Default title text for current view. 
  5. $title = ''; 
  6.  
  7. // Optional separator. 
  8. $sep = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = twentyfourteen_wp_title($title, $sep); 
  12.  

Defined (1)

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

/functions.php  
  1. function twentyfourteen_wp_title( $title, $sep ) { 
  2. global $paged, $page; 
  3.  
  4. if ( is_feed() ) { 
  5. return $title; 
  6.  
  7. // Add the site name. 
  8. $title .= get_bloginfo( 'name', 'display' ); 
  9.  
  10. // Add the site description for the home/front page. 
  11. $site_description = get_bloginfo( 'description', 'display' ); 
  12. if ( $site_description && ( is_home() || is_front_page() ) ) { 
  13. $title = "$title $sep $site_description"; 
  14.  
  15. // Add a page number if necessary. 
  16. if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { 
  17. $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); 
  18.  
  19. return $title;