Automatic state

Home Forums Calendar Products Events Calendar PRO Automatic state

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1364288
    365naples
    Participant

    Still wondering why if default state is set it does not stay; for instance, ours if FL and never changes.

    #1364922
    Patricia
    Member

    Hi there,

    Thank you for reaching out to us!

    I’m so sorry to hear that you are having problems with your calendar. Let me help you to solve this!

    This is a known issue that wasn’t fixed by our development team yet, but in the mean time, we have a workaround available.

    Could you please add the following snippet in your theme’s functions.php file? This will help you to solve the problem:

    /* Tribe, set default values for venues in new event page */
    function tribe_set_default_values( ) {
    
    	// bail if we are not in an events page
    	if( !isset($_GET['post_type']) || 'tribe_events' != $_GET['post_type'] ) return false;
    	
    	$screen = get_current_screen();
    
    	// bails if it's not Add Event page
    	if ( 'add' != $screen->action ) return false;
    
    	// bail if PRO is not active
    	if ( !class_exists('Tribe__Events__Pro__Default_Values') ) return false;
    
    	$defaults = new Tribe__Events__Pro__Default_Values;
    
    	$default_city    = $defaults->city();
    	$default_state   = $defaults->state();
    	$default_country = $defaults->country();
    	$default_country = $default_country[1];
    
    	?>
    	
    	<script type="text/javascript">
    		
    		jQuery('document').ready ( function ( $ ) {
    
    			$('input[name="venue[City][]"]'  ).val('<?php echo $default_city; ?>');
    			
    			$('select[name="venue[Country][]"]').val('<?php echo $default_country; ?>');
    			$('select[name="venue[Country][]"]').change();
    
    			$('select[name="venue[State]"]'  ).val('<?php echo $default_state; ?>');
    		});
    
    	</script>
    	
    	<?php
    }
    
    add_action( 'admin_print_footer_scripts', 'tribe_set_default_values' );

    I hope this helps! Let me know if you have any other questions and I’ll be happy to assist!

    Best Regards,

    Patricia

    #1378080
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Automatic state’ is closed to new replies.