Title: WP Autoload
Author: invisnet
Published: <strong>2011 年 11 月 24 日</strong>
Last modified: 2012 年 9 月 22 日

---

搜尋外掛

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

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

# WP Autoload

 由 [invisnet](https://profiles.wordpress.org/invisnet/) 開發

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

 * [詳細資料](https://tw.wordpress.org/plugins/wp-autoload/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/wp-autoload/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/wp-autoload/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/wp-autoload/#developers)

 [技術支援](https://wordpress.org/support/plugin/wp-autoload/)

## 外掛說明

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.

## 安裝方式

 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)

## 常見問題集

#### 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.

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈WP Autoload〉的開發相關工作。

參與者

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

[將〈WP Autoload〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/wp-autoload)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/wp-autoload/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/wp-autoload/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/wp-autoload/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/wp-autoload/)。

## 變更記錄

#### 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.

## 中繼資料

 *  版本 **2.5.1**
 *  最後更新 **14 年前**
 *  啟用安裝數 **少於 10 次**
 *  WordPress 版本需求 ** 3.2.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **3.4.2**
 *  語言
 * [English (US)](https://wordpress.org/plugins/wp-autoload/)
 * 標籤:
 * [css](https://tw.wordpress.org/plugins/tags/css/)[javascript](https://tw.wordpress.org/plugins/tags/javascript/)
   [templates](https://tw.wordpress.org/plugins/tags/templates/)[theme](https://tw.wordpress.org/plugins/tags/theme/)
 *  [進階檢視](https://tw.wordpress.org/plugins/wp-autoload/advanced/)

## 評分

這個項目尚無任何評論記錄。

[撰寫評分](https://wordpress.org/support/plugin/wp-autoload/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/wp-autoload/reviews/)

## 參與者

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

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/wp-autoload/)