Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

override address_format translation in wp-config.php #128

Open
Cyrille37 opened this issue Dec 24, 2024 · 2 comments
Open

override address_format translation in wp-config.php #128

Cyrille37 opened this issue Dec 24, 2024 · 2 comments

Comments

@Cyrille37
Copy link
Contributor

Hi

Sometimes I need to override the address_format translation like

define('ACF_OSM_I18N_ADDR_STREET','{building} {house_number} {road}');
define('ACF_OSM_I18N_ADDR_CITY','{village} {town} {city}');
define('ACF_OSM_I18N_ADDR_COUNTRY','');

If you agree with this strange feature I'll propose a Pull request to do that ;-)

Regards.

@mcguffin
Copy link
Owner

Thanks, much appreciated!
Why not a filter? Would be more flexible, especially on multi-language sites or multisite installations.
Usage could be:

add_filter('acf_osm_address_format', function($format) {
  return [
    'street'  => '{building} {house_number} {road}',
    'city'    => '{village} {town} {city}',
    'country' => '',
  ];
});

@Cyrille37
Copy link
Contributor Author

Using a filter is nicer for dev but it needs to set a functions.php in a child theme while the wp-config.php solution needs nothing ;-)

If you're agree I'll add the filter solution to my #129 in addition to the wp-config.php one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants