Skip to content

Commit 42be75e

Browse files
authored
Update wp-bootstrap-loader.php
1 parent 08058d9 commit 42be75e

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

wp-bootstrap-loader.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
// Exit if accessed directly.
88
if ( ! defined( 'ABSPATH' ) ) { exit; }
9+
910
if ( ! class_exists( 'WP_Bootstrap_Loader' ) ) {
1011

1112
/**
@@ -25,8 +26,8 @@ function __construct() {
2526
add_action( 'wp_enqueue_scripts', array( $this, 'bootstrap_scripts' ) );
2627

2728
// Async & Defer.
28-
add_filter('script_loader_tag', array( $this, 'bootstrap_async' ), 10, 2);
29-
add_filter('script_loader_tag', array( $this, 'jquery_migrate_async' ), 10, 3);
29+
add_filter( 'script_loader_tag', array( $this, 'bootstrap_async' ), 10, 2);
30+
add_filter( 'script_loader_tag', array( $this, 'jquery_migrate_async' ), 10, 3);
3031

3132
// Load Bootstrap for WordPress Editor.
3233
add_action( 'admin_init', array( $this, 'bootstrap_editor_css' ) );
@@ -40,9 +41,8 @@ function __construct() {
4041
* @return void
4142
*/
4243
function bootstrap_async($tag, $handle) {
43-
if ( 'bootstrap' !== $handle ) {
44+
if ( 'bootstrap' !== $handle )
4445
return $tag;
45-
}
4646
return str_replace( ' src', ' async="async" src', $tag );
4747
}
4848

@@ -55,9 +55,8 @@ function bootstrap_async($tag, $handle) {
5555
* @return void
5656
*/
5757
function jquery_migrate_async( $tag, $handle ) {
58-
if ( 'jquery-migrate' !== $handle ) {
58+
if ( 'jquery-migrate' !== $handle )
5959
return $tag;
60-
}
6160
return str_replace( ' src', ' defer="defer" src', $tag );
6261
}
6362

@@ -69,22 +68,17 @@ function jquery_migrate_async( $tag, $handle ) {
6968
*/
7069
function bootstrap_scripts() {
7170
if ( ! is_admin() ) {
72-
7371
// Twitter Bootstrap CSS.
7472
wp_register_style( 'bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css', '', null, 'all' );
7573
wp_enqueue_style( 'bootstrap' );
76-
7774
// Load jQuery.
7875
wp_enqueue_script( 'jquery' );
79-
8076
// Twitter Bootstrap Javascript.
8177
wp_register_script( 'bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js', 'jquery', null, true );
8278
wp_enqueue_script( 'bootstrap' );
83-
8479
// Google Webfont.
8580
wp_register_script( 'webfont', 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js', null, null, true );
8681
wp_enqueue_script( 'webfont' );
87-
8882
// Load Font Awesome via Google Webfont.
8983
wp_add_inline_script( 'webfont', 'WebFont.load({custom:{families:["font-awesome"],urls:["https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"]}});' );
9084
}

0 commit comments

Comments
 (0)