Making WordPress.org

Changeset 12324


Ignore:
Timestamp:
12/14/2022 02:16:09 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: Restore the Locale banner on the plugin directory front page.

The validation rejects an empty plugin_slug, so the API was throwing an error instead of a language suggest.

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

Legend:

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

    r12098 r12324  
    9191
    9292    if ( ! is_404() ) {
    93         wp_enqueue_script( 'wporg-plugins-locale-banner', get_stylesheet_directory_uri() . '/js/locale-banner.js', array( 'jquery' ), '20200401', true );
     93        wp_enqueue_script( 'wporg-plugins-locale-banner', get_stylesheet_directory_uri() . '/js/locale-banner.js', array( 'jquery' ), filemtime( __DIR__ . '/js/locale-banner.js' ), true );
    9494        wp_localize_script( 'wporg-plugins-locale-banner', 'wporgLocaleBanner', array(
    9595            'apiURL'        => rest_url( '/plugins/v1/locale-banner' ),
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/locale-banner.js

    r9668 r12324  
    1010        url: wporgLocaleBanner.apiURL,
    1111        dataType: 'json',
    12         data: {
    13             'plugin_slug': wporgLocaleBanner.currentPlugin
    14         },
     12        data: wporgLocaleBanner.currentPlugin ? { 'plugin_slug': wporgLocaleBanner.currentPlugin } : {},
    1513        success: function ( response ) {
    1614            if ( ! response.suggest_string ) {
Note: See TracChangeset for help on using the changeset viewer.