根据内容量,您有2个选项:
如果某个国家的特定内容及其大量用户需要按国家/地区分开,请创建一个多网站,即每个国家/地区的网站:
|-yoursite.com
|
|--chile.yoursite.com
|
|--argentina.yoursite.com
|
|--mexico.yoursite.com
如果每个国家的具体内容不多,请使用一个值(类别、标记、自定义字段等),因此当他们选择阿根廷时,只会显示值为“阿根廷”的内容。
Custom Field
示例:
<?php
$country_val = get_post_meta($post->ID, "country", true);
$selected_country = "arg"; //get this from session or user?? cookie?
if(!empty($country_val)){
//there is a country value
//we check if the country of the content is the same as the selected
if($country_val == $selected_country){
echo "This is content specific and for the selected country!!";
}
}else{
echo "This is Content for all, since it doesnt have a country value";
}
?>