15. Custom Fields

Before the existence of custom post types, custom fields were the tool of choice to enhance out-of-the-box WordPress functionality. I once built a 23,000-page directory using WordPress and custom fields. They give you precise control over metadata for specific posts and pages.

Now that we have custom post types and greater control over data tied to posts and pages, custom fields are used primarily for specific functions, such as toggling elements on posts or pages, showing or hiding content, and so on. In our theme we’ll be using custom fields to set the URL of our home page slider.

What you’re about to learn

• How to set custom fields in a post

• How to display all custom fields on a post

• How to use custom field data for ...

Get Web Designer’s Guide to WordPress: Plan, Theme, Build, Launch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.