Joshua David Nelson

Bullshit Free WordPress Development

  • Services
  • Code
  • About
  • Contact

Exclude Scripts from Scripts-to-Footer Plugin

For use with the Scripts to Footer plugin, allows you to place specific scripts back in the head. Can be useful if you have scripts that have to live specifically in the head section and cannot live in the footer.

<?php
/**
* Exclude scripts from Scripts to Footer plugin
* http://wordpress.org/plugins/scripts-to-footerphp/
*
* In this example, we will use jQuery (hosted on Google's servers even)
*/
add_action( 'wp_print_styles', 'jdn_deregister_scripts', 100 );
add_action( 'wp_head', 'jdn_head_scripts' );
function jdn_deregister_scripts() {
wp_deregister_script( 'jquery' ); // The slug or name used to enqueue the script
}
function jdn_head_scripts() { // The html for the script that will be placed in the header
?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<?php
}
view raw exclude-scripts.php hosted with ❤ by GitHub

Source: https://gist.github.com/joshuadavidnelson/8543278

Tags: plugin, scripts, scripts-to-footer, wp_head

Previous Code:
Check If Post Type Supports Archives
Back to the Code Snippets
Next Code:
Post Avatars in Entry Header in Genesis
  • Twitter
  • RSS Feed URL

About Me

I'm a WordPress Engineer. I build sleek, custom websites with WordPress and Genesis.

See my services and my recent work.

Contact me to get your project started.

Gravity Forms Plugin for WordPress Fastest WordPress Hosting

Recent Posts

  • Using Font Awesome Icons for WooCommerce Grid / List Toggle
  • Disable Blog: WordPress Gone Blog-less
  • Category (Taxonomy) Dropdown Filtered By Post Type
  • Weather in WordPress with Dark Sky
  • Fixing Your Deprecated Widget Constructors in WordPress 4.3
  • Twitter
  • RSS Feed URL
  • Code Snippets
  • My Plugins
  • Make a Payment

© Joshua David Nelson | Hand-Forged | WordPress + Genesis | Terms of Service | Legal | Contact