Back to school sale! Save up to 50%
Grab Yours

Hidden (Dynamic) Columns in WordPress Tables

Hidden columns introduce new functionality within wpDataTables starting from version 6.3, enabling the automated population of values.

This feature is exclusive to Manual Tables and offers flexibility in specifying auto-population preferences for designated columns.
You can add hidden columns during the initial table creation or later on after the table has been generated.

By default, hidden columns remain concealed, but you can toggle their visibility either from the Column Display settings or from the “Column List.”

 

For each hidden field, you can define the ‘Dynamic editor predefined value‘ according to your requirements. When a new row is added to the Table, the Column will auto-populate accordingly.

It’s important to note that hidden fields cannot be edited manually, so naturally, they will not be visible as any Editor Input Type during editing.
Essentially, they solely serve the purpose of auto-population.

  1. Create a Manual Table.
  2. Select the desired column type as “Hidden (Dynamic)”.
  3. Define the parameters for the automatic population as per your requirements.

We will go over the types of ‘Dynamic editor predefined values’ you can choose from.

Current User

Under the “CURRENT USER“, you can find the following selections :

  1. Current User ID : It auto-populates the value of the currently logged user ID who is editing the row.
    In the same principle, it is going to auto-populate the other details of the currently logged user, such as :
  2.  Current User Display Name
  3. Current User First Name
  4. Current User Last Name
  5. Current User Email
  6. Current User Login
  7. Current User IP Adress

Current Date/Time

Under the “CURRENT DATE/TIME”, you can find the following selections :
1.  Current Date : It auto-populates the value of the current Date when the row is being edited.
In the same principle, it is going to auto-populate the current Datetime and the Current Time.

Placeholders

%VAR1%, %VAR2%, %VAR3%, %VAR4%, %VAR5%, %VAR6%, %VAR7%, %VAR8%, %VAR9% – these are the ‘variable’ placeholders.

You can provide a default value in the Table’s Placeholder settings that will be used for table generation, and when a different one is not defined in the shortcode.

You can check more on how our ‘variable’ placeholders are configured in tables here.

Post Data

In the Post Data selection, all of these hidden field types can only be populated from the Front-End.

For example, for the Post ID, the DataTable will only auto-populate the Post ID if a user creates the new row on the Front-End, while if you try to add a new row from the Table’s Back-End Editor, in that case, this field will be blank.

Post Meta key hidden columns

In order to render the Post Meta Value as string, you need to input the appropriate Post Meta Key.

Please note : All Post Meta will be rendered only on the Front-End as a string.

Advanced Custom Fields data

You can pull Advanced Custom Field(ACF) data by inserting your desired ACF Key and the table will store the value which matches from that specific WP Page where its shortcode is placed on.

In this example, we created a Page about specific movie details and inserted a custom field group via ACF.

Let’s say we populate it on the Page Back-End Editor as Admin and set the custom field ‘title’ as “The Matrix”, the ‘genre’ is a checkbox of ‘action’ and ‘sci fi’ and the year is set as number 1999.

We need to have at least one editable Column in our Manual Table in order to be able to add new rows, so let’s set the ‘director’ as ‘One Line Editor’.

We can choose the hidden Columns ACF keys as ‘title’ along with other Custom fields from this Group.

Then we set our Manual Table shortcode on this Page and create a new row, the hidden ‘ACF Data’ fields will auto-populate the correct values matching their ACF key.

When we add a new row, the Table will only show us the columns which have an editor input type selected ( in this case, we will just insert the director as ‘the Wachowskis’).

All the hidden Columns will auto-populate in the ‘background’ and we will then reveal them from the Column List to check how they look in the end.

Please note: This functionality to pull/auto-populate the Advanced Custom fields(ACF) data will work in the same way if you use the ‘Secure Custom Fields‘(SCF) Plugin, so you can choose either of them for this purpose.

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box