Scripts To Footer - Version 0.6.2

Version Description

Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)

Download this release

Release Info

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

Code changes from version 0.6.1 to 0.6.2

Files changed (5) hide show
  1. CHANGELOG.md +3 -0
  2. README.md +1 -1
  3. admin/admin-settings.php +27 -0
  4. readme.txt +24 -23
  5. scripts-to-footer.php +8 -4
CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
  ### Changelog
2
 
 
 
 
3
  ##### 0.6.1
4
  Updates custom taxonomy check for custom taxonomy archives and some error logging functions.
5
 
1
  ### Changelog
2
 
3
+ ##### 0.6.2
4
+ Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)
5
+
6
  ##### 0.6.1
7
  Updates custom taxonomy check for custom taxonomy archives and some error logging functions.
8
 
README.md CHANGED
@@ -28,7 +28,7 @@ Download for your WordPress site here: [http://wordpress.org/plugins/scripts-to-
28
  - See number 2.
29
 
30
  4. My Page Speed hasn't improved (or it's worse)
31
- - Actually, this plugin should not change your actual page speed - the same scripts are being loaded, that takes the same amount of time. However, by placing scripts in the footer you can change the _precieved_ load times, moving [render-blocking scripts](https://developers.google.com/speed/docs/insights/BlockingJS) below the fold, allowing your content to load first - instead of loading scripts and slowing the visual portions of your site. That's the whole point. Outside of that, this plugin is not intended to decrease page load speed or minify scripts in anyway.
32
 
33
  ### Donate
34
 
28
  - See number 2.
29
 
30
  4. My Page Speed hasn't improved (or it's worse)
31
+ - This plugin should not change your actual page speed - the same scripts are being loaded, that takes the same amount of time. However, by placing scripts in the footer you can change the _precieved_ load times, moving [render-blocking scripts](https://developers.google.com/speed/docs/insights/BlockingJS) below the fold, allowing your content to load first - instead of loading scripts and slowing the visual portions of your site. That's the whole point. Outside of that, this plugin is not intended to decrease page load speed or minify scripts in anyway. **Ultimately, your page speed score is based on more than where you load your scripts and can be altered by moving them, but depending on what these scripts do it can go either way**. As with most things, it entirely depends on the unique configuration of your site.
32
 
33
  ### Donate
34
 
admin/admin-settings.php CHANGED
@@ -124,6 +124,15 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
124
  'exclude_options'
125
  );
126
 
 
 
 
 
 
 
 
 
 
127
  // Post Type Archives options
128
  add_settings_field(
129
  'stf_post_type_archives',
@@ -182,6 +191,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
182
  * Sanitize each setting field as needed
183
  *
184
  * @since 0.6.0
 
185
  *
186
  * @param array $input Contains all settings fields as array keys
187
  */
@@ -192,9 +202,13 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
192
 
193
  if( isset( $input['stf_exclude_search'] ) )
194
  $new_input['stf_exclude_search'] = absint( $input['stf_exclude_search'] );
 
 
 
195
 
196
  if( isset( $input['stf_exclude_archive'] ) )
197
  $new_input['stf_exclude_archive'] = absint( $input['stf_exclude_archive'] );
 
198
  if( isset( $input['stf_exclude_author_archive'] ) )
199
  $new_input['stf_exclude_author_archive'] = absint( $input['stf_exclude_author_archive'] );
200
 
@@ -299,6 +313,19 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
299
 
300
  }
301
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  /**
303
  * Get the settings option array and print one of its values.
304
  *
124
  'exclude_options'
125
  );
126
 
127
+ // Search Results option
128
+ add_settings_field(
129
+ 'stf_404',
130
+ '404 pages',
131
+ array( $this, 'stf_404' ),
132
+ 'stf-settings',
133
+ 'exclude_options'
134
+ );
135
+
136
  // Post Type Archives options
137
  add_settings_field(
138
  'stf_post_type_archives',
191
  * Sanitize each setting field as needed
192
  *
193
  * @since 0.6.0
194
+ * @since 0.6.2 added 404 support
195
  *
196
  * @param array $input Contains all settings fields as array keys
197
  */
202
 
203
  if( isset( $input['stf_exclude_search'] ) )
204
  $new_input['stf_exclude_search'] = absint( $input['stf_exclude_search'] );
205
+
206
+ if( isset( $input['stf_exclude_404'] ) )
207
+ $new_input['stf_exclude_404'] = absint( $input['stf_exclude_404'] );
208
 
209
  if( isset( $input['stf_exclude_archive'] ) )
210
  $new_input['stf_exclude_archive'] = absint( $input['stf_exclude_archive'] );
211
+
212
  if( isset( $input['stf_exclude_author_archive'] ) )
213
  $new_input['stf_exclude_author_archive'] = absint( $input['stf_exclude_author_archive'] );
214
 
313
 
314
  }
315
 
316
+ /**
317
+ * Get the settings option array and print one of its values.
318
+ *
319
+ * @since 0.6.2
320
+ */
321
+ public function stf_404() {
322
+ if( !isset( $this->options['stf_exclude_404'] ) )
323
+ $this->options['stf_exclude_404'] = 0;
324
+
325
+ echo '<input type="checkbox" name="' . STF_SETTINGS_FIELD . '[stf_exclude_404]" ' . checked( $this->options['stf_exclude_404'], 1, false ) . ' value="1">';
326
+
327
+ }
328
+
329
  /**
330
  * Get the settings option array and print one of its values.
331
  *
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Scripts To Footer ===
2
  Contributors: joshuadnelson
3
- Tags: javascript, scripts, wp_enqueue_scripts, footer, speed, head, performance, jquery, seo
4
- Donate link: http://jdn.im/donate
5
  Requires at least: 3.1.0
6
- Tested up to: 4.8
7
- Stable tag: 0.6.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -18,11 +18,7 @@ You can disable the plugin on specific pages and posts directly via the post/pag
18
 
19
  You can disable the plugin on specific archive pages (blog page, search page, post type and taxonomy archives) via the settings page.
20
 
21
- = Sometimes moving scripts breaks something. =
22
-
23
- There are many javascript-based plugins like many sliders, some social media sharing scripts, that rely on jQuery to be loaded prior to the HTML elements. This is so common, I've created an option to fix it. If you experience issues, click the "Keep jQuery in Header" option in Settings > Scripts to Footer.
24
-
25
- If that doesn't work, refer to the walkthrough below for using the `stf_exclude_scripts` filter for the script that is causing the issue.
26
 
27
  Check out the [documentation](https://github.com/joshuadavidnelson/scripts-to-footer/wiki) on [GitHub](https://github.com/joshuadavidnelson/scripts-to-footer) or some quick walkthroughs below.
28
 
@@ -113,23 +109,25 @@ Please feel free to open a [Github Issue](https://github.com/joshuadavidnelson/s
113
 
114
  == Changelog ==
115
 
 
 
 
116
  = 0.6.1 =
117
- * Fix bug with custom taxonomy archive include filter
118
- * Clean up all taxonomy archive conditional statements and corresponding error logging
119
 
120
  = 0.6.0 =
121
  Large number of improvements:
122
- * Add settings page with global disable options for home page, search pages, post type archives, taxonomy archives, and other archives.
123
- * Update uninstall.php to remove things correctly.
124
- * Add FAQ to readme.txt and readme.md.
125
- * Add a changelog as a separate file.
126
- * Change the custom post type filter. Refer to updated [FAQ](https://github.com/joshuadavidnelson/scripts-to-footer/#faq) and [documentation](https://github.com/joshuadavidnelson/scripts-to-footer/wiki).
127
- * Add support for custom taxonomy archives.
128
- * Change the exclude filter, to be more relevant to the new options. Older filter is depreciated, but still supported (for now).
129
- * Update the post meta for disabling the plugin on specific posts/pages.
130
- * Add Github Updater support.
131
- * Removed CMB and built metaboxes the old fashion way.
132
- * Added debug logging to better track any potential errors moving forward.
133
 
134
  = 0.5 =
135
  Reverted metabox version to previous - invalid error was sneaking through.
@@ -148,8 +146,11 @@ Initial release
148
 
149
  == Upgrade Notice ==
150
 
 
 
 
151
  = 0.6.1 =
152
- Updates custom taxonomy check for custom taxonomy archives and some error logging functions.
153
 
154
  = 0.6 =
155
  Large improvements, including: a settings page to resolve issues on archives and blog roll pages, setting to keep jQuery in the header, and updated filters. Refer to the documentation if you are using a filter currently, as they have changed, prior to updating.
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
 
18
 
19
  You can disable the plugin on specific archive pages (blog page, search page, post type and taxonomy archives) via the settings page.
20
 
21
+ **Everything Broken?** Try placing jQuery back into the header via Settings > Scripts to Footer, "Keep jQuery in the Header" checkbox. If that doesn't work, refer to the walkthrough below for using the `stf_exclude_scripts` filter for the script that is causing the issue.
 
 
 
 
22
 
23
  Check out the [documentation](https://github.com/joshuadavidnelson/scripts-to-footer/wiki) on [GitHub](https://github.com/joshuadavidnelson/scripts-to-footer) or some quick walkthroughs below.
24
 
109
 
110
  == Changelog ==
111
 
112
+ = 0.6.2 =
113
+ Added support for disabling plugin on 404 pages, thanks to Alex (@piscis on GitHub)
114
+
115
  = 0.6.1 =
116
+ Updates custom taxonomy check for custom taxonomy archives and some error logging functions.
 
117
 
118
  = 0.6.0 =
119
  Large number of improvements:
120
+ - Add settings page with global disable options for home page, search pages, post type archives, taxonomy archives, and other archives.
121
+ - Update uninstall.php to remove things correctly.
122
+ - Add FAQ to readme.txt and readme.md.
123
+ - Add a changelog as a separate file.
124
+ - Change the custom post type filter. Refer to updated [FAQ](https://github.com/joshuadavidnelson/scripts-to-footer/#faq) and [documentation](https://github.com/joshuadavidnelson/scripts-to-footer/wiki).
125
+ - Add support for custom taxonomy archives.
126
+ - Change the exclude filter, to be more relevant to the new options. Older filter is depreciated, but still supported (for now).
127
+ - Update the post meta for disabling the plugin on specific posts/pages.
128
+ - Add Github Updater support.
129
+ - Removed CMB and built metaboxes the old fashion way.
130
+ - Added debug logging to better track any potential errors moving forward.
131
 
132
  = 0.5 =
133
  Reverted metabox version to previous - invalid error was sneaking through.
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
+
152
  = 0.6.1 =
153
+ Updates custom taxonomy check for custom taxonomy archives and some error logging functions.
154
 
155
  = 0.6 =
156
  Large improvements, including: a settings page to resolve issues on archives and blog roll pages, setting to keep jQuery in the header, and updated filters. Refer to the documentation if you are using a filter currently, as they have changed, prior to updating.
scripts-to-footer.php CHANGED
@@ -11,7 +11,7 @@
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.1
15
  * Author: Joshua David Nelson
16
  * Author URI: http://joshuadnelson.com
17
  * License: GPL2
@@ -44,7 +44,7 @@ if( !defined( 'STF_DOMAIN' ) )
44
 
45
  // Plugin Verison
46
  if( !defined( 'STF_VERSION' ) )
47
- define( 'STF_VERSION', '0.6.1' );
48
 
49
  // Plugin name
50
  if( !defined( 'STF_NAME' ) )
@@ -349,7 +349,11 @@ class Scripts_To_Footer {
349
  // Search Result Page
350
  } elseif( is_search() ) {
351
  $type = 'search';
352
-
 
 
 
 
353
  // Author Archive
354
  } elseif( is_author() ) {
355
  $type = 'author_archive';
@@ -537,7 +541,7 @@ if( !function_exists( 'stf_plugin_links' ) ) {
537
 
538
  $links[] = '<a href="https://github.com/joshuadavidnelson/scripts-to-footer/wiki" title="' . __( 'Documentation', STF_DOMAIN ) . '" target="_blank">' . __( 'Documentation', STF_DOMAIN ) . '</a>';
539
 
540
- $links[] = '<a href="http://jdn.im/donate" title="' . __( 'Donate', STF_DOMAIN ) . '">' . __( 'Donate', STF_DOMAIN ) . '</a>';
541
  }
542
 
543
  return $links;
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
44
 
45
  // Plugin Verison
46
  if( !defined( 'STF_VERSION' ) )
47
+ define( 'STF_VERSION', '0.6.2' );
48
 
49
  // Plugin name
50
  if( !defined( 'STF_NAME' ) )
349
  // Search Result Page
350
  } elseif( is_search() ) {
351
  $type = 'search';
352
+
353
+ // 404 Pages
354
+ } elseif( is_404() ) {
355
+ $type = '404';
356
+
357
  // Author Archive
358
  } elseif( is_author() ) {
359
  $type = 'author_archive';
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;