Title: Multiple custom fields doesn&#8217;t display correctly
Last modified: December 12, 2016

---

# Multiple custom fields doesn’t display correctly

 *  Resolved [giuze](https://wordpress.org/support/users/giuze/)
 * (@giuze)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/multiple-custom-fields-doesnt-display-correctly/)
 * Hi, I added 3 different custom fields.
    The problem is the display, if you would
   add a line break tag at the end of the line 165 of mt-fields-api.php and include
   the fields as new paragraph on line 169, it would then take same style as the
   other tickets fields.
 * Line 165: $fields .= “<label for=’$name’>” . $field[‘title’] . “</label> ” . 
   $output . “</br>”;
    Line 169: return “<p>” . $fields . “</p>”;
 * I didn’t found a good way in the css to make them appear nicely, there’s always
   this line break missing.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Joe Dolson](https://wordpress.org/support/users/joedolson/)
 * (@joedolson)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/multiple-custom-fields-doesnt-display-correctly/#post-8545315)
 * What is the code you’re using to add your custom fields?
 *  Thread Starter [giuze](https://wordpress.org/support/users/giuze/)
 * (@giuze)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/multiple-custom-fields-doesnt-display-correctly/#post-8545330)
 * Hi, This is what’s included
 *     ```
       /*
        * Add custom fields to each add to cart form. 
        */
       add_filter( 'mt_custom_fields', 'create_custom_fields', 10, 3 );
       function create_custom_fields( $array ) {
       	// Other fields: sanitize callback; input type; input values; display_callback
       	$array['food_pref'] = array( 
       		'title'=>"Food preferences", 
       		'sanitize_callback'=>'sanitize_callback', 
       		'display_callback'=>'display_callback',
       		'input_type'=>'select',
       		'input_values'=>array( 'I eat all ', 'No meat ', 'No Fish ', 'Vegan ' ),
       		'context'=> '309'
       	);
       	/**
       	 * Add a second custom field by adding more values to the array
       	 *
       	 */
       	 $array['other'] = array( 
       		'title'=>"Other or allergy", 
       		'sanitize_callback'=>'sanitize_callback', 
       		'display_callback'=>'display_callback',
       		'input_type'=>'textarea',
       		'context'=> '309'
       	);
       	/**
       	 * Add a third custom field by adding more values to the array
       	 *
       	 */
       	 $array['presence'] = array( 
       		'title'=>"Will you miss some of the nights? (which one)", 
       		'sanitize_callback'=>'sanitize_callback', 
       		'display_callback'=>'display_callback',
       		'input_type'=>'textarea',
       		'context'=> '309'
       	);
       	return $array;
       }
   
       /* This display callback is used to format the saved data. $context is either 'payment' or 'cart', depending on whether it's appearing in an admin payment record or in the user's cart. */
       function display_callback( $data, $context='payment' ) {
       	return urldecode( $data );
       }
   
       /* This sanitize callback is used to sanitize the data before it's saved to the DB */
       function sanitize_callback( $data ) {
       	return esc_sql( $data );
       }
       ```
   
 *  Plugin Author [Joe Dolson](https://wordpress.org/support/users/joedolson/)
 * (@joedolson)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/multiple-custom-fields-doesnt-display-correctly/#post-8545412)
 * Got it; thanks. I’ll look at what I want to do in the next release.
 *  Thread Starter [giuze](https://wordpress.org/support/users/giuze/)
 * (@giuze)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/multiple-custom-fields-doesnt-display-correctly/#post-8545422)
 * Thanks
 *  Plugin Author [Joe Dolson](https://wordpress.org/support/users/joedolson/)
 * (@joedolson)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/multiple-custom-fields-doesnt-display-correctly/#post-8548812)
 * Modified in version 1.4.11. It’s not the same as what you did, but it’s what 
   I felt would work best for my goals.
 *  Thread Starter [giuze](https://wordpress.org/support/users/giuze/)
 * (@giuze)
 * [9 years, 5 months ago](https://wordpress.org/support/topic/multiple-custom-fields-doesnt-display-correctly/#post-8549301)
 * Hi, it works well even without having to edit my CSS.
    Thanks for the modification

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Multiple custom fields doesn’t display correctly’ is closed to new replies.

 * ![](https://ps.w.org/my-tickets/assets/icon-256x256.png?rev=1097581)
 * [My Tickets - Accessible Event Ticketing](https://wordpress.org/plugins/my-tickets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/my-tickets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/my-tickets/)
 * [Active Topics](https://wordpress.org/support/plugin/my-tickets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/my-tickets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/my-tickets/reviews/)

## Tags

 * [aspect](https://wordpress.org/support/topic-tag/aspect/)
 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * 6 replies
 * 2 participants
 * Last reply from: [giuze](https://wordpress.org/support/users/giuze/)
 * Last activity: [9 years, 5 months ago](https://wordpress.org/support/topic/multiple-custom-fields-doesnt-display-correctly/#post-8549301)
 * Status: resolved