This topic contains 6 reply and 2 voices, and was last updated by madegood 6 years, 8 months ago
Viewing 6 Posts - 1 through 6 (of 6 total)
Author Posts
May 30, 2013 at 5:57 pm 4358
madegood Hi, Please could you tell me how to prevent wpufe from loading external scripts when not necessary. For example, it is loading the following files on every page, when I only want them to load on a page with a form on; /wp-content/plugins/wp-user-frontend-pro/css/jquery-ui-1.9.1.custom.css?ver=3.5.1 /wp-content/plugins/wp-user-frontend-pro/js/jquery-ui-timepicker-addon.js?ver=3.5.1 /wp-content/plugins/wp-user-frontend-pro/js/frontend-form.js?ver=3.5.1 Thanks in advance Will
May 30, 2013 at 6:17 pm 4359
Tareq Hasan Tareq Hasan

When it’s loaded once, the browser will cache the scripts and will serve the scripts from cache for later requests. So will it make difference to exclude them?

May 30, 2013 at 6:23 pm 4361
madegood madegood

Hmmm, well it does make a difference because a majority of my users won’t be using the plugin. Those three scripts alone come to over 100kb, which is about 20% of the size of my homepage. It all adds up at, and ultimately is a significant load when speed is important.

Cheers

May 30, 2013 at 6:30 pm 4362
Tareq Hasan Tareq Hasan

check the wpuf.php enqueue_scripts function. wp_enqueue_script calls are adding the scripts in page. So if you load those scripts in specific pages, add this code
[php]
global $post;

if ( $post && (is_page( 133 ) || is_page( 34 )) ) {

}
[/php]

Now move the scripts into this if block and give the page ids to load them in specific pages.

May 30, 2013 at 6:34 pm 4364
madegood madegood

Okay, the function on around line 161, right? And I’m assuming I’ll have to redo this every time I upgrade?

Thanks for taking the time to look into this.

May 30, 2013 at 6:39 pm 4366
Tareq Hasan Tareq Hasan

Yes, 161 and you’ll have to do it everytime.

May 30, 2013 at 6:40 pm 4368
madegood madegood

Nice one

Viewing 6 Posts - 1 through 6 (of 6 total)