WP Custom Fields Search 0.3.4
This version doesn’t add much new functionality but does fix a bug whereby files could not be edited in the theme/plugin editors while the plugin was installed. Thanks go to Florent for pointing that one out.
I strongly advise all users to upgrade as soon as possible.
This also includes the functionality to place searchforms in page and post content. See the presets section (Settings > WP Custom Fields Search) for an example tag. Thanks go to Ibrahim for the suggestion.
For instructions on using the plugin please see the 0.3 release notes
Category: Wordpress Plugins | Tags: custom fields, custom search, wordpress, wordpress plugin 66 comments »
March 30th, 2009 at 12:00 pm
Works great, thank you
April 8th, 2009 at 4:30 pm
[...] 「WP Custom Fields Search」 は、すべてのカスタムフィールド、カテゴリー、タグを対象とした検索機能を追加できるプラグインです。 [...]
April 22nd, 2009 at 4:24 am
This is a much needed plugin. There has to be more functionality on both the category, tags, and custom fields side and it seems like you are doing a great job. I will keep in touch on how it works on my site.
May 6th, 2009 at 11:03 am
Hey, is it possible to add the fuction to search multiple custom fields with one search, not only one?
btw: Great job!
May 6th, 2009 at 11:05 am
Hi Steve,
Not at present, a few people have asked for this functionality though so I will be trying to get it into version 0.4. I’m a little busy with other projects at the minute though so can’t really promise when that would be.
Thanks,
Don
May 7th, 2009 at 11:31 am
That would be awesome!!
Im looking forward to v0.4
May 18th, 2009 at 9:23 pm
Graeat Plugin, it solves exactly what I need, but one: Is it possible to search between multiple sub-categories? I’d need to have multiple dropdown fields each with “parent” categories as titles and children categories inside.
Thanks in advance.
E.
May 22nd, 2009 at 9:17 am
Hi, am sorry for my English is not very good.
I get the following error when attempting a search result that does not have:
“There is no entry. Want to try another search?”
if(function_exists(’get_search_form’)) get_search_form();
I would be very grateful if I can help solve the problem.
Thank you very much and congratulations for the plugin.
Greetings from Spain
Jose Antonio
May 22nd, 2009 at 11:07 am
Anyone tested the plugin with MySQL 4? Seems not working.. with MySQL 5 works great. Please let me know
May 26th, 2009 at 8:57 am
Thanks for your reply. The version is 5.1
Greetings
May 26th, 2009 at 9:11 am
Hi Jose,
Sorry for taking so long to reply. As far as I can tell that code doesn’t seem to be coming from this plugin. I would guess you would need to check your theme for problems. The problem will probably be in a file called search.php in the theme directory.
Thanks, Don
May 26th, 2009 at 9:12 am
Berardo,
No I haven’t tested it for MySQL 4 compatibility yet, I will try to test this before the next release.
Don
May 26th, 2009 at 8:45 pm
Is there some way to make the category lister not check for posts there, I would like the dropdown to list every single category not just the ones it thinks have posts in it. I tried using the comma method to list that but that never returns anything from the category.
May 26th, 2009 at 9:14 pm
Hi Stephen, the search uses the same method of matching posts to categories as is used to populate the drop down list. So if the drop down list is not showing any categories then nor will the search even if you force it to show the categories.
I can’t really tell what the problem is without looking at your database, but I have this alternative version which worked for another project, could you give it a try and let me know if it helps? If it does I might merge it into the stable version.
Thanks, Don
http://www.don-benjamin.co.uk/files/wp-custom-fields-search-categories.zip
May 27th, 2009 at 10:12 pm
Cool plugin!
I have added 2 comparisions: “At least” and “Up to” adding these lines:
“UpToComparison” =>__( “Up To”,’wp-custom-fields-search’),
“AtLeastComparison” =>__( “At Least”,’wp-custom-fields-search’),
AND
class UpToComparison extends Comparison{
function addSQLWhere($field,$value){
return “$field = ‘$value’”;
}
function describeSearch($value){
return sprintf(__(’ at least “%1$s”‘,’wp-custom-fields-search’),$value);
}
}
The rusult is find in dashboard but the fields don’t show up in website.
ALSO…
Are u planning to have a cutomizable CSS? The way both dashboard and search form appear is pretty bad. I am using 2.7.1 MU and it really doesn’t look like in your screenshots.
thanks!
Gabriele
May 28th, 2009 at 9:27 pm
Hi Don,
So this plugin searching only posts in the search results, not pages. Am I correct? If so, is there a way to get it to show pages too?
May 29th, 2009 at 12:00 pm
Hello.
I’d like to use this great plugin on my new website.
Everything works fine, but is there a way to exclude several categories or childcategories from custom search?
Or force some to be not shown in the dropdown fields?
Thank you very much – and thanks for the plugin!
jan
June 2nd, 2009 at 6:23 pm
First of all this is an amazing plugin! Thanky ou, but I have a problem:
When I use the widget and I put in my sidebar, this is not inside a border like all my other widgets, it is without border and I don’t know how to do it, after looking and looking, to make this plugin inside a border, to look like the rest of the blog. Any help will be welcome.
Thank you!
June 6th, 2009 at 11:59 pm
Hi Don,
can you parse out commas in search keywords?
For example searching your site here, entering the search term “fields, search, public” doesn’t yield any result, whereas “fields search public” works perfectly fine. It would be great if your plugin parsed out all invalid search chars?!
Thanks
WOLF
June 8th, 2009 at 9:20 am
Gabrielle, glad to hear you’re pushing the boundaries with it. I’m not sure i can help without seeing the modified source code though. Do you need to add the fields to the search form through the admin interface?
Laura, I do have the code for doing this I just need to build an admin interface for it. I will try to come up with a work-around soon if possible, but otherwise am planning on putting this functionality into version 0.4 of the plugin when (eventually) I find time to put this together. Sorry to keep you waiting.
FlyFro, have a look at the instructions at the link below for setting the options in drop down lists. The interface isn’t the nicest at the moment but it should be possible to set-up the list as you want it.
http://www.don-benjamin.co.uk/wordpress/projects/foss/wp-plugins/wp-custom-fields-search-03/#toc-setting-up-the-fields
Isaac, it’s difficult to say what the problem is without a url to look at. If you have any suggestions for how I could change the html/css to fit in better with your theme these would be appreciated.
Wolf, that does sound like a good idea, I’ll try and push that it into a minor release later in the week.
Thanks,
Don
June 10th, 2009 at 9:22 am
Hey Don,
Thanks for the excellent plugin.
Is there a way in parsing commas and money symbols?
Take a look at my estate agent example:
http://www.lifeofstrange.com/property/
All the search fields work except the Price, putting just the number in the custom field without the pound and comma symbol seems to work.
Any ideas?
Thanks in advanced.
Matthew
June 11th, 2009 at 10:18 am
Hi,
First of all, thank you for your work.
I have one question : how can I use the .pot file with my translation ?
Is there an attribute to set somewhere ?
Let me know.
Thanx
Pierre
June 11th, 2009 at 6:51 pm
does not work with the new version of wordpress 2.8
the place where “Data field” is, does not showing after selecting the “Data Type”.
June 11th, 2009 at 9:10 pm
you are the best
June 12th, 2009 at 4:22 pm
Hi again,
Still haven’t found how can I use the .pot file, but I have another question :
How can I use some rewriteRule to link to results page ?
eg.
instead of
?search-class=DB_CustomSearch_Widget-db_customsearch_widget&widget_number=preset-default&cs-City-0=Los+Angeles&search=Search
something like that
search/City/Los+Angeles
I have write the rules, and the cs-City-0 value is well recognized (selected attribute is on the right value -the form is always in the sidebar) ), but I have a 404 page
Any idea ?
Thanx
June 12th, 2009 at 4:42 pm
Piere: Not sure about the rewrite rules, are you trying to create a link to the search results? Or trying to rewrite the url that the form takes you to?
With the pot file, I’m not entirely sure how they work, but thought that translation was probably a good idea so I created an english one. If you send it to me don@don-benjamin.co.uk I will have a fiddle and see if I can make it work.
Thanks,
Don
June 12th, 2009 at 4:54 pm
Hi,
Thanx for your answer Don.
I’ll send you the pot file with french translation this evening.
For the rewriteRule, that’s exactly what I’m trying to do : “create a link to the search results”
Any idea ?
June 15th, 2009 at 8:09 pm
Hi!
Thanks for your job.
Gab left here his code modification with “At least” and “Up to” variants. How it can be done? Or how to change “less then” on “up to” and more then on “at least”? For example more then 3 including 3 or less then 10 including 10.
Sorry for my bad english.
June 19th, 2009 at 5:49 am
This thing rocks. ROCKS.
I do need PAGE search functionality though. Any idea when we can get that?
THX.
BTW, if it is a matter of payment, I would be interested in paying you for your time.
June 21st, 2009 at 8:22 pm
Thanks for this great plugin.
I’m working on a food and wine site, with taxonomies for foods, wine, beer, spirits. I don’t see how to set up categories or even custom fields that would allow me to select a subset for a particular search.
For instance, in the wine section, she would like a search with fields for: country, region, appellation, vintage, vintner, price. That would be fine, except that other sections will have different set of fields. If I set all the search terms as categories, the list is too long, with many extraneous terms per type of beverage or food. I’m not sure if using custom fields would work.
The goal would be to have different search boxes on different pages, one for wines, one for foods, one for beer, one for spirits.
Is this possible? What do you suggest?
July 2nd, 2009 at 8:29 pm
Great plugin! Would be helpful to have an option for multiple check boxes rather than just radio buttons.
July 5th, 2009 at 3:59 pm
Does this plug-in work with Wordpress 2.8? I am unable to get it to return any post results.
Any help you can provide would be greatly appreciated. Thank you!
July 6th, 2009 at 9:39 am
Thanks for this great plugin.
And How To Hide [DB Wordpress Plugins] WordS,
Is it Be Hide?
July 10th, 2009 at 10:32 am
Pete,
I think the plugin should work with wordpress 2.8, I’ve certainly got it working on a few sites although obviously it’s not as thoroughly tested on this setup as it is on the more mature releases. Could you try this version http://www.don-benjamin.co.uk/files/wp-custom-search-categories.zip and let me know if that helps?
Thanks,
Don
July 14th, 2009 at 6:06 pm
Don,
Thanks for the reply. I downloaded, installed, and tested the plug-in from the link you provided and unfortunately, it did not work. I did however come across something interesting…
If I only place one value in the drop down box, the search returns the proper posts. If I place more than one value (each separated by a comma), the search returns no results.
I found that interesting and hope it may be something that can be resolved in the near future. Thanks for your help and I look forward to your next reply!
July 14th, 2009 at 6:09 pm
Don,
Scratch that last reply. If there’s more than one value in the drop-down menu, it only returns posts for the first value. Any value after the first comma returns no search results.
Thanks,
Pete
August 11th, 2009 at 8:54 am
Hello Don,
Congratulations on your plugin, i put this on a travel site http://www.abctours.ro and when i try to search custom fields for prices i get no result , can you tell me if i’m doing something wrong ?
all i get is “Keyword not found, please try a new search.” if i select any from the combobox, i receive all the results as expected
Thank you for your time
August 11th, 2009 at 9:42 am
Boboc: The release I put out yesterday had a bug in it which has broken custom fields search. Hopefully if you get today’s version you should be okay.
September 19th, 2009 at 12:57 am
great work!
we are waiting for ver4.
thanks
June 11th, 2010 at 4:28 pm
How to apply the search code in my wordpress template not in post or page or widget, i want to put in anyway in my template.
July 24th, 2010 at 1:49 pm
Hi,
Thanks for the plugin. Works nicely.
Just one question. I have 5 main categories and some of those categories have subcategories. How make a drop down for those 5 main categories but still have search results returned for the subcategories of that main category. For instance, Property for Sale is main category. Villa/House is sub category of Property for Sale. Now the drop down will show Property for sale and the search should return ALL results for property for sale, even if the post is in a subcategory Villa/House.
Help is appreciated.
September 17th, 2010 at 10:48 pm
Hi Don,
thanks for your plugin, I really appreciated it.
I’m translating the website http://www.la-colombaia.it with qtranslate plugin and I’m trying to understand why the drop-down search field of your plugin always shows categories in one language only.
Could you help me, please?
Thanks a lot,
Mery
October 6th, 2010 at 2:55 am
Hello,
If I click show/hide config the fields are not open to customize. I have installed into multinetwork wordpress(Version: 3.0.1) site. How to open?.
Simon
October 28th, 2010 at 8:26 am
is there a good free french translation tool on the internet ?”**
December 3rd, 2010 at 4:11 pm
most travel sites have very nice webpages and their services are very nice too. ‘,;
December 10th, 2010 at 3:27 pm
Is there a way to create an option in the drop down that doesn’t select any category? I’m using this as a directory and want people to be able to search by department if they know it, but be able to leave that blank if they don’t know it.
January 6th, 2011 at 11:15 pm
Hi Don,
Great plugin thanks.
Having a few issues related to the plugin returning results using the home page / blog template (styling results page for example, and history tracking showing “home” page title)
Would there be an easy way for the plugin to use the search.php template to display the results?
Cheers
Ben
January 21st, 2011 at 6:09 am
hi,
Great plugin.
Just a quick question when the results are displayed they use the ‘medium/ setting and not the ‘thumbnail’ for image size. Any idea where i can change this?
Many thanks
February 6th, 2011 at 2:56 am
hi there
I Need to EXCLUDE some Categories from the search result… i have added the following code to the functions.php file but it doesnt seem to exclude the categories for the WP-custom-search:
function SearchFilter($query) {
if ($query->is_search) {
$query->set(’cat’,'1,17,6′);
}
return $query;
}
add_filter(’pre_get_posts’,'SearchFilter’);
There must be an easy way to do this.
Love the plugin by the way… if anyone can help me figure this out it will be perfect!
Many
February 6th, 2011 at 2:57 am
hi there
I Need to EXCLUDE some Categories from the search result… i have added the following code to the functions.php file but it doesnt seem to exclude the categories for the WP-custom-search:
function SearchFilter($query) {
if ($query->is_search) {
$query->set(’cat’,'1,17,6′);
}
return $query;
}
add_filter(’pre_get_posts’,'SearchFilter’);
There must be an easy way to do this.
Love the plugin by the way… if anyone can help me figure this out it will be perfect!
Mandy
February 10th, 2011 at 10:27 pm
HI Great plugin, good work! Is it possible to combine all the options like categories and custom fields in to one drop down menu?
April 8th, 2011 at 7:58 pm
Hello
I am testing your plugin which does a great job.
Problem : when showing results, it shows FULL articles.
I do need to show only titles or excerpts (more than necessary when results are above 20 or 30 articles)…
Is there a way to do that ?
I am amble to modify PHP a bit but I am not a programmer.
Thansk
April 14th, 2011 at 4:01 am
hello don, could you please guide me how to change the result URL from the default to “clean URLs” for SEO purposes….
April 18th, 2011 at 3:49 pm
Hey great plugin.
Where in the script do I need to be to give the select boxes a class?
Thanks
May 11th, 2011 at 11:10 am
no one have a solution for excluding cats in the dropdown ?
I’ve been looking for an answer for this all over goolge and this forum and it seems that it was asked a lot with no answer:
How to exclude cats from the dropdown?
if anyone have any idea, please share…
thank you
June 8th, 2011 at 1:24 am
Hi Benjamin. First of all, thank you for such a great plugin. I’m trying to use it in my website but I have two problems:
1) I am trying to exclude a category from the front page, but I want those categories to appear in the search results. I installed some plugins to exclude categories from the front page and they work fine. The problem is that when I want to search for those excluded posts with your plugin, they don’t appear in the results. Do you know which is the problem?
2) Is it possible to customize the plugin? I would like to change the colors of the plugin, but I cannot find where to do that.
Thank you
San
July 20th, 2011 at 11:39 am
Hello Don and thanks!
Question:
Is a class automatically generated per form label+input cell?
For example, I would like to add a different image next to form legends by using with appropriate css…
July 20th, 2011 at 11:44 am
@roycegracie
I think you have to use the Drop Down options box and type in all categories you want to be searched separated by a comma.
If you want the option “any” as well you have to write it that way:
:ANY,category1,category2,category3
July 20th, 2011 at 11:55 am
@frmars
You need to modify your php file associated with search results.
By default it is often named search.php and you can create a loop-search.php file which will be used instead for treating the search and result loop. I has nothing to do with the plugin.
ID, ‘Image’, true) ) : ?>
<div id="post-” >
<a href="” title=”" rel=”bookmark”>
August 27th, 2011 at 4:29 pm
Also I have the problem between WP custom field search and QTRANSLATE plugin: the drop down menù displays categories only in the first language and the results are given in the same first language. I’m not be able to have the drop down items displayed according to the language selected and same for the results.
May sameone halp me?
Thank you very much!
August 27th, 2011 at 4:53 pm
For those who know a little php I can bring a piece of code contained in the file “extra_search_fields.php” inside of WP Custom Search plugin that I modified in the first part (successfully) to get a display of multilingual writing that appears before the choices. So there:
function getOptions($joiner,$name){
if($this->param(’fromDb’,!$this->options)){
$options = array(”=>__(’TutteAllAll‘,’wp-custom-fields-search’));
$auto = $joiner->getAllOptions($name);
asort($auto);
$options +=$auto;
return $options;
} else {
return $this->options;
}
}
function getInput($name,$joiner,$fieldName=null){
if(!$fieldName) $fieldName=$name;
$v = $this->getValue($name);
$id = $this->getHTMLName($name);
$options = ”;
foreach($this->getOptions($joiner,$fieldName) as $option=>$label){
$checked = ($option==$v)?” selected=’true’”:”";
$option = htmlspecialchars($option,ENT_QUOTES);
$label = htmlspecialchars($label,ENT_QUOTES);
$options.=”$label”;
}
$atts = ”;
if($this->params['onChange']) $atts = ‘ onChange=”‘.htmlspecialchars($this->params['onChange']).’”‘;
if($this->params['id']) $atts .= ‘ id=”‘.htmlspecialchars($this->params['id']).’”‘;
if($this->params['css_class']) $atts .= ‘ class=”‘.htmlspecialchars($this->params['css_class']).’”‘;
return “$options”;
Thanks for the help!
September 4th, 2011 at 11:53 pm
Great plugin. Is there any way to sort search results by title? I have tried to insert ORDER BY post_title in some MySQL queries in extra_search_fields.php file but it doesn’t work. Thanks.
September 13th, 2011 at 9:58 pm
Is there any way to sort by custom fields?
September 21st, 2011 at 1:12 pm
Hi don, and thanks for the plugin!!!
have u a solution for a questions number 55 ??
” no one have a solution for excluding cats in the dropdown ?
I’ve been looking for an answer for this all over goolge and this forum and it seems that it was asked a lot with no answer:
How to exclude cats from the dropdown?
if anyone have any idea, please share…
thank you”
September 21st, 2011 at 1:45 pm
hi Andy, i just used the option to include the cads i want it to show.
you write the name of the cats spreted by comma….
i wanted to exclud 2 but the solution is good as tell for me…
November 8th, 2011 at 5:03 pm
The plugin works great, my only issue is the pagination. It will not work if I have the custom permalinks, only if the permalinks are default.
With custom permalinks, it create a string as:www.site.com/page/2?…
while with the default it will add &paged=2 at the end of the string. The first one, page/2/ does not work.
Could you please help me? I need to keep the custom permalinks.
thanks