{"id":23723,"date":"2013-06-05T09:04:16","date_gmt":"2013-06-05T09:04:16","guid":{"rendered":"https:\/\/wordpress.org\/plugins-wp\/bang-faceted-search\/"},"modified":"2020-11-17T14:51:10","modified_gmt":"2020-11-17T14:51:10","slug":"bang-faceted-search","status":"publish","type":"plugin","link":"https:\/\/ml.wordpress.org\/plugins\/bang-faceted-search\/","author":1901556,"comment_status":"closed","ping_status":"closed","template":"","meta":{"version":"2.0","stable_tag":"trunk","tested":"5.5.0","requires":"3.7","requires_php":"","requires_plugins":"","header_name":"Bang Faceted Search","header_author":"Marcus Downing","header_description":"","assets_banners_color":"","last_updated":"2020-11-17 14:51:10","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"http:\/\/www.bang-on.net\/","header_author_uri":"http:\/\/www.bang-on.net\/","rating":1,"author_block_rating":0,"active_installs":10,"downloads":3046,"num_ratings":1,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","faq","changelog"],"tags":[],"upgrade_notice":[],"ratings":{"1":1,"2":0,"3":0,"4":0,"5":0},"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[]},"plugin_section":[],"plugin_tags":[944],"plugin_category":[],"plugin_contributors":[83366,83365],"plugin_business_model":[],"class_list":["post-23723","plugin","type-plugin","status-publish","hentry","plugin_tags-search","plugin_contributors-diddledan","plugin_contributors-marcusdowning","plugin_committers-marcusdowning"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/bang-faceted-search.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>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>\n\n<p>Using this plugin, you can create a faceted search interface for your pages, posts, or any other custom post type. You can add \"facets\" for:<\/p>\n\n<ul>\n<li>Taxonomies<\/li>\n<li>Custom fields<\/li>\n<li>Dates (day, week, month or year)<\/li>\n<li>Author<\/li>\n<\/ul>\n\n<p>These facets are widgets that can be easily changed in the admin interface.<\/p>\n\n<p>You can have multiple search pages for different post types. If your WordPress installation uses multi-site, you can search across the different sites.<\/p>\n\n<!--section=installation-->\n<ol>\n<li>Upload the <code>bang-faceted-search<\/code> directory to your <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<li>Create a template <code>search.php<\/code> in your theme<\/li>\n<li>Go to Settings &gt; Faceted Search to set up your search pages.<\/li>\n<\/ol>\n\n<h4>Creating a search page<\/h4>\n\n<p>By default, you'll have a single search address, at the site root <code>\/<\/code>. This lines up with WordPress search.<\/p>\n\n<p>In the WordPress admin adrea, go to Settings &gt; Faceted Search. At the top is<\/p>\n\n<h4>Creating a search template<\/h4>\n\n<p>You need to create a search template in your theme called <code>search.php<\/code>, if you don't already have one. This template will be used whenever the user searches your site. You can have more than one search template, each.<\/p>\n\n<p>Add this code to your <code>functions.php<\/code> to create a search-specific sidebar:<\/p>\n\n<pre><code>register_sidebar(array(\n  'name' =&gt; 'Search',\n  'id' =&gt; 'search'\n));\n<\/code><\/pre>\n\n<p>Your search template should include that sidebar:<\/p>\n\n<pre><code>&lt;?php dynamic_sidebar('search'); ?&gt;\n<\/code><\/pre>\n\n<p>Then in the admin interface, drag Facet widgets into that sidebar to add, customise and re-order the search widgets for your site.<\/p>\n\n<h4>Customising the faceted search<\/h4>\n\n<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>\n\n<p>To make a custom search, create a page with a custom template in your theme. For example, if you have a page called <code>\/products<\/code>, then create a template in your theme called <code>products.php<\/code>. Near the start of this template, call this code:<\/p>\n\n<pre><code>$faceted_search = bang_faceted_search(null, array(\n  'force' =&gt; array(\n    'post_type' =&gt; 'product'\n  )\n));\n<\/code><\/pre>\n\n<p>Later on, display the results with something like:<\/p>\n\n<pre><code>if ($faceted_search-&gt;has_posts()) {\n  echo \"&lt;h1&gt;Search results&lt;\/h1&gt;\";\n  $faceted_search-&gt;write_feedback();\n\n  $posts = $faceted_search-&gt;get_posts();\n  global $post;\n  $original_post = $post;\n  foreach ($posts as $post) {\n    setup_postdata($post);\n    \/\/ ... write the post ...\n  }\n  $post = $original_post;\n  setup_postdata($post);\n  echo $faceted_search-&gt;paginate();\n}\n<\/code><\/pre>\n\n<!--section=faq-->\n<dl>\n<dt><h3>What's wrong with a simple search field?<\/h3><\/dt>\n<dd><p>Nothing, but faceted search makes your search richer.<\/p>\n\n<p>Faceted search doesn't replace the normal search field, it complements it. You can have both, without any boundary between them.<\/p><\/dd>\n<dt><h3>What's a \"facet\"?<\/h3><\/dt>\n<dd><p>It's a means of narrowing down search results. A user might want to narrow down by categories or tags, by the author of a post, by the date it was published or by the contents of a taxonomy or custom field.<\/p><\/dd>\n<dt><h3>Why don't I see any faceted search links?<\/h3><\/dt>\n<dd><p>Make sure to create a search sidebar, and put some widgets into it.<\/p>\n\n<p>If a facet widget has the <strong>Hide empty terms<\/strong> option checked, then that facet may easily disappear from a view when all its links would produce zero results.<\/p><\/dd>\n<dt><h3>Can I put other widgets into the same sidebar as the facet widgets?<\/h3><\/dt>\n<dd><p>Yes. It's a normal sidebar, you can put any widgets into it.<\/p><\/dd>\n<dt><h3>Can I put facet widets into other sidebars?<\/h3><\/dt>\n<dd><p>If the page you're on isn't a search page, facet widgets will be invisible.<\/p><\/dd>\n<dt><h3>Does this work with Relevanssi?<\/h3><\/dt>\n<dd><p>Yes. If you have the Relevanssi plugin switched on at the same time, they'll cooperate to deliver the best search results.<\/p><\/dd>\n<dt><h3>Does this work with my eCommerce\/calendar\/reviews\/other plugin?<\/h3><\/dt>\n<dd><p>You can make a faceted search on any post type, but it won't understand any special fields like 'price' or 'score' if they're implemented in a non-standard way.<\/p><\/dd>\n<dt><h3>Can I make my own facets? Can I filter the results? Can I change how the plugin works?<\/h3><\/dt>\n<dd><p>Yes, yes and yes.<\/p>\n\n<p>If you use a plugin that defines its own post types, such as an ecommerce or events calendar plugin, then you might want to make your own facet widgets. Create a WordPress widget and register it in the normal way. Look at the code of the included widgets to get an idea how to implement the links.<\/p>\n\n<p>There are a lot more actions and filters you can hook into - have a look through the code to find them. Here are just a few of them:<\/p>\n\n<ul>\n<li><code>bang_fs_query<\/code> - The parameters to <code>WP_Query<\/code><\/li>\n<li><code>bang_fs_results<\/code> - The posts returned<\/li>\n<li><code>bang_fs_count<\/code> - The number of results<\/li>\n<li><code>bang_fs_feedback_args<\/code> - The fields to display in the feedback<\/li>\n<li><code>bang_fs_options<\/code> - The plugin settings<\/li>\n<\/ul>\n\n<p>Be aware that the internal workings of the plugin are subject to change, so the names and details of these hooks may change in future version.<\/p><\/dd>\n\n<\/dl>\n\n<!--section=changelog-->\n<h4>2.0<\/h4>\n\n<ul>\n<li>Settings page makes this plugin suitable for non-developers<\/li>\n<li>Simplified widgets by moving common options to the settings page<\/li>\n<li>Auto switch between a list and a dropdown based on number of options<\/li>\n<li>Updates to work with WordPress 3.8+<\/li>\n<li>Better integration with Relevanssi and other plugins<\/li>\n<li>WPMU: Network Search allows you to search between the sites on your network<\/li>\n<\/ul>\n\n<h4>1.0<\/h4>\n\n<ul>\n<li>First version<\/li>\n<\/ul>","raw_excerpt":"Create a faceted search interface for any post type.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/23723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=23723"}],"author":[{"embeddable":true,"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/marcusdowning"}],"wp:attachment":[{"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=23723"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=23723"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=23723"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=23723"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=23723"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/ml.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=23723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}