Making WordPress.org


Ignore:
Timestamp:
01/17/2022 06:48:02 AM (3 years ago)
Author:
dd32
Message:

Themes: Use a new method to fetch the localised site name.

This is to remove the reliance upon $wporg_global_header_options.

See https://github.com/WordPress/wporg-mu-plugins/issues/42

File:
1 edited

Legend:

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

    r11215 r11451  
    284284 */
    285285function add_social_meta_tags() {
    286     global $wporg_global_header_options;
     286    $og_fields     = [];
    287287    $default_image = get_stylesheet_directory_uri() . '/images/social-image.png';
    288     $og_fields = [];
     288    $site_title    = function_exists( '\WordPressdotorg\site_brand' ) ? \WordPressdotorg\site_brand() : 'WordPress.org';
    289289
    290290    if ( is_front_page() || is_home() ) {
     
    292292            'og:title'       => __( 'Block Pattern Directory', 'wporg-patterns' ),
    293293            'og:description' => __( 'Add a beautifully designed, ready to go layout to any WordPress site with a simple copy/paste.', 'wporg-patterns' ),
    294             'og:site_name'   => $wporg_global_header_options['rosetta_title'] ?? 'WordPress.org',
     294            'og:site_name'   => $site_title,
    295295            'og:type'        => 'website',
    296296            'og:url'         => home_url(),
     
    301301            'og:title'       => sprintf( __( 'Block Patterns: %s', 'wporg-patterns' ), esc_attr( single_term_title( '', false ) ) ),
    302302            'og:description' => __( 'Add a beautifully designed, ready to go layout to any WordPress site with a simple copy/paste.', 'wporg-patterns' ),
    303             'og:site_name'   => esc_attr( $wporg_global_header_options['rosetta_title'] ?? 'WordPress.org' ),
     303            'og:site_name'   => $site_title,
    304304            'og:type'        => 'website',
    305305            'og:url'         => esc_url( get_term_link( get_queried_object_id() ) ),
     
    309309        $og_fields = [
    310310            'og:title'       => the_title_attribute( array( 'echo' => false ) ),
    311             'og:description' => esc_attr( strip_tags( get_post_meta( get_the_ID(), 'wpop_description', true ) ) ),
    312             'og:site_name'   => esc_attr( $wporg_global_header_options['rosetta_title'] ?? 'WordPress.org' ),
     311            'og:description' => strip_tags( get_post_meta( get_the_ID(), 'wpop_description', true ) ),
     312            'og:site_name'   => $site_title,
    313313            'og:type'        => 'website',
    314314            'og:url'         => esc_url( get_permalink() ),
Note: See TracChangeset for help on using the changeset viewer.