AI助手支持GPT4.0
A faceted search is one that allows you to drill down by various fields:
多面搜索是一种可让您按各个字段进行深入研究的搜索:
price, size, colour, shipping location etc.
价格,尺寸,颜色,运输地点等。
It complements a free text search rather than replaces it.
它是对自由文本搜索的补充而不是替代。 p>
Using this plugin, you can create a faceted search interface for your pages and posts,
使用此插件,您可以为页面和帖子创建多面搜索界面,
or any other custom post type.
或任何其他自定义帖子类型。
You can add “facets” for:
您可以为以下项添加“方面”: p>
ul>
These facets are widgets that can be easily changed in the admin interface.
这些方面是可以在管理界面中轻松更改的小部件。 p>
bang-faceted-search
/wp-content/plugins/
bang-faceted-search code>目录上传到您的 / wp-content / plugins / code>目录 li>Activate the plugin through the ‘Plugins’ menu in WordPress通过WordPress中的“插件”菜单激活插件 li>Create a template search.php in your theme在主题中创建模板 search.php code> li>
/ wp-content / plugins / code>目录 li>Activate the plugin through the ‘Plugins’ menu in WordPress通过WordPress中的“插件”菜单激活插件 li>Create a template search.php in your theme在主题中创建模板 search.php code> li>
search.php
search.php code> li>
ol>
You need to create a search template in your theme called search.php.
您需要在主题中创建一个名为 search.php code>的搜索模板。This template will be used whenever the user searches your site.每当用户搜索您的网站时,都会使用此模板。 p>Add this code to your functions.php to create a search-specific sidebar:将此代码添加到您的 functions.php code>中,以创建特定于搜索的侧边栏: p>register_sidebar(array( register_sidebar(array( 'name' => 'Search', '名称'=>'搜索', 'id' => 'search''id'=>'搜索'));)); code> pre>Your search template should include that sidebar:您的搜索模板应包含该侧边栏: p> <?php dynamic_sidebar('search'); ?>?> code> pre>Then in the admin interface, drag Facet widgets into that sidebar to add, customise然后在管理界面中,将Facet小部件拖动到该侧栏中以添加,自定义and re-order the search widgets for your site.并重新排序您网站的搜索窗口小部件。 p>Customising the faceted search自定义多面搜索 h4>Your site can have more than the default search page, and you can use the您的网站可以包含多个默认搜索页面,并且您可以使用faceted search plugin to search custom post types.多面搜索插件可搜索自定义帖子类型。 p>To make a custom search, create a page with a custom template in your theme.要进行自定义搜索,请在主题中创建一个带有自定义模板的页面。For example, if you have a page called /products, then create a template例如,如果您有一个名为 / products code>的页面,则创建一个模板in your theme called products.php.在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
search.php code>的搜索模板。This template will be used whenever the user searches your site.每当用户搜索您的网站时,都会使用此模板。 p>Add this code to your functions.php to create a search-specific sidebar:将此代码添加到您的 functions.php code>中,以创建特定于搜索的侧边栏: p>register_sidebar(array( register_sidebar(array( 'name' => 'Search', '名称'=>'搜索', 'id' => 'search''id'=>'搜索'));)); code> pre>Your search template should include that sidebar:您的搜索模板应包含该侧边栏: p> <?php dynamic_sidebar('search'); ?>?> code> pre>Then in the admin interface, drag Facet widgets into that sidebar to add, customise然后在管理界面中,将Facet小部件拖动到该侧栏中以添加,自定义and re-order the search widgets for your site.并重新排序您网站的搜索窗口小部件。 p>Customising the faceted search自定义多面搜索 h4>Your site can have more than the default search page, and you can use the您的网站可以包含多个默认搜索页面,并且您可以使用faceted search plugin to search custom post types.多面搜索插件可搜索自定义帖子类型。 p>To make a custom search, create a page with a custom template in your theme.要进行自定义搜索,请在主题中创建一个带有自定义模板的页面。For example, if you have a page called /products, then create a template例如,如果您有一个名为 / products code>的页面,则创建一个模板in your theme called products.php.在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
This template will be used whenever the user searches your site.
每当用户搜索您的网站时,都会使用此模板。 p>
Add this code to your functions.php to create a search-specific sidebar:
functions.php
将此代码添加到您的 functions.php code>中,以创建特定于搜索的侧边栏: p>register_sidebar(array( register_sidebar(array( 'name' => 'Search', '名称'=>'搜索', 'id' => 'search''id'=>'搜索'));)); code> pre>Your search template should include that sidebar:您的搜索模板应包含该侧边栏: p> <?php dynamic_sidebar('search'); ?>?> code> pre>Then in the admin interface, drag Facet widgets into that sidebar to add, customise然后在管理界面中,将Facet小部件拖动到该侧栏中以添加,自定义and re-order the search widgets for your site.并重新排序您网站的搜索窗口小部件。 p>Customising the faceted search自定义多面搜索 h4>Your site can have more than the default search page, and you can use the您的网站可以包含多个默认搜索页面,并且您可以使用faceted search plugin to search custom post types.多面搜索插件可搜索自定义帖子类型。 p>To make a custom search, create a page with a custom template in your theme.要进行自定义搜索,请在主题中创建一个带有自定义模板的页面。For example, if you have a page called /products, then create a template例如,如果您有一个名为 / products code>的页面,则创建一个模板in your theme called products.php.在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
functions.php code>中,以创建特定于搜索的侧边栏: p>register_sidebar(array( register_sidebar(array( 'name' => 'Search', '名称'=>'搜索', 'id' => 'search''id'=>'搜索'));)); code> pre>Your search template should include that sidebar:您的搜索模板应包含该侧边栏: p> <?php dynamic_sidebar('search'); ?>?> code> pre>Then in the admin interface, drag Facet widgets into that sidebar to add, customise然后在管理界面中,将Facet小部件拖动到该侧栏中以添加,自定义and re-order the search widgets for your site.并重新排序您网站的搜索窗口小部件。 p>Customising the faceted search自定义多面搜索 h4>Your site can have more than the default search page, and you can use the您的网站可以包含多个默认搜索页面,并且您可以使用faceted search plugin to search custom post types.多面搜索插件可搜索自定义帖子类型。 p>To make a custom search, create a page with a custom template in your theme.要进行自定义搜索,请在主题中创建一个带有自定义模板的页面。For example, if you have a page called /products, then create a template例如,如果您有一个名为 / products code>的页面,则创建一个模板in your theme called products.php.在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
register_sidebar(array( register_sidebar(array( 'name' => 'Search', '名称'=>'搜索', 'id' => 'search''id'=>'搜索'));)); code> pre>Your search template should include that sidebar:您的搜索模板应包含该侧边栏: p> <?php dynamic_sidebar('search'); ?>?> code> pre>Then in the admin interface, drag Facet widgets into that sidebar to add, customise然后在管理界面中,将Facet小部件拖动到该侧栏中以添加,自定义and re-order the search widgets for your site.并重新排序您网站的搜索窗口小部件。 p>Customising the faceted search自定义多面搜索 h4>Your site can have more than the default search page, and you can use the您的网站可以包含多个默认搜索页面,并且您可以使用faceted search plugin to search custom post types.多面搜索插件可搜索自定义帖子类型。 p>To make a custom search, create a page with a custom template in your theme.要进行自定义搜索,请在主题中创建一个带有自定义模板的页面。For example, if you have a page called /products, then create a template例如,如果您有一个名为 / products code>的页面,则创建一个模板in your theme called products.php.在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
register_sidebar(array( 'name' => 'Search', '名称'=>'搜索', 'id' => 'search''id'=>'搜索'));));
'name' => 'Search',
'名称'=>'搜索',
'id' => 'search'
'id'=>'搜索'
));
));
code> pre>
Your search template should include that sidebar:
您的搜索模板应包含该侧边栏: p>
<?php dynamic_sidebar('search'); ?>?> code> pre>Then in the admin interface, drag Facet widgets into that sidebar to add, customise然后在管理界面中,将Facet小部件拖动到该侧栏中以添加,自定义and re-order the search widgets for your site.并重新排序您网站的搜索窗口小部件。 p>Customising the faceted search自定义多面搜索 h4>Your site can have more than the default search page, and you can use the您的网站可以包含多个默认搜索页面,并且您可以使用faceted search plugin to search custom post types.多面搜索插件可搜索自定义帖子类型。 p>To make a custom search, create a page with a custom template in your theme.要进行自定义搜索,请在主题中创建一个带有自定义模板的页面。For example, if you have a page called /products, then create a template例如,如果您有一个名为 / products code>的页面,则创建一个模板in your theme called products.php.在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
<?php dynamic_sidebar('search'); ?>?>
?>
?>
Then in the admin interface, drag Facet widgets into that sidebar to add, customise
然后在管理界面中,将Facet小部件拖动到该侧栏中以添加,自定义
and re-order the search widgets for your site.
并重新排序您网站的搜索窗口小部件。 p>
Your site can have more than the default search page, and you can use the
您的网站可以包含多个默认搜索页面,并且您可以使用
faceted search plugin to search custom post types.
多面搜索插件可搜索自定义帖子类型。 p>
To make a custom search, create a page with a custom template in your theme.
要进行自定义搜索,请在主题中创建一个带有自定义模板的页面。
For example, if you have a page called /products, then create a template
/products
例如,如果您有一个名为 / products code>的页面,则创建一个模板in your theme called products.php.在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
/ products code>的页面,则创建一个模板in your theme called products.php.在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
in your theme called products.php.
products.php
在名为 products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
products.php code>的主题中。Near the start of this template, call this code:在此模板的开头附近,调用以下代码: p>$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
Near the start of this template, call this code:
在此模板的开头附近,调用以下代码: p>
$faceted_search = bang_faceted_search(null, array( $ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));)); code> pre>Later on, display the results with something like:稍后,显示类似以下内容的结果: p>if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
$ faceted_search = bang_faceted_search(null,array( 'force' => array( '力'=>数组( 'post_type' => 'product' 'post_type'=>'产品' ))));));
'force' => array(
'力'=>数组(
'post_type' => 'product'
'post_type'=>'产品'
)
)
Later on, display the results with something like:
稍后,显示类似以下内容的结果: p>
if ($faceted_search->has_posts()) { if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}} code> pre>
if($ faceted_search-> has_posts()){ echo "Search results"; 回显“ 搜索结果 h1>”; $faceted_search->write_feedback(); $ faceted_search-> write_feedback(); $posts = $faceted_search->get_posts(); $ posts = $ faceted_search-> get_posts(); global $post; 全球$ post; $original_post = $post; $ original_post = $ post; foreach ($posts as $post) { foreach(将$ posts作为$ post){ setup_postdata($post); setup_postdata($ post); // ... write the post ... // ...写帖子... } } $post = $original_post; $ post = $ original_post; setup_postdata($post); setup_postdata($ post); echo $faceted_search->paginate();echo $ faceted_search-> paginate();}}
echo "
回显“
$faceted_search->write_feedback();
$ faceted_search-> write_feedback();
$posts = $faceted_search->get_posts();
$ posts = $ faceted_search-> get_posts();
global $post;
全球$ post;
$original_post = $post;
$ original_post = $ post;
foreach ($posts as $post) {
foreach(将$ posts作为$ post){
setup_postdata($post);
setup_postdata($ post);
// ... write the post ...
// ...写帖子...
}
$post = $original_post;
$ post = $ original_post;
echo $faceted_search->paginate();
echo $ faceted_search-> paginate();
原文出处:http://www.sanshu.cn/a/3901.html
群主管理都是支付大佬