Changeset 2042
- Timestamp:
- 11/05/2015 06:50:05 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-apps/inc/extras.php
r843 r2042 37 37 38 38 /** 39 * Filters wp_title to print a neat <title> tagbased on what is being viewed.39 * Filters document title to add context based on what is being viewed. 40 40 * 41 * @param string $title Default title text for current view. 42 * @param string $sep Optional separator. 43 * @return string The filtered title. 41 * @param array $parts The document title parts. 42 * @return array The document title parts. 44 43 */ 45 function wpmobileapps_ wp_title( $title, $sep) {44 function wpmobileapps_document_title( $parts ) { 46 45 if ( is_feed() ) { 47 return $ title;46 return $parts; 48 47 } 49 48 50 49 global $page, $paged; 51 50 52 // Add the blog name53 $ title .= get_bloginfo( 'name', 'display' );51 $title = $parts['title']; 52 $sep = '|'; 54 53 55 54 // Add the blog description for the home/front page. 56 55 $site_description = get_bloginfo( 'description', 'display' ); 57 56 if ( $site_description && ( is_home() || is_front_page() ) ) { 58 $title .= " $sep $site_description";57 $title = $site_description; 59 58 } 60 59 61 60 // Add a page number if necessary: 62 if ( $paged >= 2 || $page>= 2 ) {63 $title .= " $sep " . sprintf( __( 'Page %s', 'wpmobileapps' ), max( $paged, $page ));61 if ( isset( $parts['page'] ) && $parts['page'] >= 2 ) { 62 $title .= " $sep " . sprintf( __( 'Page %s', 'wpmobileapps' ), $parts['page'] ); 64 63 } 65 64 66 return $title; 65 $parts['title'] = $title; 66 return $parts; 67 67 } 68 add_filter( ' wp_title', 'wpmobileapps_wp_title', 10, 2);68 add_filter( 'document_title_parts', 'wpmobileapps_document_title' ); 69 69 70 70 /**
Note: See TracChangeset
for help on using the changeset viewer.