Making WordPress.org


Ignore:
Timestamp:
10/21/2019 03:06:42 AM (6 years ago)
Author:
dd32
Message:

Theme Directory: Sync the page titles between PHP and JS.

See #4680.

File:
1 edited

Legend:

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

    r9197 r9212  
    106106        wp_enqueue_script( 'wporg-theme', get_template_directory_uri() . "/js/theme{$suffix}.js", array( 'wp-backbone' ), '20191016', true );
    107107
     108        // Use the Rosetta-specific site name. Ie. "WordPress.org $LOCALE"
     109        $title_suffix = isset( $GLOBALS['wporg_global_header_options']['rosetta_title'] ) ? $GLOBALS['wporg_global_header_options']['rosetta_title'] : 'WordPess.org';
     110
    108111        wp_localize_script( 'wporg-theme', '_wpThemeSettings', array(
    109112            'themes'   => false,
    110113            'query'    => wporg_themes_get_themes_for_query(),
    111114            'settings' => array(
    112                 /* translators: %s: theme name */
    113115                'title'        => array(
    114                     'default' => __( '%s | WordPress.org', 'wporg-themes' ),
    115                     'theme'   => '%s - ' . sprintf( __( '%s | WordPress.org', 'wporg-themes' ), __( 'WordPress theme', 'wporg-themes' ) ),
     116                    'default'  => "%s | ${title_suffix}",
     117                    'theme'    => '%s - ' . __( 'WordPress theme', 'wporg-themes' ) . " | ${title_suffix}",
     118                    /* translators: %s: theme author name */
     119                    'author'   => sprintf(
     120                            __( 'Themes by %s', 'wporg-themes' ),
     121                            // The Javascript doesn't handle the author route, so we can just hard-code the author name in here for now.
     122                            is_author() ? ( get_queried_object()->display_name ?: get_queried_object()->user_nicename ) : '%s'
     123                    ) . " | ${title_suffix}",
     124                    /* translators: %s: Category/Browse section */
     125                    'tax'      => __( 'WordPress Themes: %s Free', 'wporg-themes' ) . " | ${title_suffix}",
     126                    /* translators: %s: Search term */
     127                    'search'   => __( 'Search Results for “%s”', 'wporg-themes' ) . " | ${title_suffix}",
     128                    'notfound' => __( 'Page not found', 'wporg-themes' ) . " | ${title_suffix}",
    116129                ),
    117130                'isMobile'     => wp_is_mobile(),
     
    211224        $title['title']   = __( 'WordPress Themes', 'wporg-themes' );
    212225        $title['tagline'] = __( 'WordPress.org', 'wporg-themes' );
    213     } elseif ( is_category() || is_tag() ) {
     226    } elseif ( is_category() || is_tag() || is_tax() ) {
    214227        /* translators: Category or tag name */
    215228        $title['title'] = sprintf(
Note: See TracChangeset for help on using the changeset viewer.