
前言介紹
- 這款 WordPress 外掛「Text Replace」是 2004-12-20 上架。
- 目前有 3000 個安裝啟用數。
- 上一次更新是 2021-07-12,距離現在已有 1690 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
- 外掛最低要求 WordPress 4.9 以上版本才可以安裝。
- 有 18 人給過評分。
- 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。
外掛協作開發者
外掛標籤
text | replace | shortcut | coffee2code | substitution |
內容簡介
這個外掛讓你輕鬆地定義出應用於文章中的文字或 HTML,以替代實際出現在文章中的字詞或片語。這是一個方便的技巧,可用於創建常見、冗長或經常更改的文本/HTML 的快捷方式,或是表情符號。
外掛的其他特點可以透過設置和過濾器來控制,包括:
- 可啟用評論的文字替換功能(默認情況下,未啟用)
- 文字替換可以設定大小寫不敏感(預設區分大小寫)
- 文字替換可以限制每篇文章每個術語只進行一次替換(預設情況下,所有術語的所有彩現都會被替換)
- 文字替換可以提早或延遲處理 WordPress 文本過濾過程(預設提早)
- 文字替換可以擴大至影響其他過濾器
以下是一些需要注意的事項:
- 以冒號為例,最好定義一些在文本中不會出現的快捷方式:
:wp: => WordPress
:aol: => 美國線上公司
否則,可能會出現正確但不需要的替換,如 “Hi => Hello“ 會導致“His majesty” 更改為“Hellos majesty”。
- 如果您想使用此外掛處理表情符號,您應該在寫作設置管理頁面上禁用 WordPress 的默認表情符號處理程序。
- 此外掛預設設置為篩選“the_content”、“the_excerpt”、“widget_text”,可選擇篩選“get_comment_text”和“get_comment_excerpt”的篩選器。它還可以預設處理來自其他流行插件(如 Advanced Custom Fields(ACF)和 Elementor)的篩選器。 “更多過濾器”設置可用於指定其他應由插件處理的過濾器。過濾器“c2c_text_replace_filters”也可用於添加或修改受影響的過濾器列表。
- HTML 標記內(如標記名稱和屬性)的文本將不會匹配。因此,例如,在`<a href="" style=":mycss:">text</a>`中,您無法指望`: mycss:`快捷方式能夠正常工作。
- 特別注意:請注意,您在文章中使用的快捷文本將以該方式存儲在數據庫中。雖然顯示文章的調用將看到篩選後的文本替換版本,但直接在數據庫上運行的任何操作都不會看到擴展的替換文本。因此,如果您只是將“美國線上公司”稱為“:aol:”(其中:aol: => <a href='http://www.aol.com'>美國線上公司</a>),由於文本替換,訪問您的網站的訪問者將看到連結的擴展文本,但數據庫搜索永遠找不到“美國線上公司”的匹配項。
- 然而,不將替換文本保存到數據庫並在加載數據時評估替換文本的好處是,如果修改了替換文本,所有使用快捷方式的頁面將從現在開始使用更新的替換文本。
連結:外掛主頁|外掛目錄頁|GitHub|作者網站
原文外掛簡介
This plugin allows you to easily define text or HTML that should be used in your posts in place of words or phrases that are actually present in the posts. This is a handy technique for creating shortcuts to common, lengthy, or frequently changing text/HTML, or for smilies.
Additional features of the plugin controlled both via settings and filters:
Text replacement can be enabled for comments (it isn’t by default)
Text replacement can be made case insensitive (it is case sensitive by default)
Text replacement can be limited to doing only one replacement per term, per post (by default, all occurrences of a term are replaced)
Text replacement can be handled early or late in WordPress’s text filtering process (it’s early by default)
Text replacement can be expanded to affect other filters
A few things to keep these things in mind:
Your best bet with defining shortcuts is to define something that would never otherwise appear in your text. For instance, bookend the shortcut with colons:
:wp: => WordPress
:aol: => America Online, Inc.
Otherwise, you risk proper but undesired replacements:
Hi => Hello
Would have the effect of changing “His majesty” to “Hellos majesty”.
If you intend to use this plugin to handle smilies, you should probably disable WordPress’s default smilie handler on the Writing Settings admin page.
This plugin is set to filter ‘the_content’, ‘the_excerpt’, ‘widget_text’, and optionally, ‘get_comment_text’ and ‘get_comment_excerpt’. Filters from popular plugins such as Advanced Custom Fields (ACF) and Elementor are also handled by default (see FAQ for specifics). The “More filters” setting can be used to specify additional filters that should be handled by the plugin. The filter ‘c2c_text_replace_filters’ can also be used to add or modify the list of filters affected.
Text inside of HTML tags (such as tag names and attributes) will not be matched. So, for example, you can’t expect the :mycss: shortcut to work in text
SPECIAL CONSIDERATION: Be aware that the shortcut text that you use in your posts will be stored that way in the database. While calls to display the posts will see the filtered, text-replaced version, anything that operates directly on the database will not see the expanded replacement text. So if you only ever referred to “America Online” as “:aol:” (where :aol: => America Online), visitors to your site will see the linked, expanded text due to the text replace, but a database search would never turn up a match for “America Online”.
However, a benefit of the replacement text not being saved to the database and instead evaluated when the data is being loaded into a web page is that if the replacement text is modified, all pages making use of the shortcut will henceforth use the updated replacement text.
Links: Plugin Homepage | Plugin Directory Page | GitHub | Author Homepage
Developer Documentation
Developer documentation can be found in DEVELOPER-DOCS.md. That documentation covers the numerous hooks provided by the plugin. Those hooks are listed below to provide an overview of what’s available.
c2c_text_replace_filters : Customize what hooks get text replacement applied to them.
c2c_text_replace_third_party_filters : Customize what third-party hooks get text replacement applied to them.
c2c_text_replace_filter_priority : Override the default priority for the ‘c2c_text_replace’ filter.
c2c_text_replace Customize or override the setting defining all of the text replacement shortcuts and their replacements.
c2c_text_replace_comments : Customize or override the setting indicating if text replacement should be enabled in comments.
c2c_text_replace_case_sensitive : Customize or override the setting indicating if text replacement should be case sensitive.
c2c_text_replace_once : Customize or override the setting indicating if text replacement should be limited to once per term per piece of text being processed regardless of how many times the term appears.
各版本下載點
- 方法一:點下方版本號的連結下載 ZIP 檔案後,登入網站後台左側選單「外掛」的「安裝外掛」,然後選擇上方的「上傳外掛」,把下載回去的 ZIP 外掛打包檔案上傳上去安裝與啟用。
- 方法二:透過「安裝外掛」的畫面右方搜尋功能,搜尋外掛名稱「Text Replace」來進行安裝。
(建議使用方法二,確保安裝的版本符合當前運作的 WordPress 環境。
1.0 | 2.0 | 2.5 | 3.0 | 3.1 | 3.2 | 3.5 | 3.6 | 3.7 | 3.8 | 3.9 | 4.0 | 3.0.2 | 3.1.1 | 3.2.1 | 3.2.2 | 3.5.1 | 3.6.1 | 3.9.1 | trunk |
延伸相關外掛(你可能也想知道)
String locator 》當你在開發主題和外掛時,你經常會注意到某些文字被硬編碼在文件中,你需要對其進行修改,但你不知道該主題或外掛的名稱,更不知道要查找哪個文件。, 你可以...。Enhanced Text Widget 》在您的免費假網站上試試吧:點擊此處 => https://tastewp.com/plugins/enhanced-text-widget (這個技巧可用於 WP 庫中的所有外掛,只需將 URL 中的「word...。
Texty – SMS Notification for WordPress, WooCommerce, Dokan and more 》Texty是一個輕量級的WordPress簡訊通知外掛程式。, , 隨著您收件匣收到眾多電子郵件,往往會讓最重要的事情掉到後頭。在手機、WhatsApp或Telegram收到簡訊通...。
Randomize 》Randomize 外掛可以顯示隨機的文字,您可以在管理後台按類別輸入文字、引文和 HTML 代碼。您可以使用小工具、shortcode 或模板標籤顯示網站上的隨機內容。, ...。Custom Shortcodes 》使用插入短碼 [custom name=”field-name” value=”field-value“] 或 HTML 條件注釋 <!–custom name=”field-name̶...。
Advanced Text Widget 》Advanced Text Widget 是一個文字小工具,允許您執行原始 PHP 代碼,並指定它在哪些頁面上顯示。它有 10 種預設的可見條件。您也可以編輯和/或添加自己的可見...。
Random Text 》RandomText 是一個方便的 WordPress 外掛,可以讓你保存、編輯和刪除分類文本,並通過小工具將隨機/旋轉的文本按類別注入側邊欄或通過模板標籤注入頁面正文。...。
Search and Replace for Block Editor 》總結:這個外掛將 PC 用戶在 Microsoft Word 和 Google Docs 中熟悉的搜尋和替換功能引入到區塊編輯器中,提高了使用者的效率,允許快速搜索文本並在內容中進...。
Special Text Boxes 》此外掛會新增一個小的樣式表檔案和短代碼到部落格中,以顏色方塊來突顯文章中的某些部分。提供了7種樣式,如警告、警示、資訊和下載等。 , 如果您需要探索此...。WP Typograph Lite 》這個外掛WP Typograph Lite適用於大多數俄語博客,旨在根據俄語印刷標準自動格式化文本。它處理所有主要內容塊-標題、文章和頁面文本、評論。格式化是在頁面...。
Gettext override translations 》此外掛可讓您在管理面板中覆蓋預設文字。, 原本是為覆蓋 Woocommerce 的文字而建立,但也可作用於 WordPress Core 及其他外掛所添加的文字。, , 它將會翻譯所...。
Generate Dummy Posts 》使用 Generate Dummy Posts 外掛程式,您可以輕鬆地在一個按鈕點擊中創建虛擬文章。開發人員和設計師通常使用虛擬文本來創建或開發部落格式 WordPress 網站,...。
CopyRightPro 》CopyRightPro是一個外掛,可以防止從您的部落格複製文字和圖像,如果您安裝這個外掛,您的WordPress內容將會受到保護。, CopyRightPro是由Wp-CopyRightPro.Co...。
Classic Text Widget 》此外掛可讓您使用經典 WordPress 文字小工具,而不需要使用 TinyMCE 編輯器。其程式碼基於 WordPress Ver. 4.7.5。, 功能與版本 4.8 之前的預設文本小工具完...。
Change Text Case 》這個外掛解決了我最大的煩惱之一,那就是快速更改所選文本的大小寫。客戶通常會以全大寫或全小寫的方式發送文本,而繁瑣的點擊文本以更改大小寫往往非常枯燥...。
