Displaying custom fields
In this tutorial, we will show just the steps for displaying and configuring some custom fields.
There is an advanced tutorial that goes into more depth that shows a specific project involving Advanced Custom Fields (from which these steps have been extracted): Using Advanced Custom Fields and Snippets to make a Pricing Table
So, if you want the context of these particular steps, look at it.
NOTE: Architect can display any basic custom fields. Fields that return arrays or objects, like repeater fields or those in repeater fields, cannot yet be displayed. However, you could write a shortcode to display those and include that in an Architect meta field group.
This document can be viewed online at: https://architect4wp.com/codex/displaying-custom-fields/
Setup your Blueprint
First off, setup a Blueprint that will display from content that has custom fields.
Setup the content layout
- Switch to the Content Layout screen
- Set the Components to show to Title, Excerpt, Body, Custom 1 and Custom 2
- Adjust all of them in the Layout to be 100% wide
This next step is the most important of all, and the one that everyone seems to miss!
4. In Number of custom fields, enter 4 (i.e. Price, recurrence, link and highlight)
Setup the Price field
- Switch to the Custom field 1: price tab
- Set Show in custom field group to Custom 1
- Select price in the Field name dropdown
- Set the Field type as Number
- Set the Decimals to 0
- Enter Prefix text of $ (or your own currency symbol)
- Enter 99 in the Suffix text.
Because Architect allows you to format the prefix and suffix text independently of the main text, we can enter the $ and 99 here and then format them to achieve the same look as in the example we a copying.
Additional notes
Architect version used to make this tutorial: 1.1.7
Hosting defaults can seriously affect sites with many custom fields.
Using custom fields greatly increases the number of input fields in the Architect Blueprint. Each custom field you add to a Blueprint, adds 50 input fields (between its settings and its CSS)
PHP has a default limit of max_input_vars of 1000.
If this is exceeded, some fields won't get saved.
It is easily changed by updating your PHP.ini file with this:
max_input_vars = 2000
or your .htaccess with:
php_value_max_input_vars 2000
As WordPress gets used more and more for major applications rather than just blogs and CMSes, this will become a more common problem. However, hopefully, hosts will start changing the default to 2000 or more.
For more information, see these posts: http://jonathannicol.com/blog/2014/03/02/wordpress-custom-fields-not-saving-phps-max_input_vars-may-be-to-blame/
If you are working with WooCommerce, Advanced Custom Fields, or any other plugin that adds many fields to your WordPress, the following plugin is highly recommended for debugging this issue.