[WordPress] 外掛分享: Postscript

首頁外掛目錄 › Postscript
WordPress 外掛 Postscript 的封面圖片
10+
安裝啟用
尚無評分
2947 天前
最後更新
問題解決
WordPress 3.5+ v1.0.0 上架:2016-06-19

內容簡介

不再將樣式表和 JavaScript 直接塞進文章內容。不再為每篇文章載入只有少數使用的程式。使用 Postscript 外掛可以讓您輕鬆地逐篇文章新增單一樣式表和腳本檔案,或是載入一整個程式庫。

此外掛使用 WordPress 的「enqueue」方法,讓您可以控制相依性(當註冊腳本時),將樣式放在 head 中、腳本放在 footer 中,提升網站效能,並避免重複載入相同的程式庫(jQuery,我在看著你)。

註冊樣式和腳本檔案(按 handle)進行載入

利用 Postscript 的文章設定(編輯文章畫面)可以逐篇文章註冊樣式和腳本檔案(以勾選框列舉各 handle)進行加載。

註冊未列在清單上的樣式、腳本和資料檔案(按 URL)進行載入

對每篇文章,您可以透過文章設定進行未列在清單上的檔案註冊,這可以透過輸入 URL 到 meta box 文字欄位實現,例如:
* 1 個 CSS 樣式表。
* 2 個 JavaScript URL,例如一個 JSON 資料檔和一個腳本檔。

新增文章和 body Classes

對每篇文章,您可以新增:
* HTML body 標記的 classname(需要在佈景樣式中載入 body_class())。
* class="post" 列表的 classname(由 WordPress 插入,需要在佈景樣式中載入 post_class())。

設定和安全性

設定畫面可讓您控制哪些使用者角色和文章類型顯示 Postscript 文章設定,以及允許使用者加載哪些 script / style handles。

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.0.0) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Postscript」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

No more shoehorning stylesheets and JavaScripts into the post content box. No more loading scripts on every post that only a few use. Postscript lets you easily add libraries or single-post script and style files post-by-post.
The plugin uses the WordPress “enqueue” methods, which means you can control dependencies (when registering scripts), improve site performance by putting styles in the head and scripts in the footer, and eliminate loading multiple copies of the same library (jQuery, I’m looking at you).
Enqueue Registered Styles and Scripts (by Handle)
Use the Postscript meta box (Edit Post screen) to enqueue registered styles and scripts (listed by handle in checkboxes).
Enqueue Unregistered Styles, Scripts, and Data Files (by URL)
For each post, you can also enqueue unregistered files, by entering URLs in the meta box text fields for:
* 1 CSS stylesheet.
* 2 JavaScript URLs, e.g, one JSON data file and one script file.
Add Post and Body Classes
And for each post, you can add:
* A classname, to the HTML body tag (requires body_class() in theme).
* A classname, to class="post" list (inserted by WordPress, requires post_class() in theme).
Settings and Security
The Settings screen lets you control which user-roles and post-types display the Postscript meta box and which script/style handles users are allowed to enqueue.

延伸相關外掛

文章
Filter
Mastodon