The Layout is how the parts of the Custom Table are arranged on the rendered HTML page.
In Custom Tables we use Twig tags that will be replaced with the content from the database or generated by the rendering process. Example: {{ table.title }} — this will be replaced with the current table title, “Appointments”.
Let’s create the Edit Form layout.
In the WordPress admin menu go to Custom Tables, then click the Layouts icon on the Dashboard (or choose Layouts in the submenu).

The Layouts screen heading is Custom Tables – Layouts. Click Add New.

The form heading is Add New Custom Layout. Fill in:
- Layout Name (required):
SubmitAppointments - Layout Type (required): Edit Form
- Table (required): appointments

Now use Layout Auto Creator to generate the layout from the type and the table fields.

A dialog titled Select the layout type opens. Choose Edit form again (even if you already set Layout Type to Edit Form). Leave the field and button checkboxes as they are, then click Generate.

The generated code appears on the HTML (Desktop) tab:
<legend>{{ table.title }}</legend>
{{ html.goback("Go back") }}
<div class="form-horizontal">
<div class="control-group">
<div class="control-label">{{ fullname.title }}</div><div class="controls">{{ fullname.edit }}</div>
</div>
<div class="control-group">
<div class="control-label">{{ email.title }}</div><div class="controls">{{ email.edit }}</div>
</div>
<div class="control-group">
<div class="control-label">{{ date.title }}</div><div class="controls">{{ date.edit }}</div>
</div>
</div>
<div style="text-align:center;">{{ html.button("save") }} {{ html.button("saveandclose") }} {{ html.button("saveascopy") }} {{ html.button("cancel") }}</div>

The tags are the same as in the Joomla example, including {{ html.button("saveandclose") }}. In WordPress, double-clicking a tag does not open a parameter dialog.
When you finish editing the layout, click Save Layout.

Now we have the Edit Form layout.
The Layout is how the parts of the Custom Table are arranged on the rendered HTML page.
In Custom Tables we use Twig Tags that will be replaced with the content from the database or generated by the rendering process. Example: {{ table.title }} – This will be replaced with the current table title – “Appointments”.
Edit Form Layout: #
Let’s move on and create our first Layout.

Click on the [New] button to create a new Layout.

Enter the Layout name “SubmitAppointments”, that will be the unique name of our layout since it will be used as the identifier name to find the Layout.
Select the Type: The kind of page it will be used on. We need a layout for Submit Form page so select “Edit Form” type.
Choose the table for which this layout should be used.

Now you may use “Layout Auto Creator” to generate the layout based on the type and fields your current Custom Table has.

Most of the Tags have their parameters. For example, the {{ html.button(“saveandclose”) }} has the parameters “type”, “Button Label”, “Custom Redirect Link” And “CSS Class”.
Simply double-click on a Tag to see what parameters it has.

In the “Custom Redirect Link”, you can add a link to redirect the visitor to the Home Page for example.
When you finish editing the Layout – Save it.

Now we have the Edit Form Layout.
Leave a Reply
You must be logged in to post a comment.