To do this in WordPress, just insert the following code anywhere in your theme’s
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_footer', 'wp_print_scripts', 5); add_action('wp_footer', 'wp_enqueue_scripts', 5); add_action('wp_footer', 'wp_print_head_scripts', 5);
This will cause all scripts and stylesheets to be moved from the header to the footer area.
To move just scripts from the header to the footer, use the following code instead:
remove_action('wp_head', 'wp_print_head_scripts', 9); add_action('wp_footer', 'wp_print_head_scripts', 5);
Moving scripts to the footer is a good way to speed up your website’s loading time. Note that moving stylesheets to the footer can cause some weird behaviour, like your website looking like an 80’s txt document before styling is applied.
WordPress – Showing cookie consent in commentsWordPress has a neat feature that allows visitors to save their details in the browser when commenting. This prevents repeated typing fatigue. However, this option might not show up under the comments – even if the option is checked in the Admin settings page.
WordPress – Fixing issues with comment form not movingSometimes, you might notice the comment form not moving underneath a comment as expected. I had a similar bug in one of my themes. I used the same functions and structures in two themes, but one had the comment form working properly, whereas in the other the comment form wasn’t moving. After spending hours trying […]
jQuery – Fixing HTML anchor tags with fixed navbarsYou may have noticed that your HTML # anchor tags no longer line up properly if you have a fixed navbar. It’s easily fixable with some simple jQuery.
SSH command cheatsheetI find myself frequently using SSH to perform commands that otherwise take painfully long over regular FTP. I keep the following cheatsheet nearby to help me out.
Bootstrap – Dealing with ‘File to import not found or unreadable’When importing Bootstrap files into your own sass, you might encounter this pesky error that might leave you scratching your head.