-
-
I need to load the Jquery theme at the end of the page footer.
I try editing the file
functions.php line 245.
Changing
wp_enqueue_script (‘jquery’);
by
wp_enqueue_script (‘jquery’,’/wp-includes/js/jquery/jquery.js’,”,”,true);
I also tried with:
wp_enqueue_script (‘jquery’)
wp_enqueue_script ($in_footer = true)
but none of the options worked.
Please. For results in loading speed I need the call to jquery.js file is loaded last, after all the others.
-
Hello,
Sorry for the delay!
Edit the file functions_tower.php.Find the function codeless_register_scripts().
Change the ‘false’ parameter to true, ex:wp_register_script('smoothscroll', SIMPLE_BASE_URL.'js/smoothscroll.js', array('jquery'), 1, true );
Best regards!
-
Hello, all script already are in “true” parameter.
Sorry, but this answer does not solve my problem. :(
- This reply was modified 8 years, 2 months ago by comunicaciondigitalgk.
-
Hello,
The scripts are already loaded in footer, not in header. The scripts you see in header are the ones that are generated from theme options.
Please read in this article: https://developer.wordpress.org/reference/functions/wp_register_script/ a more detailed explaination of the wp_enqueue_script() function, structure.As you can see, what you have tried earlier, adding this line: wp_enqueue_script ($in_footer = true); in the functions file, has no effect because that variable is already set to true in file functions-tower.php
What you missed is that $in_footer variable if set to ‘true’, will enqueue the scripts before
</body>
instead of in the<head>
. If set to the default ‘false’, then the scripts will enqueue inside the<head>
tag.Please see screenshot1 and screenshot2 the position of scripts. I have marked them in red line.
Best regards!
- This reply was modified 8 years, 2 months ago by Mirela.
-
Hi Mihaila, thanks for your response.
You see my problem is only one line of script, and is specifically for:
<script src="https://dimesahn.com/wp-includes/js/jquery/jquery.js?ver=1.12.4" type="text/javascript"></script><script type="text/javascript">
Which it is on line 9.
That line of code is the only one that is giving me problems “Pagespeed Insights” and is delaying loading the content.
Even in its demo version (CONSTRUCTION & BUILDINGS) which is precisely what I use for my website, the script appears inside the head:
How can I do to specifically charge that line of code in the footer?
-
Hello,
Sorry but this is not possible. I can recommend you to use other options to boost your site’s speed. Read this article for more detailed information:
Best regards!
-
You must be logged in to reply to this topic.