Skip to content

Meta Box plugin (getting started) example

Paul Ryley edited this page May 16, 2017 · 4 revisions

The following contains all of the meta box fields found in the Meta Box plugin getting started demo file.

Please see Adding Meta Boxes for detailed information on adding meta-boxes.

To use, copy and paste into the Post Type Meta Boxes field in the Pollux plugin settings.

standard:
  title: 'Standard Fields'
  post_types:
    - post
    - page
  context: normal
  priority: high
  autosave: true
  fields:
    text:
      name: Text
      label_description: 'Some description'
      desc: 'Text description'
      type: text
      std: 'Default text value'
      clone: true
    checkbox:
      name: Checkbox
      type: checkbox
      std: 1
    radio:
      name: Radio
      type: radio
      options:
        value1: Label1
        value2: Label2
    select:
      name: Select
      type: select
      options:
        value1: Label1
        value2: Label2
      multiple: false
      std: value2
      placeholder: 'Select an Item'
    hidden:
      type: hidden
      std: 'Hidden value'
    password:
      name: Password
      type: password
    textarea:
      name: Textarea
      desc: 'Textarea description'
      type: textarea
      cols: 20
      rows: 3
  validation:
    rules:
      password:
        required: true
        minlength: 7
    messages:
      password:
        required: 'Password is required'
        minlength: 'Password must be at least 7 characters'
advanced:
  title: 'Advanced Fields'
  post_types:
    - post
    - page
  fields:
    heading1:
      type: heading
      name: Heading
      desc: 'Optional description for this heading'
    slider:
      name: Slider
      type: slider
      prefix: $
      suffix: ' USD'
      js_options:
        min: 10
        max: 255
        step: 5
      std: 155
    number:
      name: Number
      type: number
      min: 0
      step: 5
    date:
      name: 'Date picker'
      type: date
      js_options:
        appendText: (yyyy-mm-dd)
        dateFormat: yy-mm-dd
        changeMonth: true
        changeYear: true
        showButtonPanel: true
    datetime:
      name: 'Datetime picker'
      type: datetime
      js_options:
        stepMinute: 15
        showTimepicker: true
    time:
      name: 'Time picker'
      type: time
      js_options:
        stepMinute: 5
        showSecond: true
        stepSecond: 10
    color:
      name: 'Color picker'
      type: color
    checkbox_list:
      name: 'Checkbox list'
      type: 'checkbox_list'
      options:
        value1: Label1
        value2: Label2
    autocomplete:
      name: Autocomplete
      type: autocomplete
      options:
        value1: Label1
        value2: Label2
      size: 30
      clone: false
    email:
      name: Email
      desc: 'Email description'
      type: email
      std: [email protected]
    range:
      name: Range
      desc: 'Range description'
      type: range
      min: 0
      max: 100
      step: 5
      std: 0
    url:
      name: URL
      desc: 'URL description'
      type: url
      std: 'http://google.com'
    oembed:
      name: oEmbed
      desc: 'oEmbed description'
      type: oembed
    select_advanced:
      name: Select
      type: select_advanced
      options:
        value1: Label1
        value2: Label2
      multiple: false
      placeholder: 'Select an Item'
    taxonomy:
      name: Taxonomy
      type: taxonomy
      taxonomy: category
      field_type: checkbox_list
      query_args: {  }
    taxonomy_advanced:
      name: 'Taxonomy Advanced'
      type: taxonomy_advanced
      clone: true
      taxonomy: category
      field_type: select_tree
      query_args: {  }
    pages:
      name: 'Posts (Pages)'
      type: post
      post_type: page
      field_type: select_advanced
      placeholder: 'Select an Item'
      query_args:
        post_status: publish
        posts_per_page: -1
    wysiwyg:
      name: 'WYSIWYG / Rich Text Editor'
      type: wysiwyg
      raw: false
      std: 'WYSIWYG default value'
      options:
        textarea_rows: 4
        teeny: true
        media_buttons: false
    divider1:
      type: divider
    file:
      name: 'File Upload'
      type: file
    file_advanced:
      name: 'File Advanced Upload'
      type: file_advanced
      max_file_uploads: 4
      mime_type: 'application,audio,video'
    imgadv:
      name: 'Image Advanced Upload (Recommended)'
      type: image_advanced
      force_delete: false
      max_file_uploads: 2
      max_status: true
    image_upload:
      name: 'Image Upload'
      type: image_upload
      force_delete: false
      max_file_uploads: 2
      max_status: true
    plupload:
      name: 'Plupload Image (Alias of Image Upload)'
      type: plupload_image
      force_delete: false
      max_file_uploads: 2
      max_status: true
    thickbox:
      name: 'Thickbox Image Upload'
      type: thickbox_image
      force_delete: false
    image:
      name: 'Image Upload'
      type: image
      force_delete: false
      max_file_uploads: 2
    video:
      name: Video
      type: video
      max_file_uploads: 3
      force_delete: false
      max_status: true
    button:
      type: button
      name: 'My button'
    text_list:
      name: 'Text List'
      type: text_list
      options:
        Placehold1: Label1
        Placehold2: Label2
        Placehold3: Label3

Clone this wiki locally