Sometimes, we need to show list of countries in custom form or in simple page. Writing each country name in file is very tedious. If we have installed gravity form in our site then we can create and show dropdown of countries easily with help of gravity form plugin.
In gravity form plugin, there is a class GF_Field_Address in which address fields are created. In this class there is a function get_countries that returns the arrray of countries added in gravity form. We can use this class and method to create our country dropdown in custom form which is not a gravity form.