[WordPress] 外掛分享: Raw HTML

前言介紹

  • 這款 WordPress 外掛「Raw HTML」是 2008-01-01 上架。
  • 目前有 10000 個安裝啟用數。
  • 上一次更新是 2024-11-11,距離現在已有 471 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 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 |

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

  • WP Shortcodes Plugin — Shortcodes Ultimate 》Shortcodes Ultimate 是一個全面的視覺與功能性元素收集,您可以在文章編輯器、文字小工具甚至是範本檔案中使用。使用 Shortcodes Ultimate,您可以輕鬆地建...。
  • Post Duplicator 》這個外掛是用來製作選定文章的完全一模一樣複製。它支援自訂文章類型、自訂分類和自訂欄位。, *注意: 評論不會被複製到新文章。, 這個外掛的目的是為了快速且...。
  • GenerateBlocks 》將不同的功能整合至編輯器,但並不會因為過多的一維方塊造成內容過於臃腫。使用 GenerateBlocks,您只需深入學習少量的方塊,即可用於創建任何內容。, Genera...。
  • YARPP – Yet Another Related Posts Plugin 》WordPress 相關文章外掛, Yet Another Related Posts Plugin (YARPP) 是一個經過專業維護、高度自訂和功能豐富的外掛程式,可以顯示與當前文章相關的頁面、文...。
  • WP Popular Posts 》WordPress Popular Posts 是一個高度可定製的小工具,可以顯示您最受歡迎的文章。, 主要特點, , 多小工具功能 – 您可以在您的博客上擁有多個 WordPress...。
  • Public Post Preview 》此外掛可讓您分享一個鏈接給匿名使用者,以便他們在發布前預覽文章(或其他公開文章類型)。, 您是否曾經與沒有訪問您網站權限的人共同撰寫文章,並需要給予...。
  • WP Meta and Date Remover 》移除點擊文章的Meta、作者和日期。 安裝、啟用,完成!, 如何移除文章和頁面的作者Meta和日期?, , 安裝 WP Meta and Date remover。, 啟用外掛。, 選擇隱藏...。
  • List category posts 》List Category Posts 可以讓你透過使用 [catlist] 短碼在文章或頁面中按類別列出文章。在編輯頁面或文章時,直接插入短碼到文章中,文章就會被列出來。基本的...。
  • Display Posts – Easy lists, grids, navigation, and more 》Display Posts 讓您輕鬆地列出網站上的所有內容。首先在內容編輯器中新增此短碼,以列出最近的文章清單:, [display-posts], , 按類別篩選, 若只想顯示特定類...。
  • CMS Tree Page View 》將所有頁面和自訂文章以 CMS 樹狀概覽方式添加到 WordPress,類似於專注於頁面的 CMS 中經常找到的檢視方式。, 如果您的目標是將多個內容類型合併到單一檢視...。
  • Category Posts Widget 》Category Posts Widget是一個輕巧的小工具,設計用於一件事並且做得很好:顯示特定類別中最新的文章。, 基於詞語和類別的文章小工具, 這個免費小工具的高級版...。
  • WP Telegram (Auto Post and Notifications) 》完美整合 Telegram 至 WordPress,讓您完全掌握控制。, Telegram 的卓越 LIVER 支援, 加入聊天室, 我們在 Telegram 上有一個公開小組,提供協助設置外掛、討...。
  • WP Admin UI Customize 》, 儀表板, 顯示選項標籤, 輸出 - 元網站, 管理工具列 (Toolbar), 側邊選單 (Side menu), 元箱的管理, 登入畫面, 其他功能, , 這些自訂化都是可以實現的。, , ...。
  • Ultimate Post Kit Addons for Elementor 》Ultimate Post Kit Elementor 外掛程式是首個允許您全新且清新地設計部落格網站的外掛程式。這是博客作者、行銷人員和文章類型網站擁有者的最佳工具。, Ultim...。
  • Reading Time WP 》WP Reading Time 讓你輕鬆地在 WordPress 文章中加入預估閱讀時間。啟用這個外掛會自動在你的文章內容的開始加入閱讀時間。你可以在「閱讀時間」設定中取消這...。

文章
Filter
Apply Filters
Mastodon