[WordPress] 外掛分享: RDP Google Custom Search

WordPress 外掛 RDP Google Custom Search 的封面圖片。

前言介紹

  • 這款 WordPress 外掛「RDP Google Custom Search」是 2015-02-22 上架。
  • 目前有 10 個安裝啟用數。
  • 上一次更新是 2016-11-30,距離現在已有 3076 天。超過一年沒更新,安裝要確認版本是否可用。以及後續維護問題!
  • 外掛最低要求 WordPress 3.4 以上版本才可以安裝。
  • 有 1 人給過評分。
  • 還沒有人在論壇上發問,可能目前使用數不多,還沒有什麼大問題。

外掛協作開發者

rpayne7264 |

外掛標籤

google search | search results | google custom search | multiple site search | google custom search engine |

內容簡介

注意:此外掛僅適用於付費版本的 Google Custom Search。

透過RDP Google Custom Search,您可以針對您的網站內容或其他網站內容進行定位。您可以添加多個CSE,讓訪客選擇其一。

RDP Google Custom Search使用簡單的短碼,使得搜尋框可以放置在任何地方。

您可以在頁面的主要內容中放置多CSE搜尋框,然後將另一個搜尋框放置在側邊欄,該搜尋框專門用於僅使用一個CSE,例如您的網站。

每個搜尋框還提供了頁面選擇器,它可以搜尋當前頁面並突顯匹配的文本。

搜尋結果使用一個特殊的模板顯示,該模板替換當前頁面/文章的內容,並可以按照需要進行樣式設置。結果內容的默認寬度為980px。內置渲染函數標記了結果以使用Google樣式的HTML和類名。

此外掛可以與RDP Wiki Embed外掛一起使用,該外掛允許您在搜尋結果中的鏈接指向MediaWiki站點,並在您自己的網站上顯示內容。

使用方法

RDP Google Custom Search使用短碼[rdp-gcs]實現。它接受以下參數:

id:(必填)id號碼的逗號分隔列表,指示要使用的CSE
default:當選擇多個CSE時,這指示默認使用的CSE

示例:

[rdp-gcs id=’3′]

[rdp-gcs id=’1,3′ default=’1′]

已包含的外部腳本

jQuery.PositionCalculator v1.1.2(遵循MIT許可證)
jQuery Highlight(遵循MIT許可證)

PHP Hook 參考:
rdp_gcs_render_search_results_applied

參數:無
在將默認渲染函數添加到過濾器陣列後執行

rdp_gcs_styles_enqueued

參數:無
在特定於外掛的樣式已經排入佇列之後執行

rdp_gcs_scripts_enqueued

參數:無
在特定於外掛的腳本已經排入佇列之後執行

PHP Filter 參考:
rdp_gcs_before_search_box

參數:空字串
在結果模板內部搜索框的渲染之前執行
返回:在搜尋框之前要渲染的任何文本/HTML/腳本

rdp_gcs_after_search_box

參數:空字串
在結果模板內部搜索框的渲染之後執行
返回:在搜尋框之後要渲染的任何文本/HTML/腳本

rdp_gcs_before_search_results

參數:空字串
在結果模板內部搜索結果的渲染之前執行
返回:在搜尋結果之前要渲染的任何文本/HTML/腳本

rdp_gcs_render_search_results

參數1:包含Google API搜索結果的JSON對象,如果API調用期間出現錯誤則為NULL
參數2:包含搜索請求期間設置的最後一個錯誤消息的字符串,如果沒有錯誤發生,則為空字符串
此過濾器用於鉤住一個函數,該函數將呈現搜尋結果。對於自定義渲染函數,請確保在rdp_gcs_render_search_results_applied過程中刪除此過濾器,然後重新設置此過濾器以使用您的自定義渲染函數

rdp_gcs_after_search_results

參數:空字串
在結果模板內部搜索結果的渲染之後執行

原文外掛簡介

ATTN: This plugin only works with the PAID version of Google Custom Search.
With RDP Google Custom Search, you can target your site’s contents, or other site’s contents. You can add multiple CSEs and allow your visitor to choose one.
RDP Google Custom Search uses a simple shortcode so that a search box can be placed anywhere.
You can put a multi-CSE search box in the main content of your page, and then put another search box in the sidebar that is dedicated to only one CSE, such as your site.
Each search box also provides a Page selector, which will search the current page and highlight matching text.
The results are displayed using a special template that replaces the content of the current page/post and that can be styled as desired. The default width of the results content is 980px. The built-in rendering function marks up the results to use Google styling HTML and class names.
This plugin can be used with the RDP Wiki Embed plugin, which allows you to have the links in the search results that point to MediaWiki sites to postback and display content on your own web site.
Usage
RDP Google Custom Search is implemented using the shortcode [rdp-gcs]. It accepts the following arguments:

id: (required) comma separated list of id numbers, indicating the CSEs to use
default: when more than one CSE is selected, this indicates the CSE to use by default

Examples:
[rdp-gcs id=’3′]
[rdp-gcs id=’1,3′ default=’1′]
External Scripts Included

jQuery.PositionCalculator v1.1.2 under MIT License
jQuery Highlight under MIT License

PHP Hook Reference:
rdp_gcs_render_search_results_applied

Params: none
Fires after the default render function is added to the filters array.

rdp_gcs_styles_enqueued

Params: none
Fires after plugin-specific styles are enqueued

rdp_gcs_scripts_enqueued

Params: none
Fires after plugin-specific scripts are enqueued

PHP Filter Reference:
rdp_gcs_before_search_box

Param: empty string
Fires before the rendering of the search box within the results template
Return: any text/HTML/script to be rendered before the search box

rdp_gcs_after_search_box

Param: empty string
Fires after the rendering of the search box within the results template
Return: any text/HTML/script to be rendered after the search box

rdp_gcs_before_search_results

Param: empty string
Fires before the rendering of the search results within the results template
Return: any text/HTML/script to be rendered before the search results

rdp_gcs_render_search_results

Param 1: JSON object containing Google API search results or NULL if an error occurred during the API call
Param 2: string containing the last error message set during the search request or empty string if no error occurred
This filter is required for hooking into a function that will render the search results. For a custom rendering function, be sure to remove this filter during the rdp_gcs_render_search_results_applied hook, and then re-set this filter to use your custom rendering function

rdp_gcs_after_search_results

Param: empty string
Fires after the rendering of the search results within the results template
Return: any text/HTML/script to be rendered after the search results

各版本下載點

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

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


0.1.0 | 0.1.1 | 0.1.2 | 0.1.3 | 1.0.0 | trunk |

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

暫無相關外掛推薦。

文章
Filter
Apply Filters
Mastodon