Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Last active March 23, 2016 13:26
Show Gist options
  • Save propertyhive/6a79ac0117410244ecd3 to your computer and use it in GitHub Desktop.
Save propertyhive/6a79ac0117410244ecd3 to your computer and use it in GitHub Desktop.
Add location field to PropertyHive search form
add_filter( 'propertyhive_search_form_fields_default', 'update_ph_search_form_fields', 10, 1 );
function update_ph_search_form_fields($fields)
{
$department_field = $fields['department'];
unset( $fields['department'] );
$fields = array_reverse($fields, true);
$fields['address_keyword'] = array(
'type' => 'text',
'label' => __( 'Location', 'propertyhive' ),
'before' => '<div class="control control-address_keyword">',
'placeholder' => __( 'Enter Location', 'propertyhive' ),
);
$fields['department'] = $department_field;
$fields = array_reverse($fields, true);
return $fields;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment