Add Form Elements to a Form for Post Meta needed by other Plugins or Custom Post Types
BuddyForms supports your Existing Custom Post Type from any Plugin or Theme
Not only plugins create custom post types. Many themes include there own post types like portfolio, magazine or showcase.
In most cases the plugin or theme needs there own custom fields ( post meta ) to work correctly. Most of the time they add there own post meta box to the edit screen to collect data.
If you want to enable front end submission we need to add the required form elements to our form. In this documentation you will learn how to find the relevant post meta and create the form elements.
Use the Custom Field Name as Form Element Slug
BuddyForms use the form element slug to determine the correct post meta. If you want to save data of an existing post meta field make sure you use the custom field name as slug
Example
If the custom field name is 'address' your BuddyForms form element slug needs to be 'address'.
How to Find the Custom Fields (post meta)
There are different ways to find out the custom fields ( post meta ) name. The easiest way is to go to the create/edit screen in the WordPress admin dashboard and look over the custom fields section. To display the custom field section, click on the screen options and select 'Custom Fields'. The custom fields sections will be displayed under your post editor.
Find Hidden Custom Fields
Sometimes the custom fields are hidden. If a custom field is hidden, it will not get displayed in the custom field section. A custom field is hidden, if an underscore is added before the name. Often plugins or themes hide there custom fields from the custom fields section and only allow to display it in there custom meta box.
In this case we need to find the field name in the html. This can be done by inspecting the html of the element and find out the name attributes.
All major browsers Chrome, Firefox, and Safari do have an inspector. You can click on the form element with the right click and select inspect. The inspector will become visible and you can see the input form element and find the name attribute.
Use the Name in the Form Element
In this documentation I assume you already have create a form and know how to add form elements. If not, please read this Documentation
Make sure you have the correct form element type selected. Use the custom field name as slug in your form element. This will make sure the data will be stored in the correct post meta needed from your plugin or theme.