[WordPress] 外掛分享: TC Specify Search Form

首頁外掛目錄 › TC Specify Search Form
10+
安裝啟用
尚無評分
3869 天前
最後更新
問題解決
WordPress 3.4+ v1.0 上架:2012-09-27

內容簡介

預設情況下,WordPress 中的「搜尋」小工具會包含您的佈景主題中的 searchform.php 模板檔案(如果存在),或 wp-includes/general-template.php 中的搜尋程式碼(如果找不到該檔案)。然而,如果您想要使用作為小工具的特殊搜尋表單(或表單!),這樣就允許您使用「searchform-辨識碼.php」格式來輸入它,以便於您區分佈景主題中的其他樣板。您只需要在佈景主題中設置好符合您所需的 HTML 的該檔案即可。

例如:如果您想要為您的小工具創建一個獨特的 searchform 檔案,請建立並命名該樣板檔案為「searchform-widget.php」(破折號和點之間的內容由您自行決定,只要符合檔名要求即可)。在小工具設置的「樣板」欄位中,只需輸入「widget」,即可自動調用該搜尋表單檔案。

注意:實際編寫搜索表單由您自行決定。這需要一些主題設計技能,但我對您有信心!

待辦事項:製作一個短代碼版本,以在頁面和文章中使用。

外掛標籤

開發者團隊

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

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

原文外掛簡介

By default, the “Search” widget in WordPress will include the searchform.php template file in your theme (if it exists), or the search code in wp-includes/general-template.php (if it doesn’t). However, if you want a distinctive search form (or forms!) to use as a widget, this allows you to enter it in using the “searchform-identifier.php” format that you can use to distinguish other templates elsewhere in your theme. You just have to have that file set up in your theme with the HTML you want to use.
Example: If you want to have a distinct searchform file specifically for your widgets, create the template file and call it something like “searchform-widget.php” (what goes between the dash and the dot is up to you, so long as it meets filename requirements). In the “Template” field of the widget settings, enter only “widget”, and that searchform file will be called in your widget automagically.
Note: Actually coding the search form is up to you. That requires some theming skillz, but I have confidence in you!
To Do: Make a short-code version of this, for use in pages and posts.

延伸相關外掛

文章
Filter
Apply Filters
Mastodon