Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress: How to integrate the media uploader with a custom meta box field?
    primarykey
    data
    text
    <p>I'm writing a plugin which creates a custom post_type called "dictionary_entry" which has several custom meta boxes and fields. I'd like to add an addition field which allows the custom post author to upload an audio clip.</p> <p>I've done some digging and tried the code offered <a href="https://stackoverflow.com/questions/3249666/wordpress-3-0-custom-post-type-with-upload">here</a> but I can't get it to work.</p> <p>I think one possible answer to my question would be the "type" parameter for fields. I've seen "text", "textarea", "time", "color", "radio", etc. but I haven't been able to find a list of all the possibilities. Is it wishful thinking that there might be a field type: "file" or "upload"?</p> <p>I'm going to skip the code for adding the custom post_type, but here's an example of my code for adding the meta boxes (in case somebody else is trying to use this, remember to use your custom post_type in the 'pages' parameter):</p> <pre><code>//meta box code $meta_boxes = array(); $meta_boxes[] = array( 'id' =&gt; 'examples', // meta box id, unique per meta box 'title' =&gt; 'Examples', // meta box title 'pages' =&gt; array('dictionary_entry'), // post types, accept custom post types as well, default is array('post'); optional 'context' =&gt; 'normal', // where the meta box appear: normal (default), advanced, side; optional 'priority' =&gt; 'high', // order of meta box: high (default), low; optional 'fields' =&gt; array( // list of meta fields array( 'name' =&gt; 'Example 1', // field name 'desc' =&gt; 'Use it in a sentence? EX: Kanien\'kéha kahrónkha.', // field description, optional 'id' =&gt; $prefix . 'example1', // field id, i.e. the meta key 'type' =&gt; 'text', // text box 'std' =&gt; '', // default value, optional 'validate_func' =&gt; 'check_apos' // validate function, created below, inside RW_Meta_Box_Validate class ), array( 'name' =&gt; 'Translation 1', // field name 'desc' =&gt; 'What does the sentence mean? EX: I speak Mohawk.', // field description, optional 'id' =&gt; $prefix . 'ex_translation1', // field id, i.e. the meta key 'type' =&gt; 'text', // text box 'std' =&gt; '', // default value, optional 'validate_func' =&gt; 'check_apos' // validate function, created below, inside RW_Meta_Box_Validate class ) ) ); foreach ($meta_boxes as $metabox) { add_meta_box... //see the codex for add_meta_box() } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload