Skip to content

How to create a selectable template (similar to how page templates work)

Aaron Ware edited this page May 22, 2017 · 1 revision

Mesh comes packaged with a default set of column templates (labeled 1-4). Sometimes however you need to create your own more customized layouts. In order to accomplish this, we have implemented a system very similar to WordPress core, WooCommerce and other popular plugins where we utilize a template hierarchy/inheritance.

Creating a template in a few steps

In order to create a column template you simply need to create a new .php file with the proper heading within the top of your file.

Step 1 : Create a template php file

While the name of the file doesn't entirely matter. We typically use the following convention mesh-template-custom-layout.php

Create the template file within your theme.

Step 2 : Add header comment to your template

Example Usage

<?php
/**
 * Mesh Template: Custom 1
 * Mesh Template Blocks: 1
 */

?>
  • Mesh Template: : This is the label of the template that will be displayed within the admin
  • Mesh Template Block: : The number of blocks associated with the custom template