Making WordPress.org

Changeset 9215


Ignore:
Timestamp:
10/21/2019 03:45:34 AM (4 years ago)
Author:
dd32
Message:

WordPess.org Rosetta Sites: Consistently set the homepage title to a translated variant of WordPress.org.

Fixes #4678.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-main/inc/page-meta-descriptions.php

    r9192 r9215  
    2727        } );
    2828
    29         $locale_native_name = $GLOBALS['rosetta']->rosetta->glotpress_locale->native_name;
     29        $site_title = isset( $GLOBALS['wporg_global_header_options']['rosetta_title'] ) ? $GLOBALS['wporg_global_header_options']['rosetta_title'] : 'WordPress.org';
    3030        return array(
    3131            'og:type'         => 'website',
    32             'og:title'        => __( 'Blog Tool, Publishing Platform, and CMS - WordPress', 'wporg' ),
     32            'og:title'        => __( 'Blog Tool, Publishing Platform, and CMS', 'wporg' ) . " - {$site_title}",
    3333            'og:description'  => __( 'Open source software which you can use to easily create a beautiful website, blog, or app.', 'wporg' ),
    3434            'description'     => __( 'Open source software which you can use to easily create a beautiful website, blog, or app.', 'wporg' ),
    3535            'og:url'          => home_url( '/' ),
    36             /* translators: %s - The Locale native name. */
    37             'og:site_name'    => sprintf( __( 'WordPress - %s', 'wporg' ), $locale_native_name ),
     36            'og:site_name'    => $site_title,
    3837            'og:image'        => 'https://s.w.org/images/home/screen-themes.png?3',
    3938            'og:locale'       => get_locale(),
     
    360359add_filter( 'the_title', __NAMESPACE__ . '\custom_page_title', 10, 2 );
    361360add_filter( 'single_post_title', __NAMESPACE__ . '\custom_page_title', 10, 2 );
     361
     362/**
     363 * Set the document title on the front page.
     364 */
     365function document_title_parts( $title ) {
     366    if ( isset( $title['site'] ) || is_front_page() ) {
     367        $title['site'] = 'WordPress.org'; // Rosetta will replace as needed.
     368    }
     369
     370    if ( is_front_page() ) {
     371        $title['title'] = __( 'Blog Tool, Publishing Platform, and CMS', 'wporg' );
     372    }
     373
     374    return $title;
     375}
     376add_filter( 'document_title_parts', __NAMESPACE__ . '\document_title_parts' );
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/functions.php

    r9180 r9215  
    7272    $GLOBALS['pagetitle'] = wp_get_document_title();
    7373}
    74 add_action( 'template_redirect', __NAMESPACE__ . '\set_document_title' );
     74add_action( 'get_header', __NAMESPACE__ . '\set_document_title', 10 );
    7575
    7676/**
Note: See TracChangeset for help on using the changeset viewer.