WordPress.org

Making WordPress.org

Changeset 7177


Ignore:
Timestamp:
05/02/2018 11:57:28 PM (17 months ago)
Author:
coreymckrill
Message:

WP15 theme: Add social media meta tags to the document head

Adds OpenGraph and Twitter tags.

Fixes #3600

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wp15.wordpress.net/public_html/content/themes/twentyseventeen-wp15/functions.php

    r7117 r7177  
    55defined( 'WPINC' ) || die();
    66
    7 add_filter( 'template_include',   __NAMESPACE__ . '\get_front_page_template' );
    8 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_scripts'         );
    9 add_filter( 'get_custom_logo',    __NAMESPACE__ . '\set_custom_logo'         );
    10 add_filter( 'body_class',         __NAMESPACE__ . '\add_body_classes'        );
     7add_filter( 'template_include',      __NAMESPACE__ . '\get_front_page_template'          );
     8add_action( 'wp_enqueue_scripts',    __NAMESPACE__ . '\enqueue_scripts'                  );
     9add_filter( 'get_custom_logo',       __NAMESPACE__ . '\set_custom_logo'                  );
     10add_filter( 'body_class',            __NAMESPACE__ . '\add_body_classes'                 );
    1111add_filter( 'the_title',             __NAMESPACE__ . '\internationalize_titles'          );
    1212add_filter( 'document_title_parts',  __NAMESPACE__ . '\internationalize_document_titles' );
    13 add_filter( 'wp_get_nav_menu_items', __NAMESPACE__ . '\internationalize_menu_items' );
     13add_filter( 'wp_get_nav_menu_items', __NAMESPACE__ . '\internationalize_menu_items'      );
     14add_action( 'wp_head',               __NAMESPACE__ . '\render_social_meta_tags'          );
    1415
    1516
     
    292293    );
    293294}
     295
     296/**
     297 * Output social media-related meta tags for the document header.
     298 */
     299function render_social_meta_tags() {
     300    ?>
     301    <meta property="og:type" content="website" />
     302    <meta property="og:title" content="<?php echo wp_get_document_title(); ?>" />
     303    <meta property="og:description" content="<?php echo internationalize_titles( 'WordPress turns 15 on May 27, 2018' ); ?>" />
     304    <meta property="og:url" content="https://wp15.wordpress.net/" />
     305    <meta property="og:site_name" content="<?php echo internationalize_titles( 'WP15' ); ?>" />
     306    <meta property="og:image" content="https://wp15.wordpress.net/content/uploads/2018/03/wp15-logo-square.png" />
     307    <meta property="og:locale" content="<?php echo get_locale(); ?>" />
     308    <meta name="twitter:card" content="summary" />
     309    <meta name="twitter:url" content="https://wp15.wordpress.net/" />
     310    <meta name="twitter:title" content="<?php echo wp_get_document_title(); ?>" />
     311    <meta name="twitter:description" content="<?php echo internationalize_titles( 'WordPress turns 15 on May 27, 2018' ); ?>" />
     312    <meta name="twitter:image" content="https://wp15.wordpress.net/content/uploads/2018/03/wp15-logo-square.png" />
     313    <?php
     314}
Note: See TracChangeset for help on using the changeset viewer.