Short Code Usage

Use shortcode wpdataaccess to show database tables and views on your website. jQuery DataTables is used to provide dynamic HTML tables supporting pagination, sorting and searching. Choose between flat or responsive tables.

Example of a flat table

IMPORTANT You need to grant access explicitly to tables shown on your website!

The following parameters are supported:

  • table (table or view name)
  • columns (comma seperated list of columns, default: * = all columns)
  • responsive (yes or no, default: no)
  • responsive_cols (number of columns shown on the table, default = 1)
  • responsive_type (modal, collapsed (default) or expanded)
  • responsive_icon (yes or no, default: yes)

Parameter table is mandatory. All other parameters are optional. Tables are shown in flat format by default.

Flat table examples

In it’s simplest form usage looks like:
[wpdataaccess table=”wp_customers”]

This will display a flat table showing all columns. You can limit the number and order of columns shown by providing parameter columns. The following example will only show the columns name, address and city in that particular order:

[wpdataaccess table=”wp_customers” columns=”name,address,city”]

The default value for parameter responsive is “no”. If you omit this parameter, a flat table is shown and parameters responsive_cols, responsive_type and responsive_icon are not taken into account.

Responsive table examples

Use parameter responsive = “yes” to add responsive tables to your website. Parameters responsive_cols, responsive_type and responsive_icon can be used to manage the layout and behaviour of your responsive tables.

[wpdataaccess
    table=”wp_customers” columns=”name,address,city,ID”
    responsive=”yes” responsive_cols=”1″ responsive_type=”modal” responsive_icon=”yes”
]

Example of a responsive table

Example of a responsive table (clicked)

Grant access to database tables

IMPORTANT Your table and view data will not be shown on your website without this step!

For security reasons explicitly you have to grant access to every table or view used in shortcode wpdataaccess. Without this feature adding [wpdataaccess table=”wp_options”] to a page or post would allow any user to see the content of table wp_options, or any other table.

Follow the following steps to grant access to a table or view you allow users to add it’s content to your website:

  • From the menu click “WP Data Access” > “Manage Plugin”
  • Click on tab “Front-End Settings”
  • Click on the table or view your want to grant access to (multiple selections possible)
  • Save your front-end settings

Peter Schulz

Written by 

Lecturer at HAN University of Applied Sciences

Leave a Reply

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