Scripts To Footer - Version 0.6.3

Version Description

Moved the 'set_header_scripts' function into a 'wp_head' add_action to allow for conditional checks to work within the 'stf_exclude_scripts' filter.

Download this release

Release Info

Developer joshuadnelson
Plugin Icon wp plugin Scripts To Footer
Version 0.6.3
Comparing to
See all releases

Code changes from version 0.6.2 to 0.6.3

CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
  ### Changelog
2
 
 
 
 
3
  ##### 0.6.2
4
  Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)
5
 
1
  ### Changelog
2
 
3
+ ##### 0.6.3 - 9-12-18
4
+ Moved the 'set_header_scripts' function into a 'wp_head' add_action to allow for conditional checks to work within the 'stf_exclude_scripts' filter.
5
+
6
  ##### 0.6.2
7
  Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)
8
 
README.md CHANGED
@@ -32,4 +32,4 @@ Download for your WordPress site here: [http://wordpress.org/plugins/scripts-to-
32
 
33
  ### Donate
34
 
35
- Like this plugin and feeling generous? Please consdier [donating](http://joshuadnelson.com/donate) to support freelance development.
32
 
33
  ### Donate
34
 
35
+ Like this plugin and feeling generous? Please consider [donating](http://joshuadnelson.com/donate) to support freelance development.
admin/admin-settings.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package Scripts_To_Footer
6
  * @subpackage Scripts_To_Footer_Settings
7
  * @author Joshua David Nelson <josh@joshuadnelson.com>
8
- * @copyright Copyright (c) 2015, Joshua David Nelson
9
  * @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
10
  * @link http://joshuadnelson.com/scripts-to-footer-plugin
11
  **/
5
  * @package Scripts_To_Footer
6
  * @subpackage Scripts_To_Footer_Settings
7
  * @author Joshua David Nelson <josh@joshuadnelson.com>
8
+ * @copyright Copyright (c) 2018, Joshua David Nelson
9
  * @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
10
  * @link http://joshuadnelson.com/scripts-to-footer-plugin
11
  **/
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Scripts To Footer ===
2
  Contributors: joshuadnelson
3
  Tags: javascript, footer, speed, head, performance
4
- Donate link: https://joshuadnelson.com/donate
5
  Requires at least: 3.1.0
6
- Tested up to: 4.9
7
- Stable tag: 0.6.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -38,6 +38,8 @@ function jdn_header_scripts( $scripts ) {
38
 
39
  You will need the correct script slug, which is used when the script is registered, and the script will only be printed into the header *if it's enqueued*. Check out the scripts that come registered [out-of-the-box with WordPress](http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_Scripts_Included_and_Registered_by_WordPress).
40
 
 
 
41
  = Custom Post Type Support =
42
  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:
43
 
@@ -109,6 +111,9 @@ Please feel free to open a [Github Issue](https://github.com/joshuadavidnelson/s
109
 
110
  == Changelog ==
111
 
 
 
 
112
  = 0.6.2 =
113
  Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)
114
 
@@ -146,6 +151,9 @@ Initial release
146
 
147
  == Upgrade Notice ==
148
 
 
 
 
149
  = 0.6.2 =
150
  Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)
151
 
1
  === Scripts To Footer ===
2
  Contributors: joshuadnelson
3
  Tags: javascript, footer, speed, head, performance
4
+ Donate link: http://jdn.im/donate
5
  Requires at least: 3.1.0
6
+ Tested up to: 4.9.8
7
+ Stable tag: 0.6.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
38
 
39
  You will need the correct script slug, which is used when the script is registered, and the script will only be printed into the header *if it's enqueued*. Check out the scripts that come registered [out-of-the-box with WordPress](http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_Scripts_Included_and_Registered_by_WordPress).
40
 
41
+ **Note:** As of version 0.6.3, [conditional tags](https://codex.wordpress.org/Conditional_Tags) will work with the `stf_exclude_scripts` filter.
42
+
43
  = Custom Post Type Support =
44
  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:
45
 
111
 
112
  == Changelog ==
113
 
114
+ = 0.6.3 =
115
+ Moved the 'set_header_scripts' function into a 'wp_head' add_action to allow for conditional checks to work within the 'stf_exclude_scripts' filter.
116
+
117
  = 0.6.2 =
118
  Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)
119
 
151
 
152
  == Upgrade Notice ==
153
 
154
+ = 0.6.3 =
155
+ Moved the 'set_header_scripts' function into a 'wp_head' add_action to allow for conditional checks to work within the 'stf_exclude_scripts' filter.
156
+
157
  = 0.6.2 =
158
  Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)
159
 
scripts-to-footer.php CHANGED
@@ -4,14 +4,14 @@
4
  *
5
  * @package Scripts_To_Footer
6
  * @author Joshua David Nelson <josh@joshuadnelson.com>
7
- * @copyright Copyright (c) 2014, Joshua David Nelson
8
  * @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
9
  * @link http://joshuadnelson.com/scripts-to-footer-plugin
10
  *
11
  * Plugin Name: Scripts-To-Footer
12
  * Plugin URI: http://wordpress.org/plugins/scripts-to-footerphp/
13
  * Description: Moves scripts to the footer to decrease page load times, while keeping stylesheets in the header. Requires that plugins and theme correctly utilizes wp_enqueue_scripts hook. Can be disabled via a checkbox on specific pages and posts.
14
- * Version: 0.6.2
15
  * Author: Joshua David Nelson
16
  * Author URI: http://joshuadnelson.com
17
  * License: GPL2
@@ -185,6 +185,7 @@ class Scripts_To_Footer {
185
  * and plugin links.
186
  *
187
  * @since 0.2
 
188
  */
189
  function init() {
190
 
@@ -193,10 +194,10 @@ class Scripts_To_Footer {
193
  add_filter( 'stf_include', array( $this, 'stf_includes' ) );
194
 
195
  // Set the header scripts to be forced into the header
196
- $this->set_header_scripts();
197
 
198
  // Add select scripts into the header
199
- add_action( 'wp_head', array( $this, 'print_head_scripts' ) );
200
 
201
  // Add Links to Plugin Bar
202
  if( function_exists( 'stf_plugin_links' ) )
@@ -222,6 +223,7 @@ class Scripts_To_Footer {
222
  }
223
 
224
  $this->header_scripts = apply_filters( 'stf_exclude_scripts', $head_scripts );
 
225
  }
226
 
227
  /**
@@ -329,7 +331,7 @@ class Scripts_To_Footer {
329
  // Older override check, depreciated
330
  $excluded_override = apply_filters( 'scripts_to_footer_exclude_page', null, $queried_object_id );
331
  if( 'on' == $excluded_override || true == $excluded_override ) {
332
- $this->log_me( 'The scripts_to_footer_exclude_page is depreciated, please use stf_{$post_type} returning false to exclude');
333
  return false;
334
  }
335
 
@@ -541,7 +543,7 @@ if( !function_exists( 'stf_plugin_links' ) ) {
541
 
542
  $links[] = '<a href="https://github.com/joshuadavidnelson/scripts-to-footer/wiki" title="' . __( 'Documentation', STF_DOMAIN ) . '" target="_blank">' . __( 'Documentation', STF_DOMAIN ) . '</a>';
543
 
544
- $links[] = '<a href="https://joshuadnelson.com/donate" title="' . __( 'Donate', STF_DOMAIN ) . '">' . __( 'Donate', STF_DOMAIN ) . '</a>';
545
  }
546
 
547
  return $links;
4
  *
5
  * @package Scripts_To_Footer
6
  * @author Joshua David Nelson <josh@joshuadnelson.com>
7
+ * @copyright Copyright (c) 2018, Joshua David Nelson
8
  * @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
9
  * @link http://joshuadnelson.com/scripts-to-footer-plugin
10
  *
11
  * Plugin Name: Scripts-To-Footer
12
  * Plugin URI: http://wordpress.org/plugins/scripts-to-footerphp/
13
  * Description: Moves scripts to the footer to decrease page load times, while keeping stylesheets in the header. Requires that plugins and theme correctly utilizes wp_enqueue_scripts hook. Can be disabled via a checkbox on specific pages and posts.
14
+ * Version: 0.6.3
15
  * Author: Joshua David Nelson
16
  * Author URI: http://joshuadnelson.com
17
  * License: GPL2
185
  * and plugin links.
186
  *
187
  * @since 0.2
188
+ * @since 0.6.3 moved 'set_header_scripts' into 'wp_head' action.
189
  */
190
  function init() {
191
 
194
  add_filter( 'stf_include', array( $this, 'stf_includes' ) );
195
 
196
  // Set the header scripts to be forced into the header
197
+ add_action( 'wp_head', array( $this, 'set_header_scripts' ), 1 );
198
 
199
  // Add select scripts into the header
200
+ add_action( 'wp_head', array( $this, 'print_head_scripts' ), 10 );
201
 
202
  // Add Links to Plugin Bar
203
  if( function_exists( 'stf_plugin_links' ) )
223
  }
224
 
225
  $this->header_scripts = apply_filters( 'stf_exclude_scripts', $head_scripts );
226
+
227
  }
228
 
229
  /**
331
  // Older override check, depreciated
332
  $excluded_override = apply_filters( 'scripts_to_footer_exclude_page', null, $queried_object_id );
333
  if( 'on' == $excluded_override || true == $excluded_override ) {
334
+ $this->log_me( 'The \'scripts_to_footer_exclude_page\' is depreciated, please use \'stf_{$post_type}\' returning false to exclude the page.');
335
  return false;
336
  }
337
 
543
 
544
  $links[] = '<a href="https://github.com/joshuadavidnelson/scripts-to-footer/wiki" title="' . __( 'Documentation', STF_DOMAIN ) . '" target="_blank">' . __( 'Documentation', STF_DOMAIN ) . '</a>';
545
 
546
+ $links[] = '<a href="http://jdn.im/donate" title="' . __( 'Donate', STF_DOMAIN ) . '">' . __( 'Donate', STF_DOMAIN ) . '</a>';
547
  }
548
 
549
  return $links;
uninstall.php CHANGED
@@ -5,7 +5,7 @@
5
  * @package Scripts_To_Footer
6
  * @subpackage Uninstall
7
  * @author Joshua David Nelson <josh@joshuadnelson.com>
8
- * @copyright Copyright (c) 2014, Joshua David Nelson
9
  * @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
10
  * @link http://joshuadnelson.com/scripts-to-footer-plugin
11
  *
5
  * @package Scripts_To_Footer
6
  * @subpackage Uninstall
7
  * @author Joshua David Nelson <josh@joshuadnelson.com>
8
+ * @copyright Copyright (c) 2018, Joshua David Nelson
9
  * @license http://www.opensource.org/licenses/gpl-license.php GPL-2.0+
10
  * @link http://joshuadnelson.com/scripts-to-footer-plugin
11
  *