Version Description
- Fix bug with custom taxonomy archive include filter
- Clean up all taxonomy archive conditional statements and corresponding error logging
Download this release
Release Info
Developer | joshuadnelson |
Plugin | Scripts To Footer |
Version | 0.6.1 |
Comparing to | |
See all releases |
Code changes from version 0.6.0 to 0.6.1
- CHANGELOG.md +4 -1
- admin/admin-settings.php +19 -19
- readme.txt +26 -15
- scripts-to-footer.php +25 -21
CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1 |
### Changelog
|
2 |
|
3 |
-
##### 0.6
|
|
|
|
|
|
|
4 |
- Add settings page with global disable options for home page, search pages, post type archives, taxonomy archives, and other archives.
|
5 |
- Update uninstall.php to remove things correctly.
|
6 |
- Add FAQ to readme.txt and readme.md.
|
1 |
### Changelog
|
2 |
|
3 |
+
##### 0.6.1
|
4 |
+
Updates custom taxonomy check for custom taxonomy archives and some error logging functions.
|
5 |
+
|
6 |
+
##### 0.6.0
|
7 |
- Add settings page with global disable options for home page, search pages, post type archives, taxonomy archives, and other archives.
|
8 |
- Update uninstall.php to remove things correctly.
|
9 |
- Add FAQ to readme.txt and readme.md.
|
admin/admin-settings.php
CHANGED
@@ -34,7 +34,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
34 |
/**
|
35 |
* Start up
|
36 |
*
|
37 |
-
* @since 0.6
|
38 |
*/
|
39 |
public function __construct() {
|
40 |
add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
|
@@ -44,7 +44,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
44 |
/**
|
45 |
* Add options page
|
46 |
*
|
47 |
-
* @since 0.6
|
48 |
*/
|
49 |
public function add_plugin_page() {
|
50 |
// This page will be under "Settings"
|
@@ -60,7 +60,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
60 |
/**
|
61 |
* Options page callback
|
62 |
*
|
63 |
-
* @since 0.6
|
64 |
*/
|
65 |
public function create_admin_page() {
|
66 |
// Set class property
|
@@ -83,7 +83,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
83 |
/**
|
84 |
* Register and add settings
|
85 |
*
|
86 |
-
* @since 0.6
|
87 |
*/
|
88 |
public function page_init() {
|
89 |
|
@@ -181,7 +181,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
181 |
/**
|
182 |
* Sanitize each setting field as needed
|
183 |
*
|
184 |
-
* @since 0.6
|
185 |
*
|
186 |
* @param array $input Contains all settings fields as array keys
|
187 |
*/
|
@@ -225,7 +225,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
225 |
/**
|
226 |
* Return the post type settings field names.
|
227 |
*
|
228 |
-
* @since 0.6
|
229 |
*
|
230 |
* @return array
|
231 |
*/
|
@@ -246,7 +246,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
246 |
/**
|
247 |
* Return the post type settings field names.
|
248 |
*
|
249 |
-
* @since 0.6
|
250 |
*
|
251 |
* @return array
|
252 |
*/
|
@@ -267,7 +267,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
267 |
/**
|
268 |
* Print the Section text.
|
269 |
*
|
270 |
-
* @since 0.6
|
271 |
*/
|
272 |
public function print_exclude_options_section_info() {
|
273 |
echo _x( 'Select which templates should <em><strong>not</strong></em> have scripts moved to the footer:', STF_DOMAIN );
|
@@ -289,7 +289,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
289 |
/**
|
290 |
* Get the settings option array and print one of its values.
|
291 |
*
|
292 |
-
* @since 0.6
|
293 |
*/
|
294 |
public function stf_search() {
|
295 |
if( !isset( $this->options['stf_exclude_search'] ) )
|
@@ -302,7 +302,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
302 |
/**
|
303 |
* Get the settings option array and print one of its values.
|
304 |
*
|
305 |
-
* @since 0.6
|
306 |
*/
|
307 |
public function stf_post_type_archives() {
|
308 |
global $stf_scripts_to_footer;
|
@@ -324,7 +324,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
324 |
/**
|
325 |
* Get the settings option array and print one of its values.
|
326 |
*
|
327 |
-
* @since 0.6
|
328 |
*/
|
329 |
public function stf_taxonomy_archives() {
|
330 |
global $stf_scripts_to_footer;
|
@@ -346,7 +346,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
346 |
/**
|
347 |
* Get the settings option array and print one of its values.
|
348 |
*
|
349 |
-
* @since 0.6
|
350 |
*/
|
351 |
public function stf_author_archive() {
|
352 |
if( !isset( $this->options['stf_exclude_author_archive'] ) )
|
@@ -359,7 +359,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
359 |
/**
|
360 |
* Get the settings option array and print one of its values.
|
361 |
*
|
362 |
-
* @since 0.6
|
363 |
*/
|
364 |
public function stf_archive() {
|
365 |
if( !isset( $this->options['stf_exclude_archive'] ) )
|
@@ -372,7 +372,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
372 |
/**
|
373 |
* Print the Section text.
|
374 |
*
|
375 |
-
* @since 0.6
|
376 |
*/
|
377 |
public function print_header_script_section_info() {
|
378 |
echo sprintf( __( 'Options for keeping specific scripts in the header, if they occur. Want to exclude a different script? Check out the <a href="%s" title="On Github">documentation</a> for more information.', STF_DOMAIN ), 'https://github.com/joshuadavidnelson/scripts-to-footer/wiki' );
|
@@ -381,7 +381,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
381 |
/**
|
382 |
* Get the settings option array and print one of its values.
|
383 |
*
|
384 |
-
* @since 0.6
|
385 |
*/
|
386 |
public function stf_jquery_header() {
|
387 |
if( !isset( $this->options['stf_jquery_header'] ) )
|
@@ -396,7 +396,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
396 |
/**
|
397 |
* Initialize the single post metabox.
|
398 |
*
|
399 |
-
* @since 0.6
|
400 |
*/
|
401 |
function metabox_register() {
|
402 |
global $stf_scripts_to_footer;
|
@@ -412,7 +412,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
412 |
/**
|
413 |
* Output the single post metabox.
|
414 |
*
|
415 |
-
* @since 0.6
|
416 |
*/
|
417 |
function metabox_render() {
|
418 |
|
@@ -441,7 +441,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
441 |
/**
|
442 |
* Handle metabox saves
|
443 |
*
|
444 |
-
* @since 0.6
|
445 |
*/
|
446 |
function metabox_save( $post_id, $post ) {
|
447 |
|
@@ -483,7 +483,7 @@ if( !class_exists( 'Scripts_To_Footer_Settings' ) ) {
|
|
483 |
/**
|
484 |
* Get custom settings.
|
485 |
*
|
486 |
-
* @since 0.6
|
487 |
*
|
488 |
* @param string $key The key
|
489 |
* @param string $setting The settings field
|
34 |
/**
|
35 |
* Start up
|
36 |
*
|
37 |
+
* @since 0.6.0
|
38 |
*/
|
39 |
public function __construct() {
|
40 |
add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
|
44 |
/**
|
45 |
* Add options page
|
46 |
*
|
47 |
+
* @since 0.6.0
|
48 |
*/
|
49 |
public function add_plugin_page() {
|
50 |
// This page will be under "Settings"
|
60 |
/**
|
61 |
* Options page callback
|
62 |
*
|
63 |
+
* @since 0.6.0
|
64 |
*/
|
65 |
public function create_admin_page() {
|
66 |
// Set class property
|
83 |
/**
|
84 |
* Register and add settings
|
85 |
*
|
86 |
+
* @since 0.6.0
|
87 |
*/
|
88 |
public function page_init() {
|
89 |
|
181 |
/**
|
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 |
*/
|
225 |
/**
|
226 |
* Return the post type settings field names.
|
227 |
*
|
228 |
+
* @since 0.6.0
|
229 |
*
|
230 |
* @return array
|
231 |
*/
|
246 |
/**
|
247 |
* Return the post type settings field names.
|
248 |
*
|
249 |
+
* @since 0.6.0
|
250 |
*
|
251 |
* @return array
|
252 |
*/
|
267 |
/**
|
268 |
* Print the Section text.
|
269 |
*
|
270 |
+
* @since 0.6.0
|
271 |
*/
|
272 |
public function print_exclude_options_section_info() {
|
273 |
echo _x( 'Select which templates should <em><strong>not</strong></em> have scripts moved to the footer:', STF_DOMAIN );
|
289 |
/**
|
290 |
* Get the settings option array and print one of its values.
|
291 |
*
|
292 |
+
* @since 0.6.0
|
293 |
*/
|
294 |
public function stf_search() {
|
295 |
if( !isset( $this->options['stf_exclude_search'] ) )
|
302 |
/**
|
303 |
* Get the settings option array and print one of its values.
|
304 |
*
|
305 |
+
* @since 0.6.0
|
306 |
*/
|
307 |
public function stf_post_type_archives() {
|
308 |
global $stf_scripts_to_footer;
|
324 |
/**
|
325 |
* Get the settings option array and print one of its values.
|
326 |
*
|
327 |
+
* @since 0.6.0
|
328 |
*/
|
329 |
public function stf_taxonomy_archives() {
|
330 |
global $stf_scripts_to_footer;
|
346 |
/**
|
347 |
* Get the settings option array and print one of its values.
|
348 |
*
|
349 |
+
* @since 0.6.0
|
350 |
*/
|
351 |
public function stf_author_archive() {
|
352 |
if( !isset( $this->options['stf_exclude_author_archive'] ) )
|
359 |
/**
|
360 |
* Get the settings option array and print one of its values.
|
361 |
*
|
362 |
+
* @since 0.6.0
|
363 |
*/
|
364 |
public function stf_archive() {
|
365 |
if( !isset( $this->options['stf_exclude_archive'] ) )
|
372 |
/**
|
373 |
* Print the Section text.
|
374 |
*
|
375 |
+
* @since 0.6.0
|
376 |
*/
|
377 |
public function print_header_script_section_info() {
|
378 |
echo sprintf( __( 'Options for keeping specific scripts in the header, if they occur. Want to exclude a different script? Check out the <a href="%s" title="On Github">documentation</a> for more information.', STF_DOMAIN ), 'https://github.com/joshuadavidnelson/scripts-to-footer/wiki' );
|
381 |
/**
|
382 |
* Get the settings option array and print one of its values.
|
383 |
*
|
384 |
+
* @since 0.6.0
|
385 |
*/
|
386 |
public function stf_jquery_header() {
|
387 |
if( !isset( $this->options['stf_jquery_header'] ) )
|
396 |
/**
|
397 |
* Initialize the single post metabox.
|
398 |
*
|
399 |
+
* @since 0.6.0
|
400 |
*/
|
401 |
function metabox_register() {
|
402 |
global $stf_scripts_to_footer;
|
412 |
/**
|
413 |
* Output the single post metabox.
|
414 |
*
|
415 |
+
* @since 0.6.0
|
416 |
*/
|
417 |
function metabox_render() {
|
418 |
|
441 |
/**
|
442 |
* Handle metabox saves
|
443 |
*
|
444 |
+
* @since 0.6.0
|
445 |
*/
|
446 |
function metabox_save( $post_id, $post ) {
|
447 |
|
483 |
/**
|
484 |
* Get custom settings.
|
485 |
*
|
486 |
+
* @since 0.6.0
|
487 |
*
|
488 |
* @param string $key The key
|
489 |
* @param string $setting The settings field
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Scripts To Footer ===
|
2 |
Contributors: joshuadnelson
|
3 |
-
Tags: javascript, 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.
|
7 |
-
Stable tag: 0.6.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -18,7 +18,11 @@ 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 |
-
|
|
|
|
|
|
|
|
|
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,19 +113,23 @@ Please feel free to open a [Github Issue](https://github.com/joshuadavidnelson/s
|
|
109 |
|
110 |
== Changelog ==
|
111 |
|
|
|
|
|
|
|
|
|
112 |
= 0.6.0 =
|
113 |
Large number of improvements:
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
|
126 |
= 0.5 =
|
127 |
Reverted metabox version to previous - invalid error was sneaking through.
|
@@ -140,6 +148,9 @@ Initial release
|
|
140 |
|
141 |
== Upgrade Notice ==
|
142 |
|
|
|
|
|
|
|
143 |
= 0.6 =
|
144 |
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.
|
145 |
|
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 |
|
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 |
|
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 |
|
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.
|
156 |
|
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
|
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' );
|
48 |
|
49 |
// Plugin name
|
50 |
if( !defined( 'STF_NAME' ) )
|
@@ -73,7 +73,7 @@ class Scripts_To_Footer {
|
|
73 |
/**
|
74 |
* An array of script slugs that should remain in the header.
|
75 |
*
|
76 |
-
* @since 0.6
|
77 |
*
|
78 |
* @var array
|
79 |
*/
|
@@ -108,7 +108,7 @@ class Scripts_To_Footer {
|
|
108 |
* if it doesn't meet minimum requirements. If it does, then it does some version
|
109 |
* checks and updates the site version option.
|
110 |
*
|
111 |
-
* @since 0.6
|
112 |
*/
|
113 |
static function activation_check() {
|
114 |
if ( ! self::compatible_version() ) {
|
@@ -136,7 +136,7 @@ class Scripts_To_Footer {
|
|
136 |
* This is just in case the plugin is activated in a weird way,
|
137 |
* or the versions change after activation.
|
138 |
*
|
139 |
-
* @since 0.6
|
140 |
*/
|
141 |
function check_version() {
|
142 |
if ( ! self::compatible_version() ) {
|
@@ -153,7 +153,7 @@ class Scripts_To_Footer {
|
|
153 |
/**
|
154 |
* Display notice on deactivation.
|
155 |
*
|
156 |
-
* @since 0.6
|
157 |
*
|
158 |
* @return void
|
159 |
*/
|
@@ -164,7 +164,7 @@ class Scripts_To_Footer {
|
|
164 |
/**
|
165 |
* Check everything is compatible.
|
166 |
*
|
167 |
-
* @since 0.6
|
168 |
*
|
169 |
* @return boolean
|
170 |
*/
|
@@ -212,7 +212,7 @@ class Scripts_To_Footer {
|
|
212 |
/**
|
213 |
* Set the scripts to be printed in the header, based on options and filter.
|
214 |
*
|
215 |
-
* @since 0.6
|
216 |
*/
|
217 |
public function set_header_scripts() {
|
218 |
if( $exclude = stf_get_option( 'stf_jquery_header', false ) ) {
|
@@ -227,7 +227,7 @@ class Scripts_To_Footer {
|
|
227 |
/**
|
228 |
* The holy grail: print select scripts in the header!
|
229 |
*
|
230 |
-
* @since 0.6
|
231 |
*
|
232 |
* @return void
|
233 |
*/
|
@@ -283,7 +283,7 @@ class Scripts_To_Footer {
|
|
283 |
/**
|
284 |
* Determing if the current page is included, via a filter.
|
285 |
*
|
286 |
-
* @since 0.6
|
287 |
*
|
288 |
* @return boolean Default is true.
|
289 |
*/
|
@@ -303,7 +303,7 @@ class Scripts_To_Footer {
|
|
303 |
/**
|
304 |
* Runs the various template checks and returns true/false.
|
305 |
*
|
306 |
-
* @since 0.6
|
307 |
*
|
308 |
* @return boolean
|
309 |
*/
|
@@ -369,7 +369,7 @@ class Scripts_To_Footer {
|
|
369 |
|
370 |
if( $this->tax_supported( 'post_tag' ) ) {
|
371 |
$type = "post_tag_archive";
|
372 |
-
}
|
373 |
$this->log_me( 'Error in tag check' );
|
374 |
return false;
|
375 |
}
|
@@ -377,10 +377,14 @@ class Scripts_To_Footer {
|
|
377 |
// Taxonomy Archive
|
378 |
} elseif( is_tax() ) {
|
379 |
|
380 |
-
$
|
|
|
|
|
|
|
|
|
381 |
if( isset( $tax->name ) && $this->tax_supported( $tax->name ) ) {
|
382 |
$type = "{$tax->name}_archive";
|
383 |
-
}
|
384 |
$this->log_me( 'Error in taxonomy check' );
|
385 |
return false;
|
386 |
}
|
@@ -391,7 +395,7 @@ class Scripts_To_Footer {
|
|
391 |
$post_type = get_post_type();
|
392 |
if( $this->post_type_supported( $post_type ) ) {
|
393 |
$type = "{$post_type}_archive";
|
394 |
-
}
|
395 |
$this->log_me( 'Error in post type check check' );
|
396 |
return false;
|
397 |
}
|
@@ -425,7 +429,7 @@ class Scripts_To_Footer {
|
|
425 |
/**
|
426 |
* Check for post type support, via the filter. Default support for page and post.
|
427 |
*
|
428 |
-
* @since 0.6
|
429 |
*
|
430 |
* @return array Supported posts
|
431 |
*/
|
@@ -442,7 +446,7 @@ class Scripts_To_Footer {
|
|
442 |
/**
|
443 |
* Check if a post type is supported.
|
444 |
*
|
445 |
-
* @since 0.6
|
446 |
*
|
447 |
* @return array Supported posts
|
448 |
*/
|
@@ -458,7 +462,7 @@ class Scripts_To_Footer {
|
|
458 |
/**
|
459 |
* Check for custom taxonomy support, via the filter.
|
460 |
*
|
461 |
-
* @since 0.6
|
462 |
*
|
463 |
* @return array Supported posts
|
464 |
*/
|
@@ -475,7 +479,7 @@ class Scripts_To_Footer {
|
|
475 |
/**
|
476 |
* Check if a post type is supported.
|
477 |
*
|
478 |
-
* @since 0.6
|
479 |
*
|
480 |
* @return array Supported posts
|
481 |
*/
|
@@ -491,7 +495,7 @@ class Scripts_To_Footer {
|
|
491 |
/**
|
492 |
* Log any errors, if debug mode is on.
|
493 |
*
|
494 |
-
* @since 0.6
|
495 |
*
|
496 |
* @param string $message
|
497 |
*/
|
@@ -543,7 +547,7 @@ if( !function_exists( 'stf_plugin_links' ) ) {
|
|
543 |
/**
|
544 |
* Add link to options page in plguin screen.
|
545 |
*
|
546 |
-
* @since 0.6
|
547 |
*
|
548 |
* @param string $links Links.
|
549 |
* @return $links Amended 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.1
|
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.1' );
|
48 |
|
49 |
// Plugin name
|
50 |
if( !defined( 'STF_NAME' ) )
|
73 |
/**
|
74 |
* An array of script slugs that should remain in the header.
|
75 |
*
|
76 |
+
* @since 0.6.0
|
77 |
*
|
78 |
* @var array
|
79 |
*/
|
108 |
* if it doesn't meet minimum requirements. If it does, then it does some version
|
109 |
* checks and updates the site version option.
|
110 |
*
|
111 |
+
* @since 0.6.0
|
112 |
*/
|
113 |
static function activation_check() {
|
114 |
if ( ! self::compatible_version() ) {
|
136 |
* This is just in case the plugin is activated in a weird way,
|
137 |
* or the versions change after activation.
|
138 |
*
|
139 |
+
* @since 0.6.0
|
140 |
*/
|
141 |
function check_version() {
|
142 |
if ( ! self::compatible_version() ) {
|
153 |
/**
|
154 |
* Display notice on deactivation.
|
155 |
*
|
156 |
+
* @since 0.6.0
|
157 |
*
|
158 |
* @return void
|
159 |
*/
|
164 |
/**
|
165 |
* Check everything is compatible.
|
166 |
*
|
167 |
+
* @since 0.6.0
|
168 |
*
|
169 |
* @return boolean
|
170 |
*/
|
212 |
/**
|
213 |
* Set the scripts to be printed in the header, based on options and filter.
|
214 |
*
|
215 |
+
* @since 0.6.0
|
216 |
*/
|
217 |
public function set_header_scripts() {
|
218 |
if( $exclude = stf_get_option( 'stf_jquery_header', false ) ) {
|
227 |
/**
|
228 |
* The holy grail: print select scripts in the header!
|
229 |
*
|
230 |
+
* @since 0.6.0
|
231 |
*
|
232 |
* @return void
|
233 |
*/
|
283 |
/**
|
284 |
* Determing if the current page is included, via a filter.
|
285 |
*
|
286 |
+
* @since 0.6.0
|
287 |
*
|
288 |
* @return boolean Default is true.
|
289 |
*/
|
303 |
/**
|
304 |
* Runs the various template checks and returns true/false.
|
305 |
*
|
306 |
+
* @since 0.6.0
|
307 |
*
|
308 |
* @return boolean
|
309 |
*/
|
369 |
|
370 |
if( $this->tax_supported( 'post_tag' ) ) {
|
371 |
$type = "post_tag_archive";
|
372 |
+
} else {
|
373 |
$this->log_me( 'Error in tag check' );
|
374 |
return false;
|
375 |
}
|
377 |
// Taxonomy Archive
|
378 |
} elseif( is_tax() ) {
|
379 |
|
380 |
+
$taxonomy = get_query_var( 'taxonomy' );
|
381 |
+
if( !$taxonomy ) {
|
382 |
+
return false;
|
383 |
+
}
|
384 |
+
$tax = get_taxonomy( $taxonomy );
|
385 |
if( isset( $tax->name ) && $this->tax_supported( $tax->name ) ) {
|
386 |
$type = "{$tax->name}_archive";
|
387 |
+
} else {
|
388 |
$this->log_me( 'Error in taxonomy check' );
|
389 |
return false;
|
390 |
}
|
395 |
$post_type = get_post_type();
|
396 |
if( $this->post_type_supported( $post_type ) ) {
|
397 |
$type = "{$post_type}_archive";
|
398 |
+
} else {
|
399 |
$this->log_me( 'Error in post type check check' );
|
400 |
return false;
|
401 |
}
|
429 |
/**
|
430 |
* Check for post type support, via the filter. Default support for page and post.
|
431 |
*
|
432 |
+
* @since 0.6.0
|
433 |
*
|
434 |
* @return array Supported posts
|
435 |
*/
|
446 |
/**
|
447 |
* Check if a post type is supported.
|
448 |
*
|
449 |
+
* @since 0.6.0
|
450 |
*
|
451 |
* @return array Supported posts
|
452 |
*/
|
462 |
/**
|
463 |
* Check for custom taxonomy support, via the filter.
|
464 |
*
|
465 |
+
* @since 0.6.0
|
466 |
*
|
467 |
* @return array Supported posts
|
468 |
*/
|
479 |
/**
|
480 |
* Check if a post type is supported.
|
481 |
*
|
482 |
+
* @since 0.6.0
|
483 |
*
|
484 |
* @return array Supported posts
|
485 |
*/
|
495 |
/**
|
496 |
* Log any errors, if debug mode is on.
|
497 |
*
|
498 |
+
* @since 0.6.0
|
499 |
*
|
500 |
* @param string $message
|
501 |
*/
|
547 |
/**
|
548 |
* Add link to options page in plguin screen.
|
549 |
*
|
550 |
+
* @since 0.6.0
|
551 |
*
|
552 |
* @param string $links Links.
|
553 |
* @return $links Amended links.
|