WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Scripts To Footer

This small plugin moves scripts to the footer to help speed up page load times, while keeping stylesheets in the header.

This small plugin moves scripts to the footer to help speed up page load times, while keeping stylesheets in the header. Note that this only works if you have plugins and a theme that utilizes wp_enqueue_scripts correctly.

Now includes an option to disable the plugin on a specific page or post.

Custom Post Type Support

If you're comfortable with code you can use the scripts_to_footer_post_types filter to change the post types this applies to (it only applies to pages and posts by default). For example, if you have a custom post type called "project" you could add support for this metabox via the post type filter like this:

function stf_add_cpt_support( $post_types ) {
    $post_types[] = 'project';
    
    return $post_types;
}
add_filter( 'scripts_to_footer_post_types', 'stf_add_cpt_support' );

Excluding Pages/Posts Via Filter

As of version 0.5 you can either use the checkbox option to disable the plugin's action on a specific page/post, or you can utilize a filter. The filter also passes the post/page id, which might be useful for more advanced development. For example:

function stf_exclude_my_page( $exclude_page, $post_id ) {
    if( is_front_page() ) {
        $exclude_page = 'on'; // this turns on the "exclude" option
    }
    return $exclude_page;
}
add_filter( 'scripts_to_footer_exclude_page', 'stf_exclude_my_page' );

View on GitHub

View this plugin on GitHub

Requires: 3.6 or higher
Compatible up to: 3.9.1
Last Updated: 2014-6-3
Downloads: 14,254

Ratings

4 stars
4.9 out of 5 stars

Support

5 of 6 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

1 person says it works.
0 people say it's broken.

100,2,2
100,1,1
100,1,1
100,1,1
100,1,1
100,1,1