Skip to content

willthemoor/cmb2-metabox-generator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

CMB2 Metabox Code Generator

Use this code generator to generate fully functional CMB2 metaboxes by visually adding fields in the designer or via bulk entry, and save your time and energy.

Demo: CMB2 Metabox Code Generator

New in this fork:

  1. Generated IDs: IDs are auto-generated for each field by making a 'clean' version of the name of the field. So 'My Great Field' becomes 'id' => 'my-great-field'. Might not be perfect but generally saves a lot of typing.

  2. Bulk Entry: Instead of creating fields one by one with the UI, you can insert a list of fields into the bulk entry area with one field per line. Each line should contain the field name, followed by a semi-colon, followed by the field-type. If no field-type is included, text is assumed.

    Example:

Area Headline; text
Area Copy; textarea
Area Logo; file

After entering bulk text, click the '[Generate Fields]' button. This will fill in the lower part of the UI so that you can tweak/add options to specific fields.

3. **Basic support for 'group' fields.**

Combining 2 and 3, you can generate groups via bulk entry by setting a field to 'group' and prepending two dashes to its subfields. This isn't terribly robust—the sub fields need to appear immediately after the group field definition.

Example:

Projects; group
--Project Title; text
--Project Copy; textarea
--Project Contact Name; text
--Project Contact Email; text_email

Pull requests are very welcome. But please remember to send it to development branch.

Packages

No packages published

Languages

  • JavaScript 66.4%
  • HTML 27.6%
  • CSS 6.0%