Making WordPress.org


Ignore:
Timestamp:
01/05/2015 05:24:12 PM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Use global header and footer.

See #745.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/functions.php

    r1034 r1084  
    110110
    111111/**
     112 * Create a nicely formatted and more specific title element text for output
     113 * in head of document, based on current view.
     114 *
     115 * @global int $paged WordPress archive pagination page count.
     116 * @global int $page  WordPress paginated post page count.
     117 *
     118 * @param string $title Default title text for current view.
     119 * @param string $sep Optional separator.
     120 * @return string The filtered title.
     121 */
     122function wporg_themes_wp_title( $title, $sep ) {
     123    global $paged, $page;
     124
     125    if ( is_feed() ) {
     126        return $title;
     127    }
     128
     129    // Add the site name.
     130    $title .= get_bloginfo( 'name', 'display' );
     131
     132    // Add the site description for the home/front page.
     133    $site_description = get_bloginfo( 'description', 'display' );
     134    if ( $site_description && ( is_home() || is_front_page() ) ) {
     135        $title = "$title $sep $site_description";
     136    }
     137
     138    // Add a page number if necessary.
     139    if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
     140        $title = "$title $sep " . sprintf( __( 'Page %s', 'wporg-themes' ), max( $paged, $page ) );
     141    }
     142
     143    return $title;
     144}
     145add_filter( 'wp_title', 'wporg_themes_wp_title', 10, 2 );
     146
     147/**
    112148 * @param  object $args
    113149 * @param  string $action
Note: See TracChangeset for help on using the changeset viewer.