
內容簡介
這個外掛讓管理員用戶能夠將自訂的 CSS 和 JavaScript 直接添加到個別文章、頁面或任何註冊的自訂文章類型中,也可以將類別添加到 body 標籤和文章容器中。還有一個全局設置頁面,可以為整個博客編寫 Scripts n Styles。
管理員還可以將類別添加到 TinyMCE「格式」下拉菜單中,用戶可以直接對文章和頁面進行樣式設置。自 Scripts n Styles 3+ 版本起,樣式將反映在文章編輯器中。
因為只有受信任的用戶才應該被允許直接插入 JavaScript 到您的網站頁面中,因此此插件限制了僅允許管理員使用。管理員根據定義可以訪問更加敏感的區域,所以相對安全😉
實現筆記:
管理員用戶,更具體地說,任何具有 manage_options 和 unfiltered_html 能力的用戶(默認情況下僅是管理員類型用戶)可以使用此插件的功能。某些插件擴展用戶角色,因此此插件自然擴展包括具有適當的能力的角色。
CSS樣式嵌入到 head 元素底部,使用 style 標籤,並使用 wp-head。如果您的佈題沒有此掛鈎,則此插件(以及大多數其他插件)將無法正常工作。
JavaScript 嵌入到 body(或 head)元素底部,使用 script 標籤,並使用 wp-footer(或 wp-head)。如果您的佈題沒有此掛鈎,則此插件(以及大多數其他插件)將無法正常工作。
沒有輸入驗證。此插件將您在元框中輸入的內容直接放入 html 中,並且沒有錯誤檢查。您是管理員,我們相信您會小心使用。請不要弄壞任何東西。
由於使用庫的許可證,如果您關心這些事情,則此插件發布為「GPL 3.0 或更高版本」。
外掛標籤
開發者團隊
📦 歷史版本下載
原文外掛簡介
This plugin allows Admin users the ability to add custom CSS and JavaScript directly into individual Post, Pages or any other registered custom post types. You can also add classes to the body tag and the post container. There is a Global settings page for which you can write Scripts n Styles for the entire blog.
Admin’s can also add classes to the TinyMCE “Formats” dropdown which users can use to style posts and pages directly. As of Scripts n Styles 3+ styles are reflected in the post editor.
Because only well trusted users should ever be allowed to insert JavaScript directly into the pages of your site, this plugin restricts usage to admin type users. Admin’s have access to even more sensitive areas by definition, so that should be relatively safe 😉
Notes about the implementation:
Admin users, or more specifically, any user with the manage_options and unfiltered_html capabilities (which by default is only the admin type user) can use this plugin’s functionality. Some plugins extend user rolls, and so this plugin would naturally extend include rolls that have the appropriate capability.
CSS Styles are embeded, not linked, at the bottom of the head element with style tags by using wp-head. If your theme doesn’t have this hook, this plugin (as well as most others) won’t work.
JavaScript is embeded, not linked, at the bottom of the body (or head) element with script tags by using wp-footer (or wp-head). If your theme doesn’t have this hook, this plugin (as well as most others) won’t work.
There is no input validation. This plugin puts exactly what you type in the meta box directly into the html with no error checking. You are an Admin, and we trust you to be carefull. Try not to break anything.
Do to the licensing of the libraries used, this plugin is released “GPL 3.0 or later” if you care about those things.
