Title: WP Autoload
Author: invisnet
Published: <strong>November 24, 2011</strong>
Last modified: September 22, 2012

---

Search plugins

This plugin **hasn’t been tested with the latest 3 major releases of WordPress**.
It may no longer be maintained or supported and may have compatibility issues when
used with more recent versions of WordPress.

![](https://s.w.org/plugins/geopattern-icon/wp-autoload.svg)

# WP Autoload

 By [invisnet](https://profiles.wordpress.org/invisnet/)

[Download](https://downloads.wordpress.org/plugin/wp-autoload.2.5.1.zip)

 * [Details](https://wordpress.org/plugins/wp-autoload/#description)
 * [Reviews](https://wordpress.org/plugins/wp-autoload/#reviews)
 *  [Installation](https://wordpress.org/plugins/wp-autoload/#installation)
 * [Development](https://wordpress.org/plugins/wp-autoload/#developers)

 [Support](https://wordpress.org/support/plugin/wp-autoload/)

## Description

Most themes have a single stylesheet, a few JavaScript files, and all the PHP in`
functions.php`. _WP Autoload_ makes it trivial for theme developers to split up 
CSS, JS, and PHP per template, simplifying development and maintenance. It also 
makes it much easier to write per-template unit tests.

## Installation

 1. Upload the plugin to your plugins directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress
 3. Check the settings on the configuration page (Settings -> WP Autoload)

## FAQ

#### How do I use this in my theme?

_WP Autoload_ looks for files in the same way WordPress looks for templates, but
it also loads ‘parent’ files. Say your theme looks like this:

    ```
    themes/   foobar/     css/       archive.css       page.css       page-bar.css     inc/       page.php       page-bar.php     js/       archive.js       page.js       page-bar.js 
    ```

For an archive page, _WP Autoload_ will load:

 * `css/archive.css`
 * `js/archive.js`

No surprises there.

For a normal page, _WP Autoload_ will load:

 * `css/page.css`
 * `inc/page.php`
 * `js/page.js`

_WP Autoload_ will then try to create a new `WP_Autoload_page` object. The class**
must** extend `WP_Autoload_Template`, e.g.:

    ```
    class WP_Autoload_page extends WP_Autoload_Template {   ... } 
    ```

For a page with a slug of `bar`, _WP Autoload_ will load:

 * `page.css` _and_ `page-bar.css`, with `page.css` as a dependency of `page-bar.
   css`
 * `page.php` _and_ `page-bar.php`, in that order
 * `page.js` _and_ `page-bar.js`, with `page.js` as a dependency of `page-bar.js`

_WP Autoload_ will then try to create a new `WP_Autoload_page_bar` object; because`
page.php` is loaded first you can do this:

    ```
    class WP_Autoload_page_bar extends WP_Autoload_page {   ... } 
    ```

#### What about performance?

For templates where there is no specific stylesheet or script file the performance
implications of _WP Autoload_ are negligible. For templates with both a specific
stylesheet and script file _WP Autoload_ will add two requests to the overall page
load sequence. Typically these extra requests have no significant impact on page
load time because they are offset by the reduced size of the common stylesheet.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“WP Autoload” is open source software. The following people have contributed to 
this plugin.

Contributors

 *   [ invisnet ](https://profiles.wordpress.org/invisnet/)

[Translate “WP Autoload” into your language.](https://translate.wordpress.org/projects/wp-plugins/wp-autoload)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/wp-autoload/), check
out the [SVN repository](https://plugins.svn.wordpress.org/wp-autoload/), or subscribe
to the [development log](https://plugins.trac.wordpress.org/log/wp-autoload/) by
[RSS](https://plugins.trac.wordpress.org/log/wp-autoload/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 2.5.0

 * Support for hierarchical post types.

#### 2.1.3

 * Bugfix: fix debug warning with E_ALL.

#### 2.1.2

 * Bugfix: fix loading base classes.

#### 2.1.1

 * Bugfix: remove debug code.

#### 2.1.0

 * Support for child themes.

#### 2.0.0

 * Per-template classes.
 * Better sidebar handling.

#### 1.1.1

 * Dependencies configuration bug fix.

#### 1.1.0

 * Improved template part list filtering.

#### 1.0.4

 * Add enqueue_script() method to allow scripts to be enqueued after wp_head().

#### 1.0.3

 * Tag fix.

#### 1.0.2

 * Handle single dependencies better.

#### 1.0.1

 * Fix minor PHP warning.

#### 1.0

 * Initial release.

## Meta

 *  Version **2.5.1**
 *  Last updated **14 years ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 3.2.0 or higher **
 *  Tested up to **3.4.2**
 * Tags
 * [css](https://wordpress.org/plugins/tags/css/)[javascript](https://wordpress.org/plugins/tags/javascript/)
   [templates](https://wordpress.org/plugins/tags/templates/)[theme](https://wordpress.org/plugins/tags/theme/)
 *  [Advanced View](https://wordpress.org/plugins/wp-autoload/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/wp-autoload/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/wp-autoload/reviews/)

## Contributors

 *   [ invisnet ](https://profiles.wordpress.org/invisnet/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/wp-autoload/)