Results 1 to 3 of 3

Thread: WP-3.0 - Custom Post Types with Multi-Value fields?

  1. #1
    anca is offline Hello World
    Join Date
    Apr 2010
    Posts
    3

    Default WP-3.0 - Custom Post Types with Multi-Value fields?

    Hello everyone,

    I've been a lurker on here for a bit, and have enjoyed reading the threads.

    For the last couple of weeks, I've been looking at the Custom Post Type features in WordPress 3.0. I'm trying to figure out how to create a custom post type with a multi-value field (e.g. allow a user to enter multiple email addresses (each with a type) into a "profile" Post Type).

    Has anyone tried this? Is it possible?

    Thanks,

    Anca.

  2. #2
    Otto's Avatar
    Otto is offline On The Rocks
    Join Date
    Apr 2009
    Location
    Memphis, TN
    Posts
    865

    Default

    I'm not sure I get the question. Are you asking how to store the resulting data?

    http://codex.wordpress.org/Function_.../add_post_meta

    Usage:
    add_post_meta($post->ID, 'email','whatever@example.com);

  3. #3
    anca is offline Hello World
    Join Date
    Apr 2010
    Posts
    3

    Default

    Hmm, okay, I think I get it. If my field is a complex type (e.g. an array or object) I can just serialize it using add_post_meta. I would write a callback to handle displaying, updating, and deleting different instances of the meta data.

    Thanks,

    Anca.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •