Adding Custom Fields
Learn to add custom fields for storing metadata.
The default fields associated with each post or page are the author’s name as well as the date and time it was published on. If we need extra information, we can add our own metadata fields. These are called custom fields. Every project has its own needs. In an e-commerce project, every product needs a price. It may additionally need a size or color option depending upon the kind of product. These fields store the key information or metadata about the product.
Custom fields allow the users to enter or update the information in an easy way while ensuring that the key information is added in a consistent manner on all posts. For example, the size of the product or the date is in the same format. There are two main ways of adding a custom field. One is using a plugin and the other is by editing the theme files.
For our website, we will create a custom field for the banner background image as well as for the description in the banner area. This will allow the user to add a description for the post or page as well as uploading custom banner images.
Plugins for custom field
There are many plugins which add custom fields to the post type. One of the most commonly used plugins for custom fields is the Advanced Custom Fields (ACF) plugin.
Install ACF plugin
To install the Advanced Custom Fields plugin, choose the "Plugins" option from the admin sidebar. From the pop-out menu choose "Add New" and in the screen that opens, type advanced custom fields in the search box. From the search results choose the plugin by WP Engine which has over 2 million installations.
Get hands-on with 1200+ tech skills courses.