• Resolved fimo66

    (@fimo66)


    Hi,
    I am a new user of this plugin and was wondering if its possible to shorten the list with
    country names new users can choose from ie just 2 or 3 countries ?

    Or is it possible for me “admin” to choose my 2 or 3 default countries which would be on top of the list with country names ?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi @fimo66,

    If you can make it a bit clear then I will be able to help you. Let me know if you want only 2 or 3 countries in the list or you want all other countries with 2 or 3 countries on the top of the list. Also, let me know the names of those countries which you want to use.
    Do let me know and I will get back to you.

    Regards!

    Thread Starter fimo66

    (@fimo66)

    Hi again,
    Thanks for the reply,help,
    I would like 2 countries in my list:
    Danmark
    Sverige
    Is that possible ?
    thank you for your help…

    Thread Starter fimo66

    (@fimo66)

    I prefer that it only shows those 2 countries if that is possible if not perhaps its possible to have those 2 on top of the list with all the countries ?

    Deepak Sharma

    (@sharmadpk03)

    Hi @fimo66,

    Apologies for getting back to you late. Please copy the code below and paste it in your active theme functions.php file at the bottom of the file. It will then show the specific country in the country field.
    Here is the code

    
    //Display a specific country in the dropdown of country********
    add_filter( 'user_registration_countries_list', 'display_specific_only' );
    function display_specific_only( $country_list ) {
    $country_list = array( 'SE' => __( 'Sweden', 'user-registration' ), 'DK' => __( 'Denmark', 'user-registration' ) );
    return $country_list;
    }
    

    Let me know if there are any issues.

    Regards!

    • This reply was modified 5 years ago by Marius L. J.. Reason: Added code tags for readability
    Thread Starter fimo66

    (@fimo66)

    Hi again,

    Thanks for the answer. the code, im using theme “twentysixteen” and tried to copy,paste
    the above code into my themes functions.php , refresed the cache but i still see all of the countries in the drop down menu, perhaps i am missing something, im doing something wrong ?

    View post on imgur.com

    Thread Starter fimo66

    (@fimo66)

    Thanks for the answer i have made a request to the support team now and hopefully they can help me futher to what im doing wrong with this above code

    • This reply was modified 5 years ago by fimo66.
    Thread Starter fimo66

    (@fimo66)

    Just for info, i got the correct code here and a great support from your team,
    thank you for this plugin, support

    
    //Display a specific country in the dropdown of country********
    add_filter( 'user_registration_countries_list', 'display_specific_only' );
    function display_specific_only( $country_list ) {
    $country_list = array( '' => '--Select--', 'SE' => __( 'Sweden', 'user-registration' ), 'DK' => __( 'Denmark', 'user-registration' ) );
    return $country_list;
    }
    
    • This reply was modified 5 years ago by Marius L. J.. Reason: Added code tags for readability
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘country’ is closed to new replies.