Changeset 6233 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php
- Timestamp:
- 12/04/2017 06:04:49 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/functions.php
r6231 r6233 60 60 function scripts() { 61 61 $suffix = is_rtl() ? '-rtl' : ''; 62 wp_enqueue_style( 'wporg-plugins-style', get_template_directory_uri() . "/css/style{$suffix}.css", array(), '20171124' );62 wp_enqueue_style( 'wporg-plugins-style', get_template_directory_uri() . "/css/style{$suffix}.css", ['open-sans'], '20171124' ); 63 63 64 64 wp_enqueue_script( 'wporg-plugins-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true ); … … 115 115 } 116 116 117 // No Jetpack scripts needed. 118 add_filter( 'jetpack_implode_frontend_css', '__return_false' ); 119 wp_dequeue_script( 'devicepx' ); 117 120 } 118 121 add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\scripts' ); 122 123 /** 124 * Filters an enqueued script & style's fully-qualified URL. 125 * 126 * @param string $src The source URL of the enqueued script/style. 127 * @param string $handle The style's registered handle. 128 * @return string 129 */ 130 function loader_src( $src, $handle ) { 131 $cdn_urls = [ 132 'dashicons', 133 'wp-embed', 134 // 'wporg-plugins-style', 135 'wporg-plugins-navigation', 136 'wporg-plugins-skip-link-focus-fix', 137 'wporg-plugins-popover', 138 'wporg-plugins-locale-banner', 139 'wporg-plugins-stats', 140 'wporg-plugins-client', 141 ]; 142 143 // Use CDN url. 144 if ( in_array( $handle, $cdn_urls, true ) ) { 145 $src = str_replace( get_home_url(), 'https://s.w.org', $src ); 146 } 147 148 // Remove version argument. 149 if ( in_array( $handle, ['open-sans'], true ) ) { 150 $src = remove_query_arg( 'ver', $src ); 151 } 152 153 return $src; 154 } 155 add_filter( 'style_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 ); 156 add_filter( 'script_loader_src', __NAMESPACE__ . '\loader_src', 10, 2 ); 119 157 120 158 /**
Note: See TracChangeset
for help on using the changeset viewer.