mustardBees/cmb_field_map

front end : add cmd_field_map to an address field

leowski opened this issue · 5 comments

Hi guys!
Great plugin mustardBees, I use it on all my wordpress projects related to an address somehow.

For my current project, I need people to add a custom post type object via the front-end.
They'll be able to add their car for rent online. I'd love to use your plugin in this front-end part as well so the user can select his address easily.

How can I do that?
Thanks!

Hi @leowski! I’m glad you’re making use of this plugin.

How are you building your front end form?

If you’re using CMB2’s "Bringing Metaboxes to the Front End” method, although untested, this field should work. Let me know if there are any issues.

If you’re writing something bespoke then feel free to pick apart this field for your specific use case.

Thanks for your quick answer!
That's what I thought. I already tried this solution without any success but it's not due to your plugin, I just can't display any metabox in my front end template.

I'm apparently missing something.

or should do the job right?

There is this note in the documentation:

Note: If you use cmb2_admin_init, like in the example_functions.php file, to register your metaboxes, they will not be available on the front end. Use cmb2_init instead.

Yeah I did checked this and I'm using "cmb2_init"

Where are you placing the form? You might need to specify the second parameter ($object_id) of cmb2_metabox_form(). Just thinking about the current page context, CMB2 takes the current post ID if it's not specified. Mind you, I'd expect to see the form either way :)

Without the rest of your code, it’s difficult to troubleshoot further! Let me know how you get on.