ショートコード
現在のバージョン: 1.8.5
この拡張機能は、SearchWP検索エンジン用の検索フォームと結果ページの両方を生成するショートコードを提供します。検索フォームや結果ループを実装するためにテーマファイルを直接編集することに慣れていない(またはできない)場合に便利です。
ショートコードをアクティブにすると、次のものが利用可能になります。
| ショートコード | 属性 |
|---|---|
searchwp_search_form特定の検索エンジンの検索フォームを出力します | target — フォームのアクション(デフォルトは既存のパーマリンク)engine — 検索エンジンの名前(デフォルトはdefault)var — 検索クエリ変数の名前(デフォルトはswpquery)button_text — フォームボタンのテキスト(デフォルトはSearch)hide_button — 「true」または「false」のいずれか、検索フォームの送信ボタンを非表示にしますplaceholder — フォーム入力フィールドのプレースホルダーテキスト(デフォルトはSearch)live_search — 「true」または「false」のいずれか、グローバルな「ライブ検索を有効にする」設定の値を無視して、このフォームのライブAjax検索を強制的に有効/無効にします |
searchwp_search_results検索が送信された後の検索結果のリストを出力します | engine — 検索エンジンの名前(デフォルトはdefault)var — 検索クエリ変数の名前(デフォルトはswpquery)posts_per_page — 1ページあたりの表示投稿数これは自己終了ショートコードではないことに注意してください。各検索結果のマークアップは内部にネストする必要があります。例については、以下のサンプルを参照してください |
searchwp_search_result_link結果のタイトルのテキストで、現在の検索結果へのリンクを出力します | direct — 「true」または「false」のいずれか。trueの場合、パーマリンクに直接リンクします。添付ファイルの場合は、親ページではなくそのURLに直接リンクします |
searchwp_search_result_excerpt現在の検索結果の抜粋を出力します | なし |
searchwp_search_results_none検索結果が見つからなかった場合の出力 | なし これは自己終了ショートコードではないことに注意してください。各検索結果のマークアップは内部にネストする必要があります。例については、以下のサンプルを参照してください |
searchwp_search_results_pagination検索結果のページネーションを出力します | engine — 検索エンジンの名前(デフォルトはdefault)direction — 「prev」または「next」のいずれかlink_text — リンクに使用するテキストvar — 検索クエリ変数の名前(デフォルトはswpquery) |
searchwp_search_results_paginate_links検索結果のページネーションリンクを出力します | engine — Search engine name (Default is default)var — The search query variable name (Default is swpquery)In addition to the above, arguments from paginate_links are also supported. |
searchwp_search_result_imageOutputs Featured Image for the current result | size — Image size (Default is thumb) |
searchwp_search_result_permalinkOutputs permalink for the current result with the text of the result’s permalink | direct — Whether to link directly to Media files (Default is 'true') |
searchwp_total_resultsOutputs a total number of results for the current search | engine — Search engine name (Default is default)var — The search query variable name (Default is swpquery)text — The text to use alongside the number of results. Supports %total% and %query% placeholders for precise formatting.[searchwp_total_results text="Found %total% results for %query%"] converts to “Found 0 results for example search”. |
Here is a sample of a comprehensive implementation of Shortcodes that searches a supplemental engine with a name of my_test_engine :
You can customize the attributes as per the table above.
変更履歴
1.8.5
- [Fix] Label FOR attribute not matching the input ID when a custom search variable is used.
1.8.4
- [New] Added option to hide submit button.
1.8.3
- [New] Compatibility with Live Ajax Search.
- [Improvement] The
searchwp_total_resultsshortcode supports text customizations.
1.8.2
- [Fix] Prevent Error due to Shortcode recursion.
- [更新] アップデーターを更新しました。
1.8.1
- [Fix]
posts_per_pageattribute not reflected when using SearchWP 4.
1.8.0
- [New] New Shortcode
searchwp_search_results_paginate_linksfor paginated links. - [New] New Shortcode
searchwp_search_result_imagefor result Featured Image output. - [New] New Shortcode
searchwp_search_result_permalinkfor result permalink output. - [更新] アップデーターを更新しました。
1.7.0
- [New] Compatibility with SearchWP 4.
1.6.1
- [Fix] Issue with handling quotes.
1.6
- [New] New Shortcode:
searchwp_total_resultsto output the total number of search results. - [New] Adds
placeholderargument tosearchwp_search_formShortcode. - [更新] アップデーターを更新しました。
1.5.4
- [Fix] Additional checks to prevent edge case function redeclaration.
- [更新] アップデーターを更新しました。
1.5.3
- [New] New filter:
searchwp_shortcodes_engine. - [New] New filter:
searchwp_shortcodes_paginate_links. - [New] New filter:
searchwp_shortcodes_pagination_prev. - [New] New filter:
searchwp_shortcodes_pagination_next. - [更新] アップデーターを更新しました。
1.5.1
- [新規] 新しいショートコード
[searchwp_search_result_excerpt_global]。 - [新規] 新しいショートコード
[searchwp_search_result_excerpt_document]。 - [改善] タームハイライトとの連携を強化するため、エスケープ処理を改善しました。
1.5
- [改善] SearchWPライセンスキーに基づいた自動更新のサポート。
1.2.1
- [新規] 出力中にいくつかの追加アクションを追加しました。
1.2
- [変更] その他、ショートコード属性でGET変数を設定できるようにしました。
1.1
- [修正] 属性がショートコードコールバックに渡されない問題を修正しました。
1.0
- 初回リリース。

