From 148b85591cffca55dc053e2528c11f211570a556 Mon Sep 17 00:00:00 2001 From: ultimatemember Date: Fri, 16 Jan 2015 13:55:26 +0200 Subject: [PATCH] Added option to exclude URLs from printing CSS/JS --- core/um-enqueue.php | 17 ++++++++++++++++- um-config.php | 9 +++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/core/um-enqueue.php b/core/um-enqueue.php index 7007215c..c2bf3350 100644 --- a/core/um-enqueue.php +++ b/core/um-enqueue.php @@ -12,7 +12,22 @@ class UM_Enqueue { *** @Enqueue scripts and styles ***/ function wp_enqueue_scripts(){ - + + global $ultimatemember; + + $exclude = um_get_option('js_css_exclude'); + if ( $exclude && is_array( $exclude ) ) { + + $c_url = untrailingslashit( $ultimatemember->permalinks->get_current_url(true) ); + + foreach( $exclude as $url ) { + $url = untrailingslashit( $url ); + if ( $url == $c_url ) + return; + } + + } + if ( um_get_option('disable_minify') ) { $this->load_original(); diff --git a/um-config.php b/um-config.php index 29e1a99d..6a0c6f19 100644 --- a/um-config.php +++ b/um-config.php @@ -1409,6 +1409,15 @@ $this->sections[] = array( 'desc' => __('Not recommended. This will load all plugin js and css files separately and may slow down your website. Use this setting for development or debugging purposes only.','ultimatemember'), ), + array( + 'id' => 'js_css_exclude', + 'type' => 'multi_text', + 'default' => array(), + 'title' => __( 'Exclude URLs from loading plugin CSS and JS' ), + 'desc' => __( 'Here you can exclude specific URLs from loading the plugin CSS and JS files.' ), + 'add_text' => __('Add New URL'), + ), + array( 'id' => 'allow_tracking', 'type' => 'switch',