Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Add js-to-footer module #51

Merged
merged 1 commit into from
Mar 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ Enable Soil's nice search (`/search/query/`) with:
add_theme_support('soil-nice-search');
```

### JS to Footer

Move all scripts to `wp_footer` action hook with:

```php
add_theme_support('soil-js-to-footer');
```

### Disable trackbacks/pingbacks

Remove trackback/pingback functionality with:
Expand Down
16 changes: 16 additions & 0 deletions modules/js-to-footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Roots\Soil\JsToFooter;

/**
* Moves all scripts to wp_footer action
*
* You can enable/disable this feature in functions.php (or lib/config.php if you're using Sage):
* add_theme_support('soil-js-to-footer');
*/
function js_to_footer() {
remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'wp_enqueue_scripts', 1);
}
add_action('wp_enqueue_scripts', 'js_to_footer');