Yes, SearchIQ can have multiple tailored search bars. Please use our search widget to display search results for the selected category/categories. Please check the screenshot for reference.
https://prnt.sc/JHMzHiSVWXw1
Is there a shortcode to accomplish this feature? We don’t use widgets.
We support shortcode like below which can be placed anywhere in the page/post content.
[siq_searchbox type="search-bar" placeholder="Search here" post-types="post,product" width="500″ placement="left"]
You can add the below code to your theme’s ‘functions.php’ file to convert the widget into the shortcode.
function siq_search_widget_shortcode($atts) {
ob_start();
// Default widget instance values (you can override via shortcode attrs)
$instance = shortcode_atts([
'title' => '',
'placeholder' => 'Search',
'postTypes' => '',
'postcatidfilter' => '',
'postCatFilterClause' => ''
], $atts);
// Convert comma-separated values to array where needed
if (!empty($instance['postTypes'])) {
$instance['postTypes'] = explode(',', $instance['postTypes']);
}
if (!empty($instance['postcatidfilter'])) {
$instance['postcatidfilter'] = explode(',', $instance['postcatidfilter']);
}
// Render widget
the_widget('SIQ_Search_Widget', $instance);
return ob_get_clean();
}
add_shortcode('siq_search', 'siq_search_widget_shortcode');
And can use it in one or combined ways below:
Basic:
[siq_search]
With custom placeholder:
[siq_search placeholder="Search products…"]
With post types:
[siq_search postTypes="post,page,product"]
With category filter:
[siq_search postcatidfilter="1,2,3"]
Thank you, Rahul.
We added this shortcode to this page.
[siq_searchbox type=”search-bar” placeholder=”Search glossary terms” post-types=”glossary”]
https://www.603la.net/get-legal-aid/glossary/ password: 603la
A search for “abrogate” yields no results, although there is a post in that custom post type for that term.
https://www.603la.net/glossary/abrogate/
Is there a syntax problem with our shortcode?
-Jay
Hi, we have checked the indexed documents on your site and can see only the page https://www.603la.net/get-legal-aid/glossary/ is indexed.
The page links on the Glossary page, like https://www.603la.net/glossary/abrogate/ or https://www.603la.net/glossary/accrual/, are not indexed. Please select the post type ‘glossary’ for indexing, Resynchronize posts from the plugin settings, and test if the page is displayed in the search results.
Moreover, you are using post-types="glossary" in the shortcode. We need to use the below attribute in the shortcode to specify the post type.
postTypes=”glossary”
-
This reply was modified 2 weeks, 2 days ago by
Rahul Arora.