Skip to main content

Templates

Learn how to create and manage page templates in TheDock.


Video Tutorial Coming Soon

Watch: Building Templates (7 min) - Complete guide to creating and editing templates.


Overview

Templates are the core building blocks of your WordPress theme. Each template defines the complete layout for a specific type of page:

  • Homepage
  • Blog archive
  • Single post
  • Individual pages
  • Category pages
  • Search results
  • 404 error page

Understanding Templates

What is a Template?

A template is a complete page layout containing:

  • Header - Site header (logo, navigation)
  • Sections - Content blocks stacked vertically
  • Footer - Site footer (links, copyright)

Template Hierarchy

Templates follow WordPress's template hierarchy:

Template TypeUsed For
FrontpageHomepage (front page)
PageStatic pages
SingleIndividual blog posts
ArchiveBlog listing, category pages
AuthorAuthor archive pages
TaxonomyCategory/tag archives
SearchSearch results page
404Error page (not found)

Managing Templates

Accessing Templates

  1. Click B. Layout in the navigation
  2. Click Templates in the sidebar

Template Categories

Templates are organized as:

CategoryDescription
In UseTemplates assigned to your theme
UnusedCreated templates not currently assigned
LibraryPre-built templates to choose from

In Use Templates

These templates are actively generating pages on your site. Each shows:

  • Template name
  • Which page type it's assigned to
  • Edit and preview buttons

Unused Templates

Templates you've created but haven't assigned. Useful for:

  • Work in progress
  • Alternative versions
  • Backup layouts

Template Library

Pre-built templates included with TheDock. Browse by:

  • Page type
  • Layout structure

Creating Templates

From Scratch

  1. In Templates, click New Template
  2. Choose Empty Template
  3. Name your template
  4. Start building in the editor

From Library

  1. Browse the Library section
  2. Click a template to preview
  3. Click Use Template to copy it to your theme
  4. Customize as needed

From Existing

  1. Find an existing template
  2. Click Duplicate
  3. Rename the copy
  4. Modify without affecting the original

Editing Templates

The Template Editor

When you edit a template, you see:

AreaPurpose
Left PanelTree view of template structure
CenterLive preview of your template
Right PanelSettings for selected element

Template Structure

Templates have a hierarchy:

Template
├── Header (optional, usually a module)
├── Section 1
│ └── Grid
│ ├── Area (column)
│ │ └── Block (content)
│ └── Area (column)
│ └── Block (content)
├── Section 2
│ └── Grid
│ └── Area
│ └── Block
└── Footer (optional, usually a module)

Hierarchy Explained

LevelWhat It Is
TemplateThe complete page
SectionFull-width horizontal row
GridContainer that arranges areas in columns
AreaA column within the grid
BlockIndividual content element

Working with Sections

Adding Sections

  1. In the tree view, click + on a section
  2. Choose Add Section Above or Add Section Below
  3. Select a section type:
    • Empty - Start from scratch
    • Blueprint - Pre-made section layout
    • Module - Linked reusable section

Section Settings

Select a section to configure:

SettingDescription
BackgroundColor or image
WidthContent container width
PaddingTop/bottom internal space
VisibilityShow/hide on specific devices

Reordering Sections

  • Drag and drop in the tree view
  • Or use Move Up/Down buttons in the action menu

Deleting Sections

  1. Select the section
  2. Click Delete or press Delete key
  3. Confirm deletion

Working with Grids

Grid Purpose

Grids arrange content in columns using the 12-column system.

Grid Settings

SettingDescription
ColumnsNumber of column areas
GapSpace between columns
AlignmentVertical alignment of areas

Column Distribution

Common column layouts:

LayoutColumn Spans
Full width12
Two equal6 + 6
Three equal4 + 4 + 4
Four equal3 + 3 + 3 + 3
Sidebar left4 + 8
Sidebar right8 + 4

Working with Areas

Area Settings

SettingDescription
Column SpanHow many grid columns to occupy
PaddingInternal spacing
BackgroundArea-specific background
AlignmentHow blocks align within

Adding Blocks to Areas

  1. Select an area in the tree
  2. Click + to add a block
  3. Choose block type (Text, Image, Button, etc.)

Working with Blocks

Available Block Types

BlockPurpose
TextHeadings, paragraphs, rich text
ImageSingle images, photos
ButtonCall-to-action buttons
VideoEmbedded videos
GalleryImage galleries
Post LoopDynamic post listings
FormContact forms
CodeCustom HTML/embed
SpacerEmpty space

Block Settings

Each block type has specific settings. Common ones:

SettingDescription
TypographyText style (Huge, Large, etc.)
ColorText and background colors
SpacingMargins around the block
LinkMake block clickable

Working with Loops

Loops are one of TheDock's most powerful features. A loop displays multiple items (posts, products, repeater fields) using a template that repeats for each item.

What is a Loop?

A loop is an area configured to display dynamic content from WordPress. Instead of showing a single piece of content, it iterates through multiple items and renders each one using the same block template.

┌─────────────────────────────────────────────────────────┐
│ LOOP AREA │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Post 1 │ │ Post 2 │ │ Post 3 │ │
│ │ ┌───────┐ │ │ ┌───────┐ │ │ ┌───────┐ │ │
│ │ │ Image │ │ │ │ Image │ │ │ │ Image │ │ │
│ │ └───────┘ │ │ └───────┘ │ │ └───────┘ │ │
│ │ Title │ │ Title │ │ Title │ │
│ │ Excerpt │ │ Excerpt │ │ Excerpt │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ ↑ ↑ ↑ │
│ └───────────────┼───────────────┘ │
│ Same template │
│ applied to each post │
└─────────────────────────────────────────────────────────┘

Creating a Loop

  1. Select an Area in your template
  2. In the area settings, change Type to Loop
  3. Configure the Query Type (what content to show)
  4. Add blocks inside the area (these become your item template)
  5. Set Items Per Page to control how many items display

Loop Query Types

The Query Type determines what content populates your loop:

Query TypePurposeUse Case
AutoUses WordPress main queryArchive pages, category pages
CustomSpecify post type and filtersShow specific content anywhere
RelatedPosts related to current post"Related articles" on single posts
Previous/NextAdjacent postsPost navigation
RelationshipACF relationship fieldManually curated posts
RepeaterACF repeater fieldLoop through field rows

Example: Blog Post Grid

To create a grid of blog posts:

  1. Add a Section to your archive template
  2. Add a Grid with one full-width Area
  3. Set the area Type to Loop
  4. Set Query Type to Auto (uses the archive query)
  5. Set Items Per Page to 6
  6. Add blocks inside the area:
    • Image block → Source: Featured Image
    • Heading block → Source: Post Title
    • Paragraph block → Source: Excerpt

The loop will display 6 posts, each with the same image/title/excerpt layout.

Loop Display Settings

SettingDescription
Items Per PageHow many items to show (e.g., 6, 9, 12)
ColumnsHow many items per row
SpacingGap between loop items
PaginationShow page navigation for more items
Order BySort by date, title, custom field, etc.
OrderAscending or descending

Loop Layouts

Loops support special layout modes:

LayoutDescription
GridItems in rows and columns (default)
ListItems stacked vertically
AccordionCollapsible items (great for FAQs)

Accordion Loop

The accordion layout is perfect for FAQs or expandable content:

  1. Set Loop Layout to Accordion
  2. Add a Breaker block to separate the summary from content
  3. Blocks before the breaker show as the clickable header
  4. Blocks after the breaker show when expanded
┌─────────────────────────────────────────┐
│ ▶ Question 1 (always visible) │ ← Before breaker
├─────────────────────────────────────────┤
│ Answer content here... │ ← After breaker
│ (hidden until clicked) │ (expandable)
└─────────────────────────────────────────┘

Filtering Loops

Add interactive filters to let users narrow down results:

  1. Enable Filters in the loop settings
  2. Choose which taxonomies to filter by (categories, tags, etc.)
  3. Users can click filters to show only matching items

Dynamic Sources in Loops

Inside a loop, blocks can pull data from each item:

SourceDisplays
Post TitleThe item's title
Featured ImageThe item's featured image
ExcerptThe item's excerpt
DatePublication date
AuthorAuthor name
CategoriesAssigned categories
Custom FieldACF or custom meta field

Loop with ACF Repeater

To loop through an ACF repeater field:

  1. Create a repeater field in ACF (e.g., "Team Members")
  2. Set the area Query Type to Repeater
  3. Select the repeater field name
  4. Map sub-fields to blocks:
    • Image block → photo sub-field
    • Heading block → name sub-field
    • Paragraph block → bio sub-field

Each repeater row becomes a loop item.


Assigning Templates

Templates must be assigned to appear on your site.

In TheDock

  1. Go to C. Build > Theme Structure
  2. Find the page type (Homepage, Single Post, etc.)
  3. Click Change Template
  4. Select the template to use

Multiple Assignments

Some templates can be used for multiple page types:

  • Same "Index" template for archives and taxonomies
  • Same "Page" template for all static pages

Exporting Templates for WordPress Editor

Templates don't have to be assigned in Theme Structure to be useful. You can mark templates for export so they become available as Page Templates in the WordPress editor.

How It Works

  1. Create a template in TheDock
  2. In the template settings, enable Export for WordPress
  3. Export your theme
  4. In WordPress, when editing a page, the template appears in the Page Attributes > Template dropdown

Use Cases

This is useful when:

  • Landing pages - Create various landing page layouts that editors can choose from
  • Special pages - Offer different layouts for specific content (full-width, sidebar, etc.)
  • Client flexibility - Let content editors choose layouts without accessing TheDock

Example: Multiple Page Layouts

You might create:

TemplatePurpose
Page - DefaultStandard page with sidebar
Page - Full WidthNo sidebar, edge-to-edge content
Page - LandingHero section, no header/footer
Page - ContactForm-focused layout with map

Each can be marked for export, giving WordPress editors a choice when creating pages.

Template Selection in WordPress

After export, editors see your templates in the WordPress page editor:

  1. Edit a page in WordPress
  2. In the right sidebar, find Page Attributes
  3. Open the Template dropdown
  4. Select from your TheDock templates
  5. Update the page

The page now uses that specific template layout.


Best Practices

1. Name Templates Clearly

Use descriptive names: "Homepage Hero", "Blog Archive Grid", "Product Single"

2. Keep It Simple

Start with few sections. Add complexity only when needed.

3. Use Modules for Repetition

Headers, footers, and recurring sections should be modules.

4. Test Responsive

Preview on all devices before finalizing.

5. Save Often

Though auto-save works, manual saves ensure nothing is lost.

6. Duplicate Before Major Changes

Keep a working version while experimenting.


Troubleshooting

Template not appearing on site

  • Check it's assigned in Theme Structure
  • Verify the template is in "In Use"
  • Export the theme after changes

Sections overlapping

  • Check section padding settings
  • Verify grid is properly configured

Content not centered

  • Check grid width settings
  • Verify area spans equal 12

Changes not showing after export

  • Clear any caching plugins
  • Hard refresh the browser (Ctrl+Shift+R)


← Back to Documentation