[WordPress] 外掛分享: Raw HTML

前言介紹

  • 這款 WordPress 外掛「Raw HTML」是 2008-01-01 上架。
  • 目前有 20000 個安裝啟用數。
  • 上一次更新是 2023-03-27,距離現在已有 418 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 2.8 以上版本才可以安裝。
  • 有 33 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

whiteshadow |

外掛標籤

css | html | posts | formatting | javascript |

內容簡介

is capability is only granted to administrators. If you’re not an admin, you will need to ask them to add it to your role.

Raw HTML is not recommended for use on untrusted sites or installations where multiple users can edit posts. Giving untrusted users the ability to add arbitrary HTML, JS or CSS code to your site is a security risk.

If you need to add custom CSS or JS to your site, consider creating a child theme or using a plugin designed specifically for that purpose.

這個外掛讓你可以停用自動格式化功能,例如智慧引號、自動產生段落等等,並且在文章中使用原生的 HTML/JS/CSS 程式碼而不被 WordPress 破壞。

功能

使用這個外掛,你可以將文章中的任何一部分用 [raw]...[/raw] 標籤包起來,以防止 WordPress 將換行符轉換成 HTML 段落,它也不會替換撇號為書法引號等等。如果你需要在文章中添加 CSS 區塊或 JavaScript 程式碼,這特別有用。

RawHTML 還會在「編輯文章」畫面中新增核取方塊,讓你能以文章為單位停用特定 WP 過濾器,例如:

停用 wptexturize(建立智慧引號與其他書法字符的功能)。
停用自動產生段落的功能。
停用網路上的表情符號。
停用 convert_chars(將&符號轉換為 HTML 實體並「修復」某些 Unicode 字元的功能)。

此免費版本僅支援在「文字」標籤(在舊版 WordPress 中稱為「HTML」)編輯文章。如果你想在視覺化編輯模式和文字模式之間切換而不影響文章內容,請使用專業版。

相容性

此外掛不完全支援古鐸堡積木編輯器。在 WordPress 5.0 中,如果使用古典編輯器外掛,某些 Raw HTML 功能可能僅適用。

用法

為了防止 WordPress 篩檢文章或頁面的一部分,請切換到文字/HTML編輯器,然後將它包在[raw]...或<!--raw-->...<!--/raw-->標籤中。這兩種版本的工作方式完全相同,只是後者即使在停用 Raw HTML 時也不會出現在訪問者的畫面中。

範例:

[raw]
This

is

a "test"!
[/raw]

在這種情況下,這些標籤將防止 WordPress 在「This」、「is」和「a “test”」之間插入段落休息,同時確保不將雙引號轉換為書法引號。

為了避免問題,請只在文字/HTML模式下編輯包含自訂程式碼的文章。如果也想使用可視化編輯器,請使用專業版。它會使 [raw] 標籤之間的程式碼在視覺模式下顯示為唯讀佔位符,確保 WordPress 不會更改它。

結合短碼

預設情況下,包含在 [raw] 標籤中的短碼不起作用,只會顯示為純文字。為了啟用這些短碼,請將 shortcodes=1 屬性添加到標籤中:

[raw shortcodes=1]This [shortcode] will be run.[/raw]

[raw]This [shortcode] won't work.[/raw]

在摘要中保留 [raw] 代碼

預設情況下,外掛會自動從文章摘要中刪除任何包含在 [raw]... 標籤中的程式碼。你可以通過將以下行添加到 wp-config.php 中,防止它這麼做:

define('RAW_HTML_KEEP_RAW_IN_EXCERPTS', true);

這確保該外掛不會從自動生成的摘要中刪除 [raw] 區塊。

注意事項

Raw HTML 無法推薦在不受信任的網站或允許多個使用者編輯文章的安裝中使用。允許未受信任的使用者向你的站點添加任意的 HTML、JS 或 CSS 程式碼是一種安全風險。

如果需要在你的站點中添加自定義 CSS 或 JS,請考慮建立子佈景主題或使用專為此目的設計的外掛程式。

原文外掛簡介

Lets you disable automatic formatting like smart quotes and automatic paragraph creation, and use raw HTML/JS/CSS code in your posts without WordPress messing it up.
Features
With this plugin, you can wrap any part of your post in [raw]…[/raw] tags to prevent WordPress from converting newlines to HTML paragraphs, replacing apostrophes with typographic quotes and so on. This is very useful if you need to add a CSS block or JavaScript to your post.
RawHTML will also add new checkboxes to the “Edit Post” screen that let you disable certain WP filters on a per-post basis. This way you can:

Disable wptexturize (the function that creates smart quotes and other typographic characters).
Disable automatic paragraph creation.
Disable image smilies.
Disable convert_chars (the function that converts ampersands to HTML entities and “fixes” some Unicode characters).

The free version only supports editing posts in the Text tab (called “HTML” in older WordPress versions). Get the Pro version if you want to be able to switch between Text and the Visual editor without WordPress messing up your content.
Compatibility
This plugin doesn’t fully support the Gutenberg editor. As of WordPress 5.0, some Raw HTML features will only work if you use the Classic Editor plugin.
Usage
To prevent a part of your post or page from being filtered by WordPress, switch to the Text/HTML editor and wrap it in [raw]...[/raw] or ... tags. These two versions work exactly the same, except that the latter won’t be visible to your visitors even if you deactivate Raw HTML.
Example :
[raw]
This

is

a "test"!
[/raw]

In this case, the tags will prevent WordPress from inserting paragraph breaks between “This”, “is” and “a “test””, as well as ensure that the double quotes arround “test” are not converted to typographic (curly) quotes.
To avoid problems, only edit posts that contain your custom code in Text/HTML mode. If you’d like to be able to also use the Visual editor, get the Pro version. It will make the code betwen [raw] tags appear as a read-only placeholder when viewed in Visual mode, ensuring WordPress doesn’t change it.
Combining shortcodes
By default, shortcodes that are inside [raw] tags will not work. They will just show up as plain text. To enable shortcodes, add the shortcodes=1 attribute to the tag:
[raw shortcodes=1]This [shortcode] will be run.[/raw]

[raw]This [shortcode] won't work.[/raw]

Preserving [raw] code in excerpts
By default, the plugin will automatically remove any code that’s inside [raw]...[/raw] tags from post excerpts. You can prevent that by adding the following line to wp-config.php:
define('RAW_HTML_KEEP_RAW_IN_EXCERPTS', true);

This will ensure that the plugin doesn’t strip [raw] blocks from automatically generated excerpts.
Notes
Some features of Raw HTML will only work for users who have the “unfiltered_html” capability. In a normal WordPress install that includes the Editor and Administrator roles. In a Multisite install, only the Super Admin has this capability by default.

各版本下載點

  • 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
  • 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Raw HTML」來進行安裝。

(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。


1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.0.2 | 1.0.3 | 1.0.4 | 1.0.5 | 1.2.1 | 1.2.2 | 1.2.3 | 1.2.4 | 1.2.5 | 1.4.1 | 1.4.2 | 1.4.3 | 1.4.4 | 1.4.5 | 1.4.6 | 1.4.7 | 1.4.8 | 1.4.9 | 1.5.1 | 1.6.1 | 1.6.2 | 1.6.3 | 1.6.4 | trunk | 1.4.10 | 1.4.11 | 1.4.12 | 1.4.13 | 1.4.14 | 1.4.15 | 1.4.16 |

延伸相關外掛(你可能也想知道)

  • Black Studio TinyMCE Widget 》此外掛添加了一個新的 Visual Editor 小工具類型,讓您能夠在側邊欄中輕鬆地插入豐富的文字和媒體對象。使用 Black Studio TinyMCE Widget 時,您將能夠使用W...。
  • Shortcoder — Create Shortcodes for Anything 》Shortcoder 外掛可讓您建立 HTML、JavaScript、CSS 和其他代碼片段的自訂捷徑。現在,這些捷徑可以在文章/頁面中使用,並且該片段將取代其位置。, ✍ 輕鬆建立...。
  • Simple Sitemap – Create a Responsive HTML Sitemap 》簡單網站地圖 (Simple Sitemap) 是 WordPress 上最受歡迎的 HTML 網站地圖,現在使用更加簡單。你可以在文章編輯器中直接建立和預覽網站地圖! 不再需要使用難...。
  • Simply Static 》Simply Static 是一個靜態網站生成器,可以將現有的 WordPress 網站轉換為靜態網站,並放置在您的伺服器、靜態主機提供者或 CDN 上。它可以大幅改善您網站的...。
  • Mammoth .docx converter 》Mammoth 設計用於將 .docx 文件(如 Microsoft Word、Google Docs 和 LibreOffice 創建的文件)轉換為 HTML。Mammoth 旨在利用文檔中的語義信息生成簡單和清...。
  • Code Embed 》注意: WordPress 5.0 及以上版本的使用者請查看常見問題以了解如何在區塊編輯器中使用此外掛。, Code Embed 外掛允許您在文章中嵌入程式碼(JavaScript 和 H...。
  • PHP Everywhere 》注意:此外掛更新至 3.0.0 版本是一項重大變更,將移除 [php_everywhere] 短代碼和小工具。請透過外掛設定頁面中的升級嚮導,將原本的代碼轉換為 Gutenberg ...。
  • WP Super Minify 》這個外掛可以在需要時結合、縮小和緩存內聯的 JavaScript 和 CSS 文件,以加快頁面加載速度,並使用Minify PHP Framework。, 啟用此外掛後,您會發現您的 HTM...。
  • WP Coder – Powerful HTML, CSS, JS and PHP Injection 》WP Coder 是一個用於在網站添加自定義代碼的外掛程式。您可以輕鬆地將 HTML、CSS 和 JS 代碼添加到網站頁面中。此外掛程式非常適合連接各種腳本或樣式,使網...。
  • Minify HTML 》你可以在這個免費的測試網站試用這個外掛 => https://demo.tastewp.com/minify-html-markup, 有時候你可能會注意到自己網站的 HTML 標籤看起來較為混亂和...。
  • Allow HTML in Category Descriptions 》當您在類別描述文本區添加文字並保存類別時,WordPress會運行內容過濾器,剝除除最基本格式標籤以外的所有內容。, 這個外掛程式可以禁用具有必要權限的角色的...。
  • Kwayy HTML Sitemap 》Kwayy HTML Sitemap可以為您的網站地圖頁面生成HTML(而非XML)網站地圖。這個外掛不僅會顯示頁面和文章,還會顯示其他自定義的文章類型,例如產品等。您還可...。
  • Code Widget 》Code Widget 是一個簡單的小工具,允許您插入任意的文字/HTML,執行 PHP 程式碼或 Short Code。此小工具解析 PHP 程式碼為簡單文字等等。, 只有擁有未過濾的 ...。
  • Export WP Page to Static HTML/CSS 》Export WP Page to Static HTML/CSS 外掛是一個靜態 HTML 網站或頁面產生器,它能幫助您將您的 WordPress 網站或頁面轉換成靜態 HTML 網站,讓您可以將其託管...。
  • Snippet Shortcodes 》文件/升級, Snippet Shortcodes 網站, Snippet Shortcodes 是什麼?, 您是否想在整個網站上使用相同的文本片段或 HTML 片段,但只需在一個位置更改值?如果是...。

文章
Filter
Apply Filters