• Resolved missbritt

    (@missbritt)


    Adding the event ID in context does not make the custom fields appear on the indicated event add to cart form. Instead, it removes it entirely.

    This is how I had the code:

    add_filter( 'mt_custom_fields', 'create_custom_fields', 10, 1 );
    function create_custom_fields( $array ) {
    	// Other fields: sanitize callback; input type; input values; display_callback
    		$array['golf_partners'] = array(
    		'title'=>"FOR GOLFERS - Golf Parnters:",
    		'sanitize_callback'=>'sanitize_callback',
    		'display_callback'=>'display_callback',
    		'input_type'=>'Text',
    		'context'=> '2',
    
    		
    	);
    	$array['game_choice'] = array( 
    		'title'=>"FOR GAMES - Choice of Game", 
    		'sanitize_callback'=>'sanitize_callback', 
    		'display_callback'=>'display_callback',
    		'input_type'=>'select',
    		'input_values'=>array( 'None', 'Bridge', 'Mahjong', 'Canasta' ),
    		'context'=> '2',
    
    	);
    		$array['game_partnerss'] = array(
    		'title'=>"Game Partners:",
    		'sanitize_callback'=>'sanitize_callback',
    		'display_callback'=>'display_callback',
    		'input_type'=>'Text',
    		'context'=> '2',
    
    	);

    2 is what’s listed as ID in My Calendar events.

    If I remove the context line entirely or replace the 2 with ‘global’, the fields show up on all tickets pages.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Joe Dolson

    (@joedolson)

    I’m guessing that you’re not using the right ID. If ‘2’ is the My Calendar ID for the event, then that’s separate from the My Tickets ID for the event. If you look in the My Tickets configuration block in the event, you’ll see a shortcode displayed that looks like [ticket event="234"]. That number is the event ID for My Tickets.

    Thread Starter missbritt

    (@missbritt)

    I can’t believe I didn’t come up with that in all my digging. THANK YOU!!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Context not working for custom fields’ is closed to new replies.