Yes, you’ll need to get into working with a custom template.Check this article for the basic technique, then use the “pdb-list-detailed.php” template as your starting point. It includes comments to help you customize the search and sort controls.
How to Create Custom Templates
Dear xnau,
So I have created a new template based on “pdb-list-detailed.php”.
I also found the right line of code (at least I think I did) to edit my sorting list:
<?php /*
* this function sets the fields in the sorting dropdown. It has two options:
* 1. columns: an array of field names to show in the sorting dropdown. If
* 'false' shows default list of sortable fields as defined
* 2. sorting: you can choose to sort the list by 'column' (the order they
* appear in the table), 'alpha' (alphabetical order), or 'order' which
* uses the defined group/field order
*/
$this->set_sortables(false, 'alpha');
?>
So if I am not mistaken I will have to set the false to columns right? How is the syntax though for specifying the columns that I want to show?
Sorry for the newbieness..
Thankss in advance!
*Update:
So I found the ‘Adding an Edit Record Link to the Frontend List’ and thought perhaps it would also be possible with this.
So I followed the tutorial and created the link, though this tutorial (and code) doesn’t seem to work on multiselect boxes and their values.. And though, if it worked it still needed some kind of if statement to look which of the multiselect options was chosen (if option 1 was chosen –> then insert a link to website/page A and if option 2 was chosen –> then insert a link to website/page B.
*ignore above post as it wasn’t supposed to go in here!
Hi NicolasMous, did you manage to sort out your problem?
I have a birthday list and Tel Directory which is on 2 different pages and each page needs its own sort function.
I created a custom template for this and did the changes which I though would work but it doesn’t. How do I assign the new template only to the Birthdays page? Also how do I get the Sort function to work the way I want it to work?
Any help would be greatly appreciated.
Thanks
xnau, please help.
Here is my code, but for some reason it still shows all the fields instead of only first_name & calendar_month
<?php if ( $filter_mode == 'sort' || $filter_mode == 'both' ) : ?>
<fieldset class="widefat">
<legend><?php _e('Sort by', 'participants-database' )?>:</legend>
<?php
/*
* this function sets the fields in the sorting dropdown. It has two options:
* 1. columns: an array of field names to show in the sorting dropdown. If
* 'false' shows default list of sortable fields as defined
* 2. sorting: you can choose to sort the list by 'column' (the order they
* appear in the table), 'alpha' (alphabetical order), or 'order' which
* uses the defined group/field order
*/
$this->set_sortables(true, 'first_name, calendar_month');
?>
<?php $this->sort_form() ?>