Templates, fields and creating pages

Posted 7th Sep 2017

#fields #setup #templates

This is a basic guide to templates, fields and creating pages in processwire. We will edit the 'basic-page' template for demonstration here.

Admin > Setup > Templates

Select the 'basic-page' template.

Add a field using the add field options select dropdown
Add a field using the add field options select dropdown Zoom

Add a field using the 'Add Field' options select dropdown. I added a field called 'images'.

Images field added to template
Images field added to template Zoom

The little handle on the left allows you to drag the field and reposition it above or below the others.

Why would you want to rearrange the fields?

The order the fields appear on the edit template screen is the order in which they will appear when editing a page created with this template.

Create a page using the 'basic-page' template

Create a new page using the basic-page template
Create a new page using the basic-page template Zoom

You'll see that the fields in the 'basic-page' template we changed earlier are now present on this page edit screen because the page was created using the 'basic-page' template. Yes, I sound repetitive, but it's important to understand the relationship between templates and pages.

Editing the page created with the basic-page template
Editing the page created with the basic-page template Zoom

Admin > Setup > Templates

Select the 'basic-page' template. Go ahead and rearrange a few of the fields and save the template.

Rearranging the fields on the basic-page template
Rearranging the fields on the basic-page template Zoom

Now go and edit any page created with the 'basic-page' template. You'll see the field order on the 'basic-page' template above matches the order of fields on the page created with the 'basic-page' template below.

Rearranged fields on the page created with the basic-page template
Rearranged fields on the page created with the basic-page template Zoom

Finally, to remove a field from a template, you should be aware of two things:

1) This only removes the field and deletes the data from pages created using this template.
2) It does not delete the field. The field still exists under 'Admin > Setup > Fields'. This behaviour is desirable as you may have used this field on other templates.

Remove a field by selecting the trash can icon.

Removing a field from a template
Removing a field from a template Zoom

Then save the template. You will get a warning which explains the implications. Check the 'Remove fields' box and select 'Remove fields'.

Removal confirmation screen
Removal confirmation screen Zoom

The field has been removed from your template.

Field has been removed from template
Field has been removed from template Zoom

If you check out a page created using the 'basic-page' template, you will see that the 'featuredImage' field is no longer there.

Field removed from page created with basic-page template
Field removed from page created with basic-page template Zoom

Hopefully you are now more clued up on how fields/templates/pages are connected.

Feedback & support

I hope you enjoyed this tutorial. You can support pwtuts by following on @pwtuts. You can also donate at paypal.me/swcarrey to help support the site which would be awesome!

Related tutorials / See all

Suggest a tutorial

Please note: I do not store any of this information, it's simply used to send me an email. Your email address is required so I can get clarification on your request if needed.