Notes from Nick Batik’s 11.25.14 Austin WordPress Intermediate Meetup Presentation
These presentation notes were developed to support those just learning how to create and display metadata in their WordPress sites. The Ins and Outs of WordPress Metadata describes how to go beyond pages and posts, and learn how to develop data entry screens for specific information whether it’s a shopping cart, a directory, recipes, genealogies or any other specialized content.
Nick Batik explained what metadata is and demonstrated custom content fields, and reviewed best plugins for creating and setting the field types such as check boxes, drop downs, radio buttons, text, and image fields. He demonstrated the underlying metadata code and ways to take it further. (See slide deck below.)
The second part of custom content is getting it to display on the public side of your website. As a site developer / designer you must add code to your theme to find and display the custom fields. Corey Ellis demonstrated custom loops and the Meta Data API, and how to retrieve and display the data entered in the backend of your site.
Note: When Nick or Corey use the phrase “post” throughout this presentation, they referring to a post of any post type, not the default blog post type bundled with WordPress.
What is metadata?
Metadata is set of data that describes and gives information about other data.
What is a post meta box?
A post meta box is a customizable box appearing on the post editing screen that allows an authorized user to select or enter information in addition to the main post content. This information is related to the post in some way.
What are Custom meta boxes?
Custom meta boxes are tools to enhance content. Meta boxes are the little blocks in the editor section for each post type. Meta boxes are commonly used by themes and plugins when a developer wants to implement a constantly formatted interface for saving/editing a number of custom fields than the one provided with WordPress.
What are WordPress Custom Fields?
Custom Fields are a form of meta-data that allows you to store arbitrary information with each Word- Press post. While this does not sound so powerful, it is the single most powerful component of WordPress posts and content types (aka post types). This meta-data is handled with key/value pairs. The key is a “name” which identifies the specific field thus it is a constant and should stay the same for all posts however you can use the same key multiple times within one post. The value is the information that will be displayed for the field when you call it in your WordPress theme thus it can change with each post.
How To Create Custom Post Meta Boxes In WordPress
The two most common types of data is entered into meta boxes are:
- Metadata (i.e. custom fields),
- Taxonomy terms.
Post metadata is data that’s saved in the wp_postmeta table in the database. Each entry is saved as four fields:
- meta_id: A unique ID for this specific metadata.
- post_id: The post ID this metadata is attached to.
- meta_key: A key used to identify the data (A single meta key can have multiple meta values.)
- meta_value: The value of the metadata.
Metadata is the key/value pairs saved for a specific post that let you to add custom data to your posts. It is particularly helpful when you’re developing custom post types.
How to use post metadata
To know how and when custom meta boxes are helpful with organizing content, you must understand how to add, update, delete, and get post metadata.
- add_post_meta(): Adds post metadata.
- update_post_meta(): Updates post metadata.
- delete_post_meta(): Deletes post metadata.
- get_post_meta(): Retrieves post metadata.
Below please find Nick Batik’s slide deck and other links and references.
1. Understanding the Ins and Outs of WordPress Metadata
Austin WordPress Meetup
Tuesday, Nov. 25, 2014
Presenter: Nick Batik
2. What is Meta Data?
3. Metadata is “data about data”.
There are two (metadata types):
• structural metadata, about the design and specification of data structures or “data about the containers of data”;
• and descriptive metadata about individual instances of application data or the data content.
5. Let’s Look at Some Examples (It will make more sense)
• Date of Publication
• Number of pages
7. Business Directory
• Name of business
• Hours of operation
• Exposure time
• Focal length
• Pixel dimensions
• Where to get tickets
10. Oh! So meta data is information about the book, business, photograph, and event!
11. Adding Metadata to WordPress
12. Custom Post Types The “container” for your metadata Example: • Books • Photo Portfolio • Business Directory • Events
13. Custom Fields The metadata for a Post Type Example: • Title • Author • Publisher • Date of Publication • Number of pages • ISBN
14. Custom Taxonomies Categories specific to a Post Type Example, a “genre” taxonomy for a book: • Science Fiction • Drama • Romance • Mystery • Western
15. Post Types can have multiple taxonomies
16. “Books” could also have a taxonomy of “binding”:
• hard cover
17. …and “Publisher”:
• Prentice Hall
18. Field Formats Choosing how each field should be edited
19. Text Field A single line of text
20. Text Area
21. WYSIWYG Text Area
22. True/False Check for true, uncheck for false
23. Checkbox Select as many as you want
24. Radio Button Select only one from the list
25. Drop-down List
26. File or Image
27. Embed content Such as videos, audio, slide shows, etc.
28. Link to other pages
29. Color or Date Pickers
30. WordPress Metadata Plugins
• Advanced Custom Fields
• Types – Custom Fields and Custom Post Types Management
• Pods – Custom Content Types and Fields
31. Creating Custom Post Types
• Sections supported
• Roles & capabilities
• Menu position
33. Doing it with code
34. (code sample)
35. Post Type Supports
Default: title and editor
• ‘editor’ (content)
• ‘author’ •
‘thumbnail’ (featured image, current theme must also support post-thumbnails)
• ‘comments’ (also will see comment count balloon on edit screen)
• ‘revisions’ (will store revisions)
• ‘page-attributes’ (menu order, hierarchical must be true to show Parent option)
• ‘post-formats’ add post formats, see Post Formats
36. Post Type Menu Position
The position in the menu order the post type should appear. show_in_menu must be true.
Default: null – defaults to below Comments
• 5 – below Posts
• 10 – below Media
• 15 – below Links
• 20 – below Pages
• 25 – below comments
• 60 – below first separator
• 65 – below Plugins
• 70 – below Users
• 75 – below Tools
• 80 – below Settings
• 100 – below second separator
37. Demo Creating a Custom Post Type with Types plugin
38. Demo Creating a Custom Post Type with PODS
39. Demo Adding Custom Fields to “Books” with Types
40. Demo Adding Custom Meta to Events with PODS, Types, and Advanced Custom Fields (ACF)
41. Demo A quick demo of how to do this in code…
Metadata Resources for designers and developers
Post Meta Data Section
Function Reference/add metadata
Other helpful links for WordPress Custom Content Fields
https://www.google.com/search?q=WordPress+Custom+Content+Fields&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-beta&channel=sb – rls=org.mozilla:en-US:official&channel=sb&q=WordPress+Custom+Content+Fields
Leave a Reply