Changeset 30097 for trunk/src/wp-content/themes/twentyfifteen/functions.php
- Timestamp:
- 10/29/2014 09:55:24 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfifteen/functions.php
r30072 r30097 57 57 // Add default posts and comments RSS feed links to head. 58 58 add_theme_support( 'automatic-feed-links' ); 59 60 /* 61 * Let WordPress manage the document title. 62 * By adding theme support, we declare that this theme does not use a 63 * hard-coded <title> tag in the document head, and expect WordPress to 64 * provide it for us. 65 */ 66 add_theme_support( 'title-tag' ); 59 67 60 68 /* … … 227 235 228 236 /** 229 * Filters wp_title to print a neat <title> tag based on what is being viewed.230 *231 * @param string $title Default title text for current view.232 * @param string $sep Optional separator.233 * @return string The filtered title.234 */235 function twentyfifteen_wp_title( $title, $sep ) {236 if ( is_feed() ) {237 return $title;238 }239 240 global $page, $paged;241 242 // Add the blog name243 $title .= get_bloginfo( 'name', 'display' );244 245 // Add the blog description for the home/front page.246 $site_description = get_bloginfo( 'description', 'display' );247 if ( $site_description && ( is_home() || is_front_page() ) ) {248 $title .= " $sep $site_description";249 }250 251 // Add a page number if necessary:252 if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {253 $title .= " $sep " . sprintf( __( 'Page %s', 'twentyfifteen' ), max( $paged, $page ) );254 }255 256 return $title;257 }258 add_filter( 'wp_title', 'twentyfifteen_wp_title', 10, 2 );259 260 /**261 237 * Add featured image as background image to post navs. 262 238 *
Note: See TracChangeset
for help on using the changeset viewer.