Ultimate WP Query Search Filter
NOTE :
Due to personal issue, this Ultimate WP Query Search Filter Plugin is no longer under development. Thanks for the support over the years.
Anyone that come across this page that want to find a realible saerch plugin, here are the list of potential replacements.
Since I released the Advance WP Query Search Filter and Ajax WP Query Search Filter, I have to answer a lot questions regarding these two plugins. This is very exhausted for me to maintain the support for those two plugins because although the plugin seem similar, but in fact the are not. Hence, I developed this new plugin to replace the previous search filter plugin so that I can focus the support into one plugin instead of two.
This new Ultimate WP Query Search Filter plugin, actually is combining the previous Advance and Ajax plugin into one plugin. That’s mean, user now able to choose to use the default theme search template or Ajax call to display the search result.
Of course, there are new features included in this plugin as well. Most of the new features are previously requested by the user such as added Post Tag in taxonomy filter, hide/display search button, adding compare operator in Taxonomy..etc.
Plugin Features:
- Admin are free to choose whether the search go through post type, taxonomy, meta field or even all of them.
- Multiple Search Form Supported.
- Free to choose either theme search template or Ajax call to display the result for each of the search form.
- Search form support checkbox,radio and dropdown fields.
- Plugin extendable with hooks.
- Using shortcode to display the search form.
Installation:
- Upload `ultimate-wp-query-search-filter` folder to the `/wp-content/plugins/` directory
- Activate the plugin through the ‘Plugins’ menu in WordPress
- Create your search form in the Ultimate WPQSF menu.
- Using `[ULWPQSF id={form id}]` to display the form.
From Setting Configuration:
Search Template – for display the search result
- Default Search Template – Use the theme search template, same as the default search result template
- Ajax – Result displayed on same page. When use this, have to enter the Div to display result. The div value should be one of the div in the page, recommended not to use the div that contain the search form.
Post Type
- Choose the post type that you want to filter when search.
Taxonomy
- add taxonomy as the search filter.
- On ‘Operator‘. the ‘AND‘ should be use to checkbox display type when you want the search to filter through term1 AND term2. By default it is using ‘IN‘operator where the search filter through term1 OR term2
Meta Fields
- add meta field as the search filter.
- If you choose ‘BETWEEN‘ in ‘Compare‘ field, then in your options eg: for range option 1-100::$1 – $100 | 101-200 :: $101 – $200 | 201-300 :: $201 – $300…etc
Result Setting and Others
- Enabling string search – to enable string/text search. Note that, the string search only will go through post title and post content only. If the search term is not in post title or post content (like in taxonomy or meta field), there will be no result searched.
- Label for string search – the label of the string/text search
- Combine string search with filters above – when check this, the string search will filter through the taxonomy and meta field that you defined in the same form.
- Orderby – choose the search result order. By default, it uses post date to order the result. If you select Meta Value or Numeric Meta Value, the next field Sorting Meta Key must be present.
- Sorting Meta Key – only will be used when Orderby field was Meta Value or Numeric Meta Value. Note that this meta key must be also be present in the query.
- Sorting Order – order algorithm Ascending or Descending.
- Results per Page – number of posts to return on search.
- Search Button Text – The text displayed in the search button.
FAQ:
How can I styling the search form?
You can simply refer the themes/default.css that come with the folder and alter it or override it at your theme css file.
What if I want to display the search form in the template?
Put this into `<?php echo do_shortcode(“[ULWPQSF id={form id}”); ?>` your template.
What if I want to display the search form in the sidebar widget?
Just insert the shortcodes like you inserted in the post content. eg. ‘[ULWPQSF id=3299]`
What is the ‘button’ parameter is used for ? And how to use it?
The ‘button’ parameter is use to display/hide the button. NOTE that, this parameter only applied to AJAX SEARCH only and once you hide the button, it will automatically update the result when there is changes is made in the search form. To hide the button simply add ‘button=0’ to the shortcode. eg. ‘[ULWPQSF id=3299 button=0]‘
What is the ‘divclass’ parameter is used for ? And how to use it?
The ‘divclass’ is for adding your own class to the frontend search form. This class will be applied to each filter (taxonomy or meta field) and then you can use it for customize the design etc. To use the parameter, just simply add ‘divclass’ to the shortcode. eg. ‘[ULWPQSF id=3299 divclass=my_own_class]‘
What if I don’t want to display the title of the search form?
Just give `0` to `formtitle` parameter in the shortcode eg. ‘[ULWPQSF id=3299 formtitle=”0″]`
HOOKS:
1. uwpqsf_result_tempt – for ajax result cutomization
add_filter('uwpqsf_result_tempt', 'customize_output', '', 4); function customize_output($results , $arg, $id, $getdata ){ // The Query $apiclass = new uwpqsfprocess(); $query = new WP_Query( $arg ); ob_start(); $result = ''; // The Loop if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post();global $post; echo '<li>'.get_permalink().'</li>'; } echo $apiclass->ajax_pagination($arg['paged'],$query->max_num_pages, 4, $id, $getdata); } else { echo 'no post found'; } /* Restore original Post Data */ wp_reset_postdata(); $results = ob_get_clean(); return $results; }
Screenshot:
Comment are closed, Please goto support forum for your question.
Glenn
Hi
This has promise, but I’m afraid there are a numb rod issues with the plugin.
On plugin activation:-
The plugin generated 2 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
It then throws:-
Warning: Cannot modify header information – headers already sent by (output started at /home/developm/public_html/wp-content/plugins/ultimate-wp-query-search-filter/classes/uwpqsf-base-class.php:93) in ****/wp-includes/pluggable.php on line 896
If I try your hook as shown I also get:-
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE or ‘$’ in ****/functions.php on line 99
And that l;one is:-
global post;
I also tried the Ajax plugin plus hook and that threw up other errors also. I think brought on by
in your code.
Right now I’m afraid the plugin can’t be used and breaks themes.
Regards
Glennyboy
tck30
Hi, thanks for noticing it out. The “header already sent” message should be fixed. Try to update to latest version 1.0.2.
By the way, you can remove the “global post” in the function.
Glenn
Error on plugin activation gone, but on search display I get-
Notice: Undefined index: taxo in ***l/wp-content/plugins/ultimate-wp-query-search-filter/classes/uwpqsf-process-class.php on line 204
Notice: Uninitialized string offset: 0 in ***/wp-content/plugins/ultimate-wp-query-search-filter/classes/uwpqsf-process-class.php on line 100
On form save I get:-
Notice: Undefined index: post_type in /home/developm/public_html/wp-content/plugins/header-footer/admin.php on line 67
Warning: Cannot modify header information – headers already sent by (output started at ***l/wp-content/plugins/header-footer/admin.php:67) in /home/developm/public_html/wp-includes/pluggable.php on line 896
Never had a plugin conflict with that one before and I run numerous plugins with zero conflict.
Cheers
Glennyboy
Glenn
Also in your function above I still get:-
Parse error: syntax error, unexpected ‘,’ in ….. /functions.php on line 101
That is:-
echo $apiclass->ajax_pagination($arg[‘paged’]max_num_pages, 4, $id);
tck30
The undefined index or string is not errors, it just happened when you don’t include taxonomy as the filter. It’s not a problem actually. However, it will be fix in the next update.
For the save form error. It is conflict with the Header Footer plugin that you installed. Actually it is the plugin problem that not wrote the code properly. Even though this error doesn’t show before, but it doesn’t mean it wont appear in the future. My plugin just happened trigger the message. If not mine maybe other plugin will.
As for the search result output. There was a type I made it should be
echo $apiclass->ajax_pagination($arg['paged'], max_num_pages, 4, $id);
See updated code from above.
lukehm
Does the Infinite Scrolling Plugin work with this?
Many Thanks
tck30
@lukehm,
No it will not work on this. However, I will create the replacement plugin for existing add-on plugins user. It will be FOC. Just give me some times.
lukehm
Great. take your time.
Another question I’d like to add a hidden filter that always excludes all posts that don’t have a thumbnail
‘meta_key’ => ‘_thumbnail_id’
Can you help
Many Thanks
tck30
You can try to use following snippet in your functions.php
snippet
The code above will retrieve the post with the meta key ‘_thumbnail_id’ exist.
lukehm
Sorry snippet missing
Many Thanks
tck30
Click on the red color ‘snippet’.
Jour
Hi there,
I noticed an error when I use the taxonomy of category and post tag (Dropdown). The search result page does not show the label of the category or post tag, instead it prints
Search Results For “”
Blank.
Please kindly assist.
Thanks!
tck30
Do you mean the search query term??If so you can use `get_search_query` to customize the Search Result For data. You can get the search term from the submitted URL.
Honza
Thanks for your work. I have one comment. How to set up search form (ajax) remember selected option? T
tck30
Do you mean remember ajax added data when hitting back button?
Filtered search within #WordPress custom post types and categories? | Schuurmudgeon
[…] tried ‘Ultimate WP Query Search Filter‘ but I find it somewhat challenging to set up. So I’m looking for something more easy […]