Hi,
you can make the location required by adding the code below in your theme functions.php file
add_filter( "adverts_form_load", "require_location_adverts_add" );
function require_location_adverts_add( $form ) {
if( $form['name'] != "advert" ) {
return $form;
}
foreach( $form["field"] as $key => $field ) {
if( $field["name"] == "adverts_location" ) {
$form["field"][$key]["is_required"] = true;
$form["field"][$key]["validator"][] = array( "name" => "is_required" )
}
}
return $form;
}
When trying to add the code I get the following error:
Los cambios en tu código PHP se han revertido debido a un error en la línea 9690 del archivo wp-content/themes/Divi/functions.php. Por favor, arréglalo y trata de guardar de nuevo.
syntax error, unexpected ‘}’
The error is in this line ⇨⇨⇨ }
}
return $form;
}
In the code change array( "name" => "is_required" ) to array( "name" => "is_required" );