Wednesday, July 30, 2025

How to Use a Link to Filter a List (pdb_list)

The easiest way to explain this is with a use case. But it certainly is not the only possible use.

Use Case
Here's our member directory and the shortcode that creates it:

[pdb_list fields="last_first,village,photo" orderby="last_first" search=true search_fields="last_first,village" default_search_field="last_first"]

Note the village links. What they do is link back to this page with a query string (the thing in a URL that starts with a question mark) that filters the list based on the value in the village field (a required field in our database).

For example, here's the URL for the Cribari link:

https://vmfsc.vgcc.club/member-list/?search_field=village&value=Cribari

which augments the shortcode, telling the PDB engine to search for records in which the village field has the value Cribari.

The reason we include village in the search_fields is that when a village's link is used, the word "village" automatically appears over the search box.


Now our members can look for a neighbor who is a member when they need a ride to a meeting...or for whatever reason.

Note: the search/value pair in the URL query string does not override a filter attribute in the shortcode, if it is used.