Skip to content
This repository has been archived by the owner on Nov 25, 2017. It is now read-only.

Metabox Component

Felix Arntz edited this page Jan 21, 2016 · 4 revisions
  • Class: WPPTD\Components\Metabox
  • Slug must be: unique among all metabox instances within the same post type
  • Possible parents: WPPTD\Components\PostType
  • Possible children: WPPTD\Components\Field

This component represents a metabox in a post editing screen of a specific post type. A metabox can group meta fields together and is draggable and toggable.

Properties

title

  • Type: string
  • Default: 'Metabox title'
  • (required)

This defines the heading which will be displayed at the top of the metabox.

description

  • Type: string
  • Default: empty string
  • (optional)

This description will be shown right below the metabox title.

context

  • Type: string
  • Default: 'advanced'
  • (optional)

This property works like the $context parameter in the add_meta_box() function. It must be set to either 'normal', 'advanced' or 'side'.

priority

  • Type: string
  • Default: 'default'
  • (optional)

This property works like the $priority parameter in the add_meta_box() function. It must be set to either 'high', 'core', 'default' or 'low'.

callback

  • Type: callable
  • Default: false
  • (optional)

This can be a function which is called if the metabox does not contain any fields. You can use it to create metaboxes with custom content. Note that this callback is not executed if there are fields in the metabox. However, if you don't include any fields, this property is required.

position

  • Type: number
  • Default: null
  • (optional)

A number that specifies the position of the metabox among the post type metaboxes with the same context and priority. Components with lower positions are displayed before components with higher positions.