Making WordPress.org

Changeset 7933


Ignore:
Timestamp:
12/04/2018 06:53:56 PM (6 years ago)
Author:
coffee2code
Message:

Developer: Prevent inclusion of multiple dashicons CSS files.

See #3753.

File:
1 edited

Legend:

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

    r7864 r7933  
    132132add_action( 'init', __NAMESPACE__ . '\\init' );
    133133add_action( 'widgets_init', __NAMESPACE__ . '\\widgets_init' );
     134add_action( 'wp_default_styles', __NAMESPACE__ . '\\remove_dashicons_styles', 11 );
    134135
    135136function init() {
     
    155156
    156157    add_filter( 'syntaxhighlighter_htmlresult', __NAMESPACE__ . '\\syntaxhighlighter_htmlresult' );
     158}
     159
     160/**
     161 * Makes 'dashicons' a noop script on the frontend to prevent getting enqueued.
     162 *
     163 * The global W.org header already includes the dashicons stylesheet.
     164 *
     165 * @param WP_Scripts $scripts WP_Scripts object.
     166 */
     167function remove_dashicons_styles( &$scripts ) {
     168    if ( ! is_admin() ) {
     169        $scripts->remove( 'dashicons' );
     170        $scripts->add( 'dashicons', '' );
     171    }
    157172}
    158173
Note: See TracChangeset for help on using the changeset viewer.