Shortcodes and Their Attributes

Shortcodes

Participants Database uses 9 shortcodes to produce different displays. Each can be modified with attributes and customized using a template much as WordPress pages are templated.

[pdb_list]

The List Shortcode

Shows a filterable list of records, can also include search, sort, and pagination.

[pdb_single]

The Single Shortcode

Is used to display the values for a single record. It is often used as a detail view that you can click to from the list view.

[pdb_record]

The Record Edit Shortcode

is used to show an editable record. Usually, a coded URL is used to show the form.

[pdb_signup]

The Signup Form Shortcode

is used to show a signup or registration form that creates a new record. This shortcode also shows the thanks message or the private link recovery form.

[pdb_signup_thanks]

The Signup Thanks Shortcode

This is used when you want the user to go to another page after signing up. In that case, it is necessary to use this shortcode to complete the form submission process.

This shortcode will use any enclosed content as the “thanks” message. (version 1.7.5)

[pdb_update_thanks]

The Update Thanks Shortcode

Used if you want the user to go to another page after submitting an update to their record. ([pdb_record] shortcode)

This shortcode will use any enclosed content as the “thanks” message. (version 1.7.5)

[pdb_search]

The Search Shortcode

This is used to show a Participants Database record search input when you want it to be somewhere other than at the top of the list display.

Find information on the use of the Search Shortcode here…

[pdb_request_link]

Use this shortcode only if you want to show the private link recovery form in a different location than the signup form.

[pdb_total]

The Total Shortcode

is used to show a record count, sum, or other calculation from Participants Database. It is meant to be used inline to show a string or number.

Shortcode Attributes

Shortcode attributes provides ways to customize the action of a shortcode.

The table presents a cross-reference to what attribute can be used in what shortcode. Titles link to more info on that item.

 Shortcodes
 Attributespdb_
list
pdb_
single
pdb_
record
pdb_
signup
pdb_
signup_thanks
pdb_
search
pdb_
request_link
pdb_
total
template
class
fields  ✔*
groups    ✔*
record_id      
action      
search       
sort       
orderby       
order       
filter      
single_record_link       
display_count       
suppress       
list_limit       
target_instance       
target_page       
submit_button     
readonly_inputs       
search_fields     ✔  
default_search_field      
edit_record_page       
term       
pagination ✔      
header_sort

template – name of the template to use to display this shortcode. All shortcodes use templates that can be customized and stored with your WP theme. Read about custom templates here…

class – adds a class name to the HTML wrapper element.

fields – comma-separated list of field names to include, in the order given.*For the “total” shortcode, this attribute defines the names of the fields that will be totaled to calculate the output of the shortcode. The totaling function will attempt to interpret the values as numbers. If you are using fields that need to be totaled, it’s best to store them without denominations or units.

For example: fields="first_name,last_name,city,state"

groups – like fields, only the fields are selected for display by the group they are in. Makes managing large numbers of fields easy.

record_id – id of the record to show. Most often, this is used when you need to use a PHP variable to select the record.

action – sets the next page after a form submission, overriding the “thanks page” setting for the signup form. This attribute is used to create multiple-page forms: after submitting, the user is taken to the page named in the “action” attribute.

filter – for the list shortcode, defines a set of filters to use on the list before display. The filters are a series of statements such as: state=NY&rating>4 Read this article for a full explanation of the use of this attirbute: List Shortcode Filters

search – if set to “true” shows the list search control.

sort – if set to “true” shows the list sort control.

orderby – for lists, determines which fields will used to order the list. Several fields can be used: separate multiple field names with commas. The list will be ordered starting with the first field, then each following field.

order – works with orderby to determine the order of the list. Only “asc” or “desc” can be specified, separate multiples with commas. There should be the same number of items in this attribute as are in the orderby attribute.

For example: orderby="last_name,first_name" order="asc,asc"

single_record_link – for the list shortcode, this sets the target page for single record links in the list. You can use a post ID or the page slug. The Single Record Link Field must be configured in the list settings.

display_count – when true, adds a display count caption to a list table. Using a template several values can be shown, including the number of records total and the number records shown per page.

suppress – when set to true, the list display is only shown as a search result. When no search has been performed, such as when the page is first loaded, the list is not displayed.

list_limit – sets the number of items to show per page. Set to “-1” to show all records.

target_instance – when using the search shortcode, it is sometimes necessary to target the search results to a specific instance of the list on the page. For instance, if there are two list shortcodes on a page, each will have an instance number, which can be seen in the HTML as a class name such as “pdb-instance-1” for instance 1. The search shortcode can then target a specific list instance to show it’s results with a number in this attribute.

target_page – formerly known as “action” this is used with the search shortcode to define which page the search results will be shown on. “Action” still works, so if that’s what you’re using, you can leave it.

submit_button – sets the text for the submit button.

readonly_inputs – set this to true if you want fields marked as “readonly” to be shown in the record edit form as disabled form elements instead of plain text.

search_fields – comma-separated list of fields to use in the search field selector dropdown. If there is only one field, the dropdown is not shown, and all searches will be performed on that one field.

default_search_field – When showing a search field selector, the field named in this attribute will be the default selection.

edit_record_page allows you to set the record edit page for a signup shortcode. This is the page (with the [pdb_record] shortcode) their private link will go to.

term – makes it possible to use another value (found in the record_id attribute of the shortcode) in the record to select the record. This value must be a unique identifier: whatever value is passed in from the record_id attribute must identify only one record.

pagination – gives you a way to hide the pagination control by using pagination="false" in the list shortcode. This is useful if you want the list to display a “top 10” result or something like that and don’t need the user to be able to access the rest of the results.

header_sort – when enabled in the shortcode, any fields that are marked “sortable” will have a link placed on the table header that when clicked, will sort the list by that column.