Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter joshant

    (@joshant)

    Yes… Got solution..!!

    Just add the following code in condition.php page
    // add in if_menu_basic_conditions Function()

    $conditions[] = array(
    ‘name’ => __( ‘For US’, ‘if-menu’ ),
    ‘condition’ => ‘if_menu_display_only_india’
    );

    // Add this function below to the page

    function if_menu_display_us() {

    $ip_address=$_SERVER[‘REMOTE_ADDR’];

    /*Get user ip address details with geoplugin.net*/
    $geopluginURL=’http://www.geoplugin.net/php.gp?ip=’.$ip_address;
    $addrDetailsArr = unserialize(file_get_contents($geopluginURL));

    $country_code = $addrDetailsArr[‘geoplugin_countryCode’];

    if( $country_code !=’IN’)
    {
    return true;
    }

    else
    {
    return false;
    }

    }

Viewing 1 replies (of 1 total)