
內容簡介
WP Live Search (beta) 是一款 WordPress 的搜索外掛,當使用者輸入查詢關鍵字時,能即時顯示相關搜尋結果。目前支援文章、頁面、多個自訂文章類型以及自訂設計模式。
此版本為實驗版,如有任何問題請在下方的 Github repo 中記錄問題。
https://github.com/bearded-avenger/wp-live-search
以下是一些文件說明。
http://bearded-avenger.github.io/wp-live-search/
將 shortcode[wp_live_search]新增到頁面或其他內容。有幾個 shortcode 屬性可以使用,如下所示:
type=””
可選項目包括posts或pages,預設為posts。您還可以傳遞type,type以搜索多個文章類型。例如,type=”recipes,books”
multi=””
預設為關閉狀態。只有當上方使用多個文章類型時,才將其設置為 true。
placeholder=””
輸入框中顯示的文字。預設為Search...。
number=””
返回的搜索結果總數。默認值為20
excerpt=”true”
顯示標題、摘要和精選圖片(如果設置)
compact=”true”
在標題小工具等中使用 WP Live Search 的簡化版本
dropdown=”true”
將搜索結果顯示為下拉菜單,而不是推動其周圍的內容。
results=””
顯示搜索結果的文字。預設為entries found。
results_style=”inside”
在較小空間中使用的樣式,可以將「entries found」顯示在輸入框內。
target=””
一個可選的目標 UL 父元素以將搜索結果發送到。例如:target="#someotherdiv"。
以下是幾個示例:
預設用法:
[wp_live_search]
在標題小工具中使用:
[wp_live_search compact=”true” dropdown=”true” results=”found” results_style=”inside”]
搜索多個文章類型:
[wp_live_search multi=”true” type=”posts,page”]
外掛標籤
開發者團隊
原文外掛簡介
WP Live Search (beta) is a search plugin for WordPress that returns results as the user types for what they are looking. It currently supports posts, pages, post types, including multiple post types, and design modes.
This is very much a working prototype, so please log any issues you find on the Github repo below.
https://github.com/bearded-avenger/wp-live-search
Here’s some documentation.
http://bearded-avenger.github.io/wp-live-search/
Add the shortcode [wp_live_search] to a page or something. There’s a few shortcode attributes that you can use, and are as follows:
type=””
Your choices are posts or pages. Defaults to posts. You can also pass type,type to search multiple post types. For example type=”recipes,books”
multi=””
By default this is turned off. Set this to true only if you’re using multiple post types above.
placeholder=””
The text displayed in the input. Defaults to Search....
number=””
Total search result to return. Default is 20
excerpt=”true”
Show the excerpt along with the title and featured image (if set)
compact=”true”
Makes a tiny WP Live Search for use in header widgets and such
dropdown=”true”
Display search results as a drop-down instead of pushing down the content around it
results=””
The text displayed for the results. Defaults to entries found.
results_style=”inside”
Displays the “entries found” inside of the input area, useful for using in areas like header widgets where space is minimal.
target=””
An optional target UL parent to send the search results to. Example target="#someotherdiv".
Here are a couple examples:
Default Usage:
[wp_live_search]
Use in Header Widget:
[wp_live_search compact=”true” dropdown=”true” results=”found” results_style=”inside”]
Search through multiple post types:
[wp_live_search multi=”true” type=”posts,page”]
