|
1
|
|
|
<?php |
|
2
|
|
|
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); |
|
3
|
|
|
|
|
4
|
|
|
if ( defined( 'WP_ROCKET_VERSION' ) ) : |
|
5
|
|
|
/** |
|
6
|
|
|
* Excludes Auto Load Next Post scripts from JS minification. |
|
7
|
|
|
* |
|
8
|
|
|
* @since 1.5.10 |
|
9
|
|
|
* @param Array $excluded_js An array of JS handles enqueued in WordPress. |
|
10
|
|
|
* @return Array $excluded_js the updated array of handles. |
|
11
|
|
|
*/ |
|
12
|
|
|
function rocket_exclude_js_alnp( $excluded_js ) { |
|
13
|
|
|
$excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.js' ) ); |
|
14
|
|
|
$excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.min.js' ) ); |
|
15
|
|
|
$excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/frontend/auto-load-next-post.dev.js' ) ); |
|
16
|
|
|
$excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/libs/jquery.history.js' ) ); |
|
17
|
|
|
$excluded_js[] = str_replace( home_url(), '', plugins_url( '/auto-load-next-post/assets/js/libs/scrollspy.min.js' ) ); |
|
18
|
|
|
|
|
19
|
|
|
return $excluded_js; |
|
20
|
|
|
} |
|
21
|
|
|
add_filter( 'rocket_exclude_js', 'rocket_exclude_js_alnp' ); |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Excludes Auto Load Next Post JS files from defer JS |
|
25
|
|
|
* |
|
26
|
|
|
* @since 1.5.11 |
|
27
|
|
|
* @param Array $exclude_defer_js Array of JS filepaths to be excluded. |
|
28
|
|
|
* @return Array $exclude_defer_js the updated array of defer JS |
|
29
|
|
|
*/ |
|
30
|
|
|
function rocket_exclude_defer_js_alnp( $exclude_defer_js ) { |
|
31
|
|
|
$exclude_defer_js[] = rocket_clean_exclude_file( AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/frontend/auto-load-next-post.js' ); |
|
32
|
|
|
$exclude_defer_js[] = rocket_clean_exclude_file( AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/frontend/auto-load-next-post.min.js' ); |
|
33
|
|
|
$exclude_defer_js[] = rocket_clean_exclude_file( AUTO_LOAD_NEXT_POST_URL_PATH . '/assets/js/frontend/auto-load-next-post.dev.js' ); |
|
34
|
|
|
|
|
35
|
|
|
return $exclude_defer_js; |
|
36
|
|
|
} |
|
37
|
|
|
add_filter( 'rocket_exclude_defer_js', 'rocket_exclude_defer_js_alnp' ); |
|
38
|
|
|
|
|
39
|
|
|
endif; |
|
40
|
|
|
|