Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Savvas

    (@savvasha)

    Hi @rodrigomarreiro ,

    SportsPress uses the 3-letter ISO country code as it is easier for the user and the “server” to understand it (https://andrewwhitby.com/2021/01/08/the-right-country-codes/)

    There is public function legacy in class SP_Countries which you can use to convert 2-letter codes to 3-letter. You can find it at /SportsPress/includes/class-sp-countries.php.

    Thanks,
    Savvas

    Thread Starter rodrigomarreiro

    (@rodrigomarreiro)

    Hi, How can I activate the legacy function
    Thanks

    Plugin Contributor Savvas

    (@savvasha)

    You will need some custom code in which you will call the SP_Countries class i.e. $convert_countries = new SP_Countries();
    and then you will use the function legacy() to convert your 2-letter codes to 3-letters codes.
    i.e. `$old_code = ‘ar’;
    $new_code = $convert_contries->legacy( $old_code ); //it will return ‘arg’`

    Thanks,
    Savvas

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Sportspress Country Code’ is closed to new replies.