As we know, custom fields is used to add more data to some objects in WordPress such as posts, pages, taxonomies, users, and comments. The two main purposes of custom fields are to describe and filter those objects. In this post, we'll learn what specific applications custom fields has in reality.

SEO - Search Engine Optimization

Yoast SEO is one of the most popular SEO plugins in WordPress with more 5 million active installs. This plugin operates on custom fields base.

Custom fields and meta box in YOAST SEO

After installing the plugin, you’ll see the appearance of a big custom meta box in the post editing screen (as in the image above). There are many custom fields in that meta box. Yoast uses these custom fields to allow you to enter SEO information of the post. Take SEO title as an example, this one will replace the content of the post title when displaying in HTML in the frontend. Meta description and social meta tags for Facebook/Twitter are also custom fields.

Multilingual websites

Similar to SEO, we can use custom fields to support multi-languages. By creating more custom fields, we can save the content of other languages for the attributes of a post such as title, content and even other custom fields. That is the simplest way to support multi-languages.

Custom fields for Multi-languages
Custom fields for multi-languages

E-commerce

When mentioning e-commerce in WordPress, we can not skip WooCommerce which is the most popular e-commerce plugin. WooCommerce uses lots of custom fields to describe the information of a product and filter products according to these custom fields.

The below image is an example of how custom fields are used to add information about products’ weight and size. WooCommerce also has many other fields for putting price and managing the store.

Use custom fields to describe subjects in e-commerce
Use custom fields to describe subjects in e-commerce

WooCommerce also creates new custom post types such as order_items, payment_tokens, which are saved in own tables with the metadata structure as the way of WordPress's post meta. Thus, we can use the functions of metadata which WordPress supports for them. You can read more about WooCommerce Database Description.

Review / Rating / Like

Regarding like, we can create a custom field for post/page to save the number of likes in the post. That is rather simple. We need a field only for save, then each time user clicks the “Like” button, this field will be updated.

Use custom field as a social button
Use custom field as a social button

Relating to review/rating, we can not create custom fields directly to post. Fortunately, WordPress also supports custom field for comments. Each comment will be regarded as a review. In each comment, there is a custom field to save the value of the rating (from 1 to 5). This is the way that WooCommerce uses to review its product.

Review product in e-commerce by using custom fields
Review product in e-commerce by using custom fields

Learning Management System (LMS)

A LMS is more complicated than normal website. It requires new functions and new post types such as courses management, different lessons in each course, examines, questions, user management, user access management, buying, and paying for courses.

The shift from CMS to LMS needs rather many changes, but by custom post type and custom fields’ support, WordPress completely has the ability to become an LMS. The following image is an LMS plugin named Sensei from Automattic.

Use custom fields to shift CMS to LMS
Use custom fields to shift CMS to LMS

As you see, each lesson has enclosed information, and custom fields are used to store that information.

Booking: Restaurant, hotel, ticket plane and travel, property

All such websites have two main demands which are describing a new object (restaurant, room, flight, and house) and filtering content based on the attributes of these objects. Of course, custom fields can meet them all. This is also the most basic application of it.

We use custom post types to create an object, then use custom fields to add more info to the object. Depending on the user's input of data in the fields, you make the appropriate queries. If you're not clear, this case study will help you imagine how to create a hotel booking site with custom fields and this series can help you in building an OTA site in which custom fields are very important elements.

There are many plugins/themes which support these functions at ThemeForest.com. You only need to install, then you’ll have the necessary functions.

Conclusion

So far, we know that custom fields can support us a lot of additional functions in almost industries. It brings WordPress a worth ability of unlimited expandable in using.

In the next post, we will talk about how to save it into the database, as well as deal with some arising problems.

Leave a Reply

Your email address will not be published. Required fields are marked *