Turns out I was making this harder than it needed to be and there are a couple ways to get the information you need.
If you view the custom fields for an existing post, one which already has all these options set, you will see the custom field names (the meta keys.) Some themes/plugins hide these custom fields, but this theme does not. If you don't have a section on your post editing screen called "Custom Fields", find the "Screen Options" pull down up by your name:
http://min.us/mdyuWXP
pull it down, and check the "Custom Fields" box so you will see custom fields in the post editor. This is what I see when looking at a video post made created by using the options in this theme:
http://min.us/m91T2T
These meta keys are the custom fields you're going to need when creating your form. That's one half the information you need. The other half is the possible meta values for these keys. I got that information from looking at the source of the Post Edit screen. I just looked for the drop downs where these options are set and looked at all the possible values. Those values are what you are going to have to allow people to select in your form. You don't want them to type them in, because they need to be exact. So you can use a drop down or multiple choice. (The post editor uses drop down, but I prefer multiple choice here since there's just a small list.)
Here's the source of the post edit screen where you can see the options you need to set (both meta keys and possible meta values.) http://pastebin.com/PqvTScVH
You will see the meta keys on lines 5, 13, 27, 35:
5: wpzoom_post_embed_location
13: wpzoom_post_embed_code
27: wpzoom_post_template
35: wpzoom_post_social
The possible meta values are the < option > items in this code.
- In the middle column
- Before everything else
wpzoom_post_embed_location
- insert paragraph text input into your form
wpzoom_post_embed_code
- Default
- Sidebar on the left
- Full Width (no sidebar)
wpzoom_post_template
wpzoom_post_social
Armed with all that information, you need to create a form with post fields that enable your visitors to select all those options. I would make the fields required, so no information is missing. You can set the default to whichever option you want, so if they do not make a selection, a sensible default still exists.
Some tips for creating your form. Be sure to use Post Fields:
http://minus.com/mceVRLZ
For these four custom fields, you need to use the Custom Field type form field. After you add a Custom Field, select the "Field Type" - there are both Standard and Advanced field types listed here. You could use Drop Down to mimic the post editor exactly, or use Multiple Choice to expose the options right off the bat.
After selecting the Field Type, you will be presented with the option to add the meta values you discovered in the source of the Post Editor. You can use the [Bulk Add / Predefined Choices] button to just paste your options in. Be sure to paste the options in exactly, with no extra markup or spaces and exact capitalization. The theme is not expecting that people will be doing anything other than selecting from a predefined list with the drop downs in the post editor. If you deviate from the expected values, I don't think it will work as expected.
Set the Custom Field Name with the drop down to the meta keys you discovered earlier. If you already have posts on your site created with this theme, the meta keys (Custom Field Names) will already exist, so you can leave the "Existing" radio button checked, then just use the drop down. That will map this form field (and the value submitted) to this Custom Field, just as if you had selected it in the post editor.
Be sure you have a post title and a post body as well. You should be able to get this done by using only Post Body, Post Title and Custom Fields.
I hope that's enough information to get you going. Please post back if you need more assistance or when you have it working.
Posted 13 years ago on Sunday August 7, 2011 |
Permalink