• Resolved josh_fester

    (@josh_fester)


    I’m very new to CMB2 and trying to understand the best way to implement a frontend form. The HTML for the form needs to be highly customized, and the form will include fields from both custom meta boxes and standard user profile fields. Is there a way to build a template, include fields individually via some CMB2 function, and then make some kind of submission handler in CMB2? Thanks!

    https://ww.wp.xz.cn/plugins/cmb2/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Justin Sternberg

    (@jtsternberg)

    Yes, there are ways you could handle that, though it’s definitely a very specific use-case and will require you to get your hands dirty digging through core.

    You’ll likely need a combination of what is in the cmb2_print_metabox_form function and the show_form method. CMB2 has a LOT of hooks, so you may not even need to create your own form markup but rather hook in at certain places.

    Plugin Author Justin Sternberg

    (@jtsternberg)

    As for creating the handler, the tutorial post you originally commented on is going to be your best bet for figuring out how to manipulate that data, though you’ll need to modify quite a bit to do what you’re talking about.

    Thread Starter josh_fester

    (@josh_fester)

    Thanks for pointing me in the right direction Justin. It’s probably beyond the scope of CMB2, but I feel like this use case is incredibly common. I’ve never built a site where an overly simplified, unstyled form would be acceptable. Maybe I’ll put my abstractions into a plugin that extends CMB2.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Frontend form with custom HTML layout’ is closed to new replies.