Making WordPress.org


Ignore:
Timestamp:
02/16/2018 05:26:57 AM (7 years ago)
Author:
obenland
Message:

Main: Enqueue stats script to display charts.

See #3046.

File:
1 edited

Legend:

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

    r6652 r6654  
    7070
    7171/**
     72 * Enqueue scripts and styles.
     73 */
     74function scripts() {
     75    wp_enqueue_script( 'google-charts', 'https://www.gstatic.com/charts/loader.js', [], null, true );
     76    wp_enqueue_script( 'wporg-page-stats', get_theme_file_uri( '/js/page-stats.js' ), [ 'jquery', 'google-charts'], 1, true );
     77    wp_localize_script( 'wporg-page-stats', 'wporgPageStats', [
     78        'trunk'         => number_format( WP_CORE_STABLE_BRANCH + 0.1, 1 ), /* trunk */
     79        'beta'          => number_format( WP_CORE_STABLE_BRANCH + 0.2, 1 ), /* trunk w/ beta-tester plugin */
     80        'wpVersions'    => ___( 'WordPress Version', 'wporg' ),
     81        'phpVersions'   => ___( 'PHP Versions', 'wporg' ),
     82        'mysqlVersions' => ___( 'MySQL Version', 'wporg' ),
     83        'locales'       => ___( 'Locales', 'wporg' ),
     84    ] );
     85}
     86add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\scripts' );
     87
     88/**
    7289 * Extend the default WordPress body classes.
    7390 *
Note: See TracChangeset for help on using the changeset viewer.