• Resolved kimdebling

    (@kimdebling)


    I’ve got quite a modified event submission form, and am trying to have a default country selected. I’m modifying the templates via my child theme. I want to take out the ‘none selected’ option and automatically select United Kingdom within the list. I realise it is this code that I need to edit within location.php in the forms/event folder:

    <select id="location-country" name="location_country">
    					<option value="0" <?php echo ( $EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country') == '' ) ? 'selected="selected"':''; ?>><?php _e('none selected','dbem'); ?></option>
    					<?php foreach(em_get_countries() as $country_key => $country_name): ?>
    					<option value="<?php echo $country_key; ?>" <?php echo ( $EM_Location->location_country == $country_key || ($EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country')==$country_key) ) ? 'selected="selected"':''; ?>><?php echo $country_name; ?></option>
    					<?php endforeach; ?>
    				</select><?php echo $required; ?>

    At the moment I have written

    <select id="location-country" name="location_country">
    					<?php foreach(em_get_countries() as $country_key => $country_name): ?>
    					<option value="<?php echo $country_key; ?>" <?php echo ( $EM_Location->location_country == $country_key || ($EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country')==$country_key) ) ? 'selected="selected"':'GB'; ?>><?php echo $country_name; ?></option>
    					<?php endforeach; ?>
    				</select><?php echo $required; ?>

    but the UK option is not showing –

    Could anyone help me to write the correct code here to make it work?

    https://ww.wp.xz.cn/plugins/events-manager/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Setting a default location in location.php Child theme template edit’ is closed to new replies.