WordPress.org

Ready to get started?Download WordPress

Forums

custom post type with custom attributes/parameters? (6 posts)

  1. netslacker
    Member
    Posted 3 years ago #

    Is there a way, or can someone point me to a how-to, that will allow me to add custom post fields to a custom post type? Similar to custom-fields but more explicit with their own label and input field.

    In other words, within the admin UI I can create a custom post type of say "Product." When I add a product (Add New) in addition to title, media, and content fields I'd like fields with labels of "Price," "Sell Price," "Quantity on hand," "Manufacturer," "Model Number," ... etc. but WITHOUT using the custom-fields way of entering these values. Using custom fields under the covers is fine, but I'd like a cleaner way of entering their values that isn't so tedious as the current UI is for custom fields. I'd really like it to be within the UI for each of the parameters.

    Any help is appreciated!

  2. davidandre
    Member
    Posted 3 years ago #

    Hi,
    you could use tags or may be have a look on taxonomy stuff

  3. netslacker
    Member
    Posted 3 years ago #

    I think the custom fields is the right place holder for the information, I just don't like the way in which custom fields are entered and updated. I'd like to change the custom fields to actual input fields with their own labels so that it's not so tedious to enter data or use the custom fields.

    Tags, Cats and Taxonomy stuff appears to be a single attribute applied to many posts. I'm looking for a single attribute type applied to a single post but with different data.

  4. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    http://codex.wordpress.org/Function_Reference/add_meta_box

    You want add meta box.... uses custom fields, but with proper input boxes

    There are many tutorials aroudn google for getting them set up, I found plenty of useful info

    Here's a link to code I use to add meta boxes, if you want to poke at it...
    http://wordpress.pastebin.com/1u1eLNEm
    It basically adds my meta boxes action,

    Has 2 different add meta boxes lines, one for normal posts, one for ve_members post type, each has a callback to its function

    Then sets up the custom fields, saves them, etc.

    The underscore _ before the custom fields names keeps them hidden (They don't show up in the normal 'custom fields' area, they are just used by my meta boxes

  5. netslacker
    Member
    Posted 3 years ago #

    Thanks Voodoo, that is what I was looking for. I had found the add_meta_box hook just a few minutes ago and the link didn't have any content. So I was just starting to explore that hook a bit more.

  6. Rev. Voodoo
    Volunteer Moderator
    Posted 3 years ago #

    Sure. I only very recently started using it myself. Love it! Very cool, opens up a lot of possibilities

Topic Closed

This topic has been closed to new replies.

About this Topic