Posted on by

Shortcode Attributes Explained

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

 Shortcode pdb- list single record signup signup_thanks search request_link 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  ✔


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.

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.

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.

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.

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

single_record_link – for the list shortcode, this sets the target page for single record links in the list. Single record links 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.

13 thoughts on “Shortcode Attributes Explained

  1. Hi Roland,

    When I use the groups attribute in the pdb_signup shortcode, it does not seem to override the global signup form field assignments. Can you confirm this?

    Thanks,

    1. It does not override the global signup field assignments, it just prevents signup fields from other groups from appearing in the form. If you want to use groups to show different signup forms, you need to assign all the fields you want in all forms as signup fields, then use the groups attribute to determine which fields are shown in each form.

  2. Is it possible to pre-select a specific search_field in the dropdown list. Now the undefined “select” is hard coded somewhere. If a user simply enters the search term without considering the dropdown, he will not get a result.
    Thank you for your help …

    1. You would need to do this in the template, it’s a bit more trouble than it probably should be, I’m sorry.

      Instructions for setting up a custom template: Using Participants Database Custom Templates

      In the pdb-list-detailed.php template (provided by the plugin in the plugin’s templates folder) you can set up the search field selector to have a default value. Use that template as a starting point for your custom template.

  3. I have a field where I want to show the total from all the entries. Is that done with the [pdb_total] shortcode is used for? I need help with this, for having this sum up everything for me would save me so much time.

    Thank you

    1. The [pdb_total] shortcode is for showing a total like that, but it is not a field, it is a stand-alone shortcode that you can put anywhere on the page. To implement this as a field, you’d need to use custom code.

  4. This page would be much more helpful (to me at least) if you provided some examples with the correct syntax, rather than just a checkmark for which attributes can be applied. I have no idea how to construct everything in a statement. Thanks.

    1. Yes, good idea, and I’m sorry the documentation is not more complete. For many of these attributes, the examples are shown in the context of explaining how to do specific things. It’s good idea to show them in use here, however.

      If you’re looking at the List Filter attribute, take a look at this article, it really goes into detail on that one:

      List Shortcode Filters

      1. Thanks, that is a very helpful page. Perhaps just putting a link to that article on the short codes page would help in the interim for newbies like me. Is there a syntax standard for when to use hyphens vs. underscores? I understand if you are filtering on a field name that contains an underscore, but what about the short codes themselves?

        1. Whether you use a hyphen or an underscore is going to be determined by the term you are using, it’s not optional. Shortcode tags and field names will always use underscores in this plugin because that is the naming standard I use. Let me know if you have a specific issue you need help with and I’ll try to give you a better answer.

  5. Many many thanks!! this plugin is awsome!

  6. Hi Roland! is there any possibility to filter a table directly using the filter parameter with a dinamic value, such as:
    [pdb_list filter "user_reg="+current_user->user_login]
    I stored in a hidden field the user that created the register, and I want to show each user only the register he has created.
    If not is there any other simple way to do this?
    Thanks

    1. Yes, it’s possible, but you need to do it in code…take a look at this article for the details:

      Using Participants Database with WordPress Users

Leave a Reply

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.

13 thoughts on “Shortcode Attributes Explained

  1. Hi Roland,

    When I use the groups attribute in the pdb_signup shortcode, it does not seem to override the global signup form field assignments. Can you confirm this?

    Thanks,

    1. It does not override the global signup field assignments, it just prevents signup fields from other groups from appearing in the form. If you want to use groups to show different signup forms, you need to assign all the fields you want in all forms as signup fields, then use the groups attribute to determine which fields are shown in each form.

  2. Is it possible to pre-select a specific search_field in the dropdown list. Now the undefined “select” is hard coded somewhere. If a user simply enters the search term without considering the dropdown, he will not get a result.
    Thank you for your help …

    1. You would need to do this in the template, it’s a bit more trouble than it probably should be, I’m sorry.

      Instructions for setting up a custom template: Using Participants Database Custom Templates

      In the pdb-list-detailed.php template (provided by the plugin in the plugin’s templates folder) you can set up the search field selector to have a default value. Use that template as a starting point for your custom template.

  3. I have a field where I want to show the total from all the entries. Is that done with the [pdb_total] shortcode is used for? I need help with this, for having this sum up everything for me would save me so much time.

    Thank you

    1. The [pdb_total] shortcode is for showing a total like that, but it is not a field, it is a stand-alone shortcode that you can put anywhere on the page. To implement this as a field, you’d need to use custom code.

  4. This page would be much more helpful (to me at least) if you provided some examples with the correct syntax, rather than just a checkmark for which attributes can be applied. I have no idea how to construct everything in a statement. Thanks.

    1. Yes, good idea, and I’m sorry the documentation is not more complete. For many of these attributes, the examples are shown in the context of explaining how to do specific things. It’s good idea to show them in use here, however.

      If you’re looking at the List Filter attribute, take a look at this article, it really goes into detail on that one:

      List Shortcode Filters

      1. Thanks, that is a very helpful page. Perhaps just putting a link to that article on the short codes page would help in the interim for newbies like me. Is there a syntax standard for when to use hyphens vs. underscores? I understand if you are filtering on a field name that contains an underscore, but what about the short codes themselves?

        1. Whether you use a hyphen or an underscore is going to be determined by the term you are using, it’s not optional. Shortcode tags and field names will always use underscores in this plugin because that is the naming standard I use. Let me know if you have a specific issue you need help with and I’ll try to give you a better answer.

  5. Many many thanks!! this plugin is awsome!

  6. Hi Roland! is there any possibility to filter a table directly using the filter parameter with a dinamic value, such as:
    [pdb_list filter "user_reg="+current_user->user_login]
    I stored in a hidden field the user that created the register, and I want to show each user only the register he has created.
    If not is there any other simple way to do this?
    Thanks

    1. Yes, it’s possible, but you need to do it in code…take a look at this article for the details:

      Using Participants Database with WordPress Users

Leave a Reply

Your email address will not be published. Required fields are marked *

Would you like to be notified of followup comments via e-mail? You can also subscribe without commenting.