CMB2:

The Metabox Strikes Back

storyftw.com/cmb2-metabox-strikes-back
view presentation on wordpress.tv
Swipe to start

Hello.

I don’t believe we have been introduced.
R2-D2? A pleasure to meet you.
I am C-3PO, Human-Cyborg Relations.

Justin Sternberg:

 

  1. Developer Lead at WebDevStudios

  2. Lead Developer of CMB2

  3. Partner/Developer of Story|FTW

  4. Husband & dad of 3 kiddos

  5. @jtsternberg on twitter

What in the Galactic Empire
is a “CMB2”???

CMB2 is the new generation of
Custom Metaboxes and Fields
(CMB). CMB2 will help you create
metaboxes and forms with
custom fields that will
blow your mind.
mind-blown

But seriously…

 

CMB2 is a developer’s toolkit for adding
fields, and forms to WordPress.

Let me demonstrate.

Post Meta BoxesDocumentation

User ProfilesDocumentation

User Profiles on the FrontendDocumentation

Options PagesDocumentation

FrontendDocumentation

ShortcodesDocumentation

What else??

 

 

 

“Help me, Obi-Wan Kenobi. You’re my only hope.”

What are the benefits over rolling my own?

 

 

“I sense great fear in you, Skywalker. You have hate… you have anger… but you don’t use them.”

Standard framework benefits apply

  1. Bootstrap

  2. Genesis

  3. WordPress

  4. jQuery

Other goods

  1. Useful built-in field types

  2. Who wants to roll their own repeatable fields??

  3. Live oembed previews

  4. Date/time/color pickers

  5. Configuration portability

Documentation

But does it do __________?

“Do. Or do not. There is no try.”

Custom API hook that allows you to create your own field types

  • CMB Attached Posts Field by coreymcollins: Custom field type for attaching posts to a page.
  • CMB Field Type: Google Maps from mustardBees: Custom field type for Google Maps.
  • CMB Field Type: Select2 from mustardBees: Custom field types which use the Select2 script.
Documentation

Configurable field parameters

array(
   'name'            => 'Text Medium',
   'id'              => $prefix .'text_medium',
   'type'            => 'text_medium',
   'sanitization_cb' => 'custom_sanitization_callback',
   'escape_cb'       => 'custom_escaping_callback',
   'repeatable'      => true,
   'attributes'      => array(
       'placeholder' => 'A small amount of text',
       'rows'        => 3,
       'required'    => 'required',
   ),
),
Documentation

Helper Functions:

  • cmb2_metabox_form()
  • cmb2_get_field_value()
  • cmb2_get_oembed()

20 filters
(not including variable filters),
6 actions,
2 custom javascript events,
and at least 10 callback-ready field parameters

Short answer… probably.

“Great, kid. Don’t get cocky”

Other great tools for metaboxes, fields, forms, etc

  1. Developer focused tools
    • HM Custom-Meta-Boxes Meta Boxes for WordPress (humanmade’s fork)

    • Custom Metadata Manager for WordPress

    • Pods

"Traveling through hyperspace ain't like dusting crops, farm boy." — Han Solo

tools continued – user focused

  1. User focused tools
    • Advanced Custom Fields

    • Gravity Forms

    • Pods

WordPress Metadata UI API: The future?

Remember…

the Force will be with you, always.

begin

  • CMB2: The Metabox Strikes Back
  • Who am I?
  • I’m Justin
  • What is CMB2?
  • Developer’s Toolkit
  • Post Meta Boxes
  • User Profiles
  • User Profiles on the Frontend
  • Options Pages
  • Frontend
  • Shortcodes
  • Etc
  • What are the benefits over rolling my own?
  • Standard framework benefits apply
  • Other goods
  • But does it do __________?
  • create your own field types
  • Configurable field parameters
  • Helper Functions
  • Lots of hooks
  • Other great tools for metaboxes, fields, forms, etc
  • tools continued – User Focused Tools
  • WordPress Metadata UI API: The future?
  • Remember…the Force will be with you, always.
Share Tweet
CMB2: The Metabox Strikes Back