• Resolved Kyle

    (@keduarte)


    Is there a way to default the seach to miles rather than km? I’m in the United States where most people will want to search by miles.

    I’ve found the following code in bps-form-default.php, which I guess I need to modify somehow, but I don’t want to just change the code in the plugin, since it’ll be overwritten when I upgrade the plugin.

    <select name="<?php echo $name.'[units]'; ?>">
    	<option value="km" <?php selected ($value['units'], "km"); ?>><?php echo $km; ?></option>
    	<option value="miles" <?php selected ($value['units'], "miles"); ?>><?php echo $miles; ?></option>
    </select>
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Kyle,

    You can add this code to your bp-custom.php file:

    add_action ('bps_field_before_search_form', 'set_my_defaults');
    function set_my_defaults ($f)
    {
    	if ($f->display == 'distance')
    	{
    		$f->value['units'] = 'miles';
    	}
    }
    
    Thread Starter Kyle

    (@keduarte)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Default to Miles’ is closed to new replies.