Title: Insert JavaScript and CSS
Author: Ryan
Published: <strong>2012 年 6 月 22 日</strong>
Last modified: 2012 年 7 月 26 日

---

搜尋外掛

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

![](https://s.w.org/plugins/geopattern-icon/insert-javascript-css.svg)

# Insert JavaScript and CSS

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

[下載](https://downloads.wordpress.org/plugin/insert-javascript-css.0.2.zip)

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

 [技術支援](https://wordpress.org/support/plugin/insert-javascript-css/)

## 外掛說明

Easily add custom JavaScript or CSS to a single post or page.

When activated, a new icon is added to the post edit page near the icon you use

to add media to a post. Clicking the new icon brings up a screen where you can insert
JavaScript and CSS that will be included with the current post.

Anything entered into the text field on the JavaScript tab will be inserted into

the <head> section of your web page. Same is true of the CSS tab. This allows you
to insert arbitrary JavaScript and CSS into any post or page you would like without
having to resort to loading it on all pages.

## 螢幕擷圖

[⌊Icon added to the post media area⌉⌊Icon added to the post media area⌉[

Icon added to the post media area

[⌊Form to enter JavaScript⌉⌊Form to enter JavaScript⌉[

Form to enter JavaScript

[⌊Form to enter CSS⌉⌊Form to enter CSS⌉[

Form to enter CSS

## 安裝方式

 1. Upload the `insert-javascript-css` to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress

OR

 1. Use the plugin installer inside of WordPress

## 常見問題集

  Do I need to wrap in script or style tags?

Does’t matter. If you do, they’re left in place. If you don’t, they’ll be added.

  What about archive pages?

Unless you specifically tell it not to, this plugin will include any JavaScript 
or CSS
 included in a post on archive pages as well.

This can lead to conflicts. Take for example two posts, one with `body { background:
blue; }`
 and the other with `body { background: green; }`. Whichever post comes
last will take priority, but that’s probably not what you want.

If you add a custom field named `ijsc_single_only` to your post the JavaScript or
CSS will
 only add when `is_single()` is true. It doesn’t matter what value you 
put in `ijsc_single_only`, only that there is a value.

  Who can insert JavaScript or CSS

By default users with the capability upload_files are allowed to insert JavaScript

or CSS into posts. This seemed to be a logical choice as you need to have a certain
level of trust for users to upload files.

If you would like to change what capability is required you can edit the `IJC_CAPABILITY_REQUIRED`

constant defined in `insert-javascript-css.php` inside the plugin folder.

## 使用者評論

![](https://secure.gravatar.com/avatar/20eed4d0ae64e466d8d9597de8f63a2b8333d4ef9c5d3fc4b79b83d451235232?
s=60&d=retro&r=g)

### 󠀁[Another awesome WP plugin](https://wordpress.org/support/topic/another-awesome-wp-plugin/)󠁿

 [fpats](https://profiles.wordpress.org/fpats/) 2017 年 2 月 7 日

Not.

 [ 閱讀全部 10 則使用者評論 ](https://wordpress.org/support/plugin/insert-javascript-css/reviews/)

## 參與者及開發者

以下人員參與了開源軟體〈Insert JavaScript and CSS〉的開發相關工作。

參與者

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

[將〈Insert JavaScript and CSS〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/insert-javascript-css)

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

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

## 變更記錄

#### 0.2

Fix so CSS and JS will show up in post types other than post.

#### 0.1

Initial release

## 中繼資料

 *  版本 **0.2**
 *  最後更新 **14 年前**
 *  啟用安裝數 **400+**
 *  WordPress 版本需求 ** 3.0 或更新版本 **
 *  已測試相容的 WordPress 版本 **3.4.2**
 *  語言
 * [English (US)](https://wordpress.org/plugins/insert-javascript-css/)
 * 標籤:
 * [css](https://tw.wordpress.org/plugins/tags/css/)[javascript](https://tw.wordpress.org/plugins/tags/javascript/)
   [page](https://tw.wordpress.org/plugins/tags/page/)[post](https://tw.wordpress.org/plugins/tags/post/)
 *  [進階檢視](https://tw.wordpress.org/plugins/insert-javascript-css/advanced/)

## 評分

 4.1 星，滿分為 5 星

 *  [  7 個 5 星使用者評論     ](https://wordpress.org/support/plugin/insert-javascript-css/reviews/?filter=5)
 *  [  1 個 4 星使用者評論     ](https://wordpress.org/support/plugin/insert-javascript-css/reviews/?filter=4)
 *  [  0 個 3 星使用者評論     ](https://wordpress.org/support/plugin/insert-javascript-css/reviews/?filter=3)
 *  [  0 個 2 星使用者評論     ](https://wordpress.org/support/plugin/insert-javascript-css/reviews/?filter=2)
 *  [  2 個 1 星使用者評論     ](https://wordpress.org/support/plugin/insert-javascript-css/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/insert-javascript-css/reviews/#new-post)

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

## 參與者

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

## 技術支援

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

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

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](http://www.nutt.net/donate/)