Remove other country

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #13678
    max
    Participant

    Hi,

    How to remove other country that i dont want to display.

    #13732
    wensolutions
    Keymaster

    Hello,

    Actually we are not quite clear about which sections country listing you want the customization. However, to customize the country list please add the below given code in your child theme’s function.php file.

    Please refer to the given link to know more about child theme :https://wptravel.io/how-to-create-a-child-theme/

    Code snippet if you want to remove the country from existing country list (case to remove Afghanistan from the list ) :

    function customize_toremove_countries( $countries ) {
        
        unset( $countries['AF'] );
        return $countries;
    }
    add_filter( 'wp_travel_country_list', 'customize_toremove_countries' );

    Code snippet if you want to create a new country list that overrides existing country list (case to make the country list with only Nepal on the list) :

    function customize_tolimit_countries ( $countries ) {
        $c = array (
            'NP' => __('Nepal' , 'wp-travel')
        );
        return $c;
    }
    add_filter( 'wp_travel_country_list' , 'customize_tolimit_countries');

    Hope this clears your confusion,

    Feel free to reach us for any further query/confusion,

    Regards!!

    #13735
    max
    Participant

    Hi sir,

    It’s ok and keep it for future use because i just set default is Malaysia country.

    Thank

    #13767
    Support Team
    Keymaster

    Hello @max,

    Definitely, you can use the code whenever required.

    Thank you.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘WP Travel’ is closed to new topics and replies.