Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Thread Starter
sabash
(@sabash)
With version 3.9 does not work (((
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
What error were you getting?
Thread Starter
sabash
(@sabash)
Errors are not shown, but disappeared almost all widgets <script> remained in the same place. I probyval move <? Php wp_head (); ?> From header.php to footer.php – but no longer displayed slider.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Thread Starter
sabash
(@sabash)
Andrew, please tell me what I should do as well, I installed the plugin “scripts-to-footerphp”, but nothing poimenyalos. Script remained at the same place.
91-107 codes are identical to those that I have.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Put the plugin in the bin if it doesn’t work (delete it), then create a Child Theme: http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme
Then create a “functions.php” file in your Child Theme folder and within that file put this code:
<?php
/**
* Remove scripts from header, forces them to the footer.
*
* First checks to see if the current post type is excluded via the custom meta box, if so then it doesn't run.
*
* @since 0.1
**/
function clean_head() {
$excluded_pages = get_post_meta( get_queried_object_id(), 'stf_exclude', true );
if( 'on' != $excluded_pages ) {
remove_action( 'wp_head', 'wp_print_scripts' );
remove_action( 'wp_head', 'wp_print_head_scripts', 9 );
remove_action( 'wp_head', 'wp_enqueue_scripts', 1 );
}
}
add_action( 'wp_enqueue_scripts', 'clean_head' );
?>
Then active your Child Theme in the themes section of the dashboard.
Thread Starter
sabash
(@sabash)
Andrew, I think that “Child Theme” does not help me transfer <script> in the footer.
Andrew Nevins
(@anevins)
WCLDN 2018 Contributor | Volunteer support
Not sure what sort of answer you’re expecting.
Thread Starter
sabash
(@sabash)
Andrew, can you tell me how to “sidebar” close from indexing <noindex>?!
I’m dealing with the same issue. I have a live website: http://balletuin.nl and a “test” website: http://balletuin.multimedia-webdesign.nl, wich is an exact copy of the live version. According to Google Pagespeed the code above the fold needs to be moved to the footer.
I think the adjustment Andrew gives applies to WordPress code only and not for css and js from third party plugins. Am I correct?
My child theme’s functions.php at the test site contains Andrew’s code, but nevertheless Pagespeed claims that there’s is too much code blocking the page from running smoothly.