Posts: 109
Threads: 7
Joined: Nov 2012
Hi there,
how can i search for a custom field (checkbox)?
Code:
<?php get_i18n_search_results(array('myCheckbox'=>'on','order'=>'date','max'=>6, ...)); ?>
doesn't show any result :-(
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2013-02-07, 02:47:45)Alexander_ Wrote: how can i search for a custom field (checkbox)?
I18N Search is a full text search engine: you can index custom fields, if you check "index" in the I18N Custom Fields Settings, but the content of the fields is just added to the full text index.
You cannot search for a specific value in a custom field.
Posts: 109
Threads: 7
Joined: Nov 2012
(2013-02-07, 03:03:21)mvlcek Wrote: You cannot search for a specific value in a custom field.
Thx.
I'm doing it now this way: define a custom field "listthis" as dropdown with the possible values "yes" and "no". In edit.php change the line
Code:
echo '<option'.$attrs.'>'.$option.'</option>';
into
Code:
echo '<option'.$attrs.' value="secret_'.$option.'">'.$option.'</option>';>'.$option.'</option>';
and in the template search for
Code:
<?php get_i18n_search_results(array('words'=>'secret_yes','order'=>'date', ... ?>
Now all and only the pages are listed which have the custom field "listthis" containing the value "yes". It seems to work and I can't see any drawbacks. Do you?