Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7066765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:07:12+00:00 2026-05-28T05:07:12+00:00

I’m writing a plugin which creates a custom post_type called dictionary_entry which has several

  • 0

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.

I’ve done some digging and tried the code offered here but I can’t get it to work.

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”?

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):

//meta box code

$meta_boxes = array();

$meta_boxes[] = array(
'id' => 'examples',                         // meta box         id, unique per meta box
'title' => 'Examples',          // meta box title
'pages' => array('dictionary_entry'),   // post types, accept custom post types as well, default is array('post'); optional
'context' => 'normal',                      // where the meta box appear: normal (default), advanced, side; optional
'priority' => 'high',                       // order of meta box: high (default), low; optional

'fields' => array(                          // list of meta fields

    array(
        'name' => 'Example 1',                  // field name
        'desc' => 'Use it in a sentence? EX: Kanien\'kéha kahrónkha.',  // field description, optional
        'id' => $prefix . 'example1',               // field id, i.e. the meta key
        'type' => 'text',                       // text box
        'std' => '',                    // default value, optional
        'validate_func' => 'check_apos'         // validate function, created below, inside RW_Meta_Box_Validate class
    ),

    array(
        'name' => 'Translation 1',                  // field name
        'desc' => 'What does the sentence mean? EX: I speak Mohawk.',   // field description, optional
        'id' => $prefix . 'ex_translation1',                // field id, i.e. the meta key
        'type' => 'text',                       // text box
        'std' => '',                    // default value, optional
        'validate_func' => '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()
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:07:13+00:00Added an answer on May 28, 2026 at 5:07 am

    I figured out how to do this by digging into the code found here. If you take a look, you’ll recognize parts of my code quoted above. I was originally using this class, but didn’t fully realize it. It’s a custom class which can be called to add various meta boxes / fields.

    It turns out that the “type” parameter I was wondering about actually belongs to this Class (as opposed to the WordPress API) and that it does allow for a type: ‘file’ which brings up a default file picker window (not the built-in media uploader). For my purposes this is okay, because I don’t need all the slick options.

    If you’re reading this, you’ve probably already googled this question and seen a wide variety of posts that partially explain how to do this. For what it’s worth, I found this to be the easiest way to add this functionality that ALSO works for custom post_types (without a fair amount of hacking). I hope this is useful to someone else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.