- This topic has 3 replies, 2 voices, and was last updated 6 years, 11 months ago by
Steve.
Viewing 3 reply threads
-
AuthorPosts
-
-
March 10, 2015 at 4:22 pm #3427
justinMemberWhen I save my custom post type, the select values get duplicated. I start with only one in each section, but after the first save, 2, second save, 4.
I attached an image of what it looks like. Also when the fields get doubled, it removes the two HTML fields I have from view.
<?php /* Title: Details Post Type: trip_reg */ global $typenow; if (is_edit_page('edit') && "trip_reg" == $typenow){ $postid = get_the_ID(); //Event Details $trip_id = get_post_meta( $postid, 'reg_trip', true); $location_id = get_post_meta( $trip_id, 'trip_location', true); $tripbegin = get_post_meta( $trip_id, 'trip_begin', true); $tripend = get_post_meta( $trip_id, 'trip_end', true); //User Details $user_id = get_post_meta( $postid, 'reg_user', true); $user_fname = get_user_meta($user_id, 'first_name' , true); $user_lname = get_user_meta($user_id, 'last_name' , true); $user_email = get_user_meta($user_id, 'user_email' , true); $user_number = get_user_meta($user_id, 'user_number' , true); //Booking Details piklist('field', array( 'type' => 'html' ,'label' => 'Event Details' ,'value' => 'Event: ' . get_the_title( $trip_id ) . '<br />Location: '. get_the_title( $location_id ) . '<br />Dates: ' . $tripbegin . ' - ' . $tripend ,'on_post_status' => array( 'hide' => 'draft' ) )); piklist('field', array( 'type' => 'html' ,'label' => 'Person Details' ,'value' => 'Person: ' . $user_fname . ' ' . $user_lname . '<br />Email: ' . $user_email . '<br />Phone: ' . $user_number ,'on_post_status' => array( 'hide' => 'draft' ) )); $trip_price_array = get_post_meta($trip_id, 'trip_price_type', false); if(in_array("trip_custom", $trip_price_array)) { $key = array_search("trip_custom", $trip_price_array); $trip_custom = get_post_meta($trip_id, 'trip_custom_items', false); unset($trip_price_array[$key]); foreach ($trip_custom[0]['trip_custom_name'] as $customkey => $customname ) { $trip_price_array[]=$customname; } } piklist('field', array( 'type' => 'select' ,'field' => 'reg_trip' ,'label' => 'Mission Trip' ,'choices' => $trip_price_array )); piklist('field', array( 'type' => 'group' ,'field' => 'reg_notes' ,'add_more' => true ,'label' => 'Notes' ,'description' => 'You can add private notes below for internal reference that only team members will see.' ,'fields' => array( array( 'type' => 'text' ,'field' => 'note_author' ,'value' => $current_user->display_name ,'columns' => 3 ,'on_post_status' => array( 'value' => 'approved' ) ) ,array( 'type' => 'text' ,'field' => 'note_date' ,'value' => date("m/d/y") ,'columns' => 2 ,'on_post_status' => array( 'value' => 'approved' ) ) ,array( 'type' => 'textarea' ,'field' => 'note_text' ,'columns' => 7 ,'attributes' => array( 'placeholder' => 'Your Notes' ) ) ) )); //END OF ONLY ON EDIT } function is_edit_page($new_edit = null){ global $pagenow; //make sure we are on the backend if (!is_admin()){ return false;} if($new_edit == "edit"){ return in_array( $pagenow, array( 'post.php', ) ); }elseif($new_edit == "new"){ //check for new post page return in_array( $pagenow, array( 'post-new.php' ) ); }else{ //check for either new or edit return in_array( $pagenow, array( 'post.php', 'post-new.php' ) ); } } ?>Attachments:
You must be logged in to view attached files. -
March 10, 2015 at 4:46 pm #3432
-
March 10, 2015 at 5:11 pm #3433
justinMemberThat is exactly what the problem was. I missed that completely.
-
March 10, 2015 at 9:06 pm #3434
SteveKeymasterClosing ticket.
-
-
AuthorPosts
Viewing 3 reply threads
- The topic ‘Duplicate Select drop downs’ is closed to new replies.