2014-12-12 3 views
0

WordPress를 사용하여 게임과 앱을 게시하고 있습니다. 이제는 게시 할 국가를 찾아야합니다.URL에 매개 변수를 항상 추가하십시오. WordPress

처럼 URL에 기본 매개 변수를 추가 할 수있는 방법이 있습니까 :

http://demo.com/?geo=VN

http://demo.com/?category/games/?geo=VN

+0

수단 : 그것은의 모양은

? 문제의 적절한 설명을하십시오. –

+0

방문자가 내 사이트를 방문 할 때. 현재 URL에 지역 매개 변수를 추가하여 앱 및 게임을로드 할 국가를 감지하고 싶습니다. – skylarkcob

답변

0

당신은 geoplugin 같은 플러그인을 사용할 수 있습니다.

색인에 필요한 코드를 추가하기 만하면 작동합니다.

<?php 
require_once('geoplugin.class.php'); 
$geoplugin = new geoPlugin(); 
$geoplugin->locate(); 
// create a variable for the country code 
$var_country_code = $geoplugin->countryCode; 
// redirect based on country code: 
if ($var_country_code == "VN") { 
header('Location: http://demo.com/?geo=VN'); 
} 
else if ($var_country_code == "AU") { 
header('Location: http://demo.com/?geo=AU'); 
} 
else { 
header('Location: http://demo.com/'); 
} 
?> 
+0

답장을 보내 주셔서 감사합니다. – skylarkcob

관련 문제