13 May How to Create Custom Fields in WordPress to Give Your Posts Extra Information
When creating a website, sometimes its limited functionality frustrates us and doesn’t allow for expressing creativity. When you are put in this situation, custom fields are here to give your website additional functionality.
This article will explain what custom fields are and how they can benefit your website and improve user experience.
What are custom fields, and why would someone need them
Custom fields, also known as post meta, are an additional feature on WordPress, allowing the user to add custom information to their posts. WordPress stores said information as metadata and lets users display it using template tags in their desired theme.
Extra information is not enabled by default, so you will have to do it yourself. The option for that is hidden in the WordPress post editor. To access it, go to the three dots in the upper right corner and check “Custom Field’s” located under “Advanced Panels” to enable them.
Furthermore, every custom field has two parts: its “Name“, which identifies the custom field, and its “Value”, which shows the value of the custom field. When you want to use your custom field, you need to input its name. If you want to edit an already made custom field, change the “Value” input.
Using and displaying your custom fields does require some coding knowledge. You will have to go to your theme editor to display the code. Unfortunately, every time your theme updates, it will overwrite code, so it is recommended for you to code inside the child theme.
To help you with configuring and displaying your custom fields, we have two useful plugins. Keep on reading to find out more about them!
Meta Box is one of the best plugins out there to help you with your custom fields. It is lightweight, easy to work with, and extends the functionality of your website.
The Meta Box core plugin is free and can be found on the official site of WordPress. The core has to be activated first to use the plugin’s other options. To install it on your site, go to your account’s plugins and add it as a new one.
Once you have installed Meta Box, head over to the plugin’s dashboard. Once on the dashboard, click on the “Custom Fields” tab, and you will see all custom fields that are already there.
On the Meta Box demo version, you can see all the available options. Here is an example of a custom field.
As you can see, this is a very user-friendly interface, so if you are not a fan of coding, this is a great plugin for you. You can add as many fields as you want and edit their labels, types, placeholders, or set default values.
On the other hand, if you are a developer and you like to code, the “Get PHP Code” is amazing. When creating your field, PHP code is automatically generated, making it easy for you to put it directly into your code.
Advanced Custom Fields – ACF
WordPress, unfortunately, has never focused on building a simple system for custom fields. Thankfully, this is where Advanced Custom Fields fills in the gap. This is one of the most important plugins you can use as a developer on WordPress.
Advanced Custom Fields removes the complexity of adding custom field functionality into your desired theme. It allows you to display custom fields on the admin panel and a simple API on the front end of your website using PHP. There is both a free and a premium version of the plugin.
Once you install and activate your plugin, you should see the “Custom Fields” tab on the left side of the menu. By clicking “Add New”, you will be able to create your Field Group.
When editing the field group, you will see three areas of interest: Fields, Location, and Options. In the Fields, you can create and manage a variety of custom fields. Required options for the custom fields are label, name, and type.
Then, the Location field allows you to create a set of rules which decide when and where to add your custom fields to your post. There are a few options for each of your field groups that can help you customize your custom fields.
There are also many more options that Advanced Custom Fields offers. Check out the plugin for yourself and see how you like it!
Custom fields can truly help your website performance as well as make it unique. They can transform your WordPress functionality and add additional information to your posts.
This article discussed two popular plugins that can help you in this field – MetaBox and ACF. They both offer a great set of tools to better your experience with creating and managing custom fields.
However, we recommend to you MetaBox, which is user-friendly and especially great for beginners. It also offers a demo version so that you can check its amazing features right away.