To preset the default search field, you need to use a custom template for your [pdb_list] shortcode. In that template, put something like this before the line that has $this->show_search_sort_form();
$this->filter['search_field'] = 'last_name';
That will set the search field selector to that field.
I don’t have a custom template, so this didn’t work for me.
Can’t this be done with the standard template? I have the following shortcode:
[pdb_list fields=”first_name, last_name, phone, locatie” search=”true”]
I use the pdb/classes/PDb_List.class.php look for the line you suggested but can only find:
/**
* prints the whole search/sort form as a shortcut function
*
*/
public function show_search_sort_form() {
$output = array();
Read the section titled “Form Templates” on this page: http://wordpress.org/extend/plugins/participants-database/other_notes/
It explains how to use a custom template on your site.
Don’t need to setup a custom template, I found the line in: templates/pdb-list-default.php
Added the line and now it works, thanx for point out the direction.
It now looks like:
/*
* SEARCH/SORT FORM
*
* the search/sort form is only presented when enabled in the shortcode.
*
*/
$this->filter['search_field'] = 'last_name';
$this->show_search_sort_form()
If you don’t use a custom template, you may lose any edits to the default template on updates to the plugin!