Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • in reply to: Multiselect Field does not work? #2571
    prasenjit
    Member

    Yes it does. You need to rectify your tutorial

    As given in the tutorial:

    'attributes' => array(
      'multiple'
    )

    and the correct code should be (taken from field-multiselect.php under demos):

    'attributes' => array(
      'multiple' => 'multiple'
    )

    Also @Steve is there any plans of integrating Select2 or Chosen fields? If not, then a tutorial about creating new field types would be of great help.

    in reply to: How can I post custom post types programmatically? #2531
    prasenjit
    Member

    Hi @Steve,

    Here is something that I usually do:

    // insert the post and set the category
    $post_id = wp_insert_post(array (
        'post_type' => 'my_post_type',
        'post_title' => $my_title,
        'post_content' => $my_content,
        'post_status' => 'publish',
        'comment_status' => 'closed',   // if you prefer
        'ping_status' => 'closed',      // if you prefer
    ));
    
    if ($post_id) {
        // insert post meta
        add_post_meta($post_id, '_my_custom_1', $custom1);
        add_post_meta($post_id, '_my_custom_2', $custom2);
        add_post_meta($post_id, '_my_custom_3', $custom3);
    }

    Is there any helper function to do this in piklist? Especially with repeatable fields?

    -prasenjit.

Viewing 2 posts - 1 through 2 (of 2 total)