Displaying Custom Post Data in Dynamic Templates

One of the primary reasons you would use Dynamic Templates when setting up your site is to create a unique layout to be used as the design across multiple posts so you can always easily modify it from a single location. When creating dynamic templates you will always be displaying “dynamic” data related to the current post such as the post title, content, featured image, gallery, categories, tags..etc. Now, if you want to display custom/unique data on a per-post basis, this is where Custom Fields come into play.

WordPress custom fields allow you to store specific data about a post (much like the options located in the Theme Settings metabox) which can be accessed and used/displayed on the front-end either via 3rd party plugins or the built-in Total “Custom Fields” module.

Basic Example Using WP Custom Fields

A basic example of displaying custom data for a post may look something like this:

Step 1: Add a new custom field to a post in this case we added a filed with the name “email_address” and the value “[email protected]

Custom field added to a post

Step 2: Add the “Custom Field” module to your dynamic template and enter the custom field name you want to display the value of.

Custom field module added to a template to display the post data

Result: If the post has a custom field and value with the same name defined in your Custom Field module added to the dynamic template you will see the value on the post using the dynamic template.

Recommended: The WordPress custom fields functionality is very powerful but it’s also not very user-friendly as you will need to remember the names of fields and it only allows you to enter plain text as the value. We highly recommend using a plugin such as Advanced Custom Fields so you can create forms to display in the post editor with the fields you need to fill out for any given post. See more below.

Displaying Custom Fields in other Modules

Many Total modules allow you to display custom fields natively as well. For example the Heading module allows you to easily select a custom field for the “Text Source”, see below:

For modules that don’t support native custom field display you can also use theme’s “cf_value” shortcode inside a text field. Below is an example if you are wanting to display a custom field value for a Milestone number.

Recommended Plugins

  • Advanced Custom Fields – allows you to register custom fields for any post type with an easy and intuitive UI making it easier to manage and use your custom fields (the default WordPress custom field box requires you to remember all your field names as opposed to seeing an actual form you can fill out, which is what ACF allows you to do).
  • Post Types Unlimited – This plugin was created with Total in mind so you can easily add custom post types to your site and fully customize the way they work and display in the theme.