Home › Forums › Calendar Products › Events Calendar PRO › Short Country format
- This topic has 6 replies, 3 voices, and was last updated 8 years, 10 months ago by Support Droid.
-
AuthorPosts
-
April 25, 2013 at 8:33 am #46823TinekeParticipant
hi there,
In another (closed) discussion I saw Barry saying the following on getting a short country format:
“I don’t believe there are any specific filters for that template tag; you could use tribe_get_event_meta but that’s further upstream.
Do note however that tribe_get_country() returns its output rather than echoing it, so you could easily filter it yourself by creating a new template tag of your own which converts tribe_get_country()’s output to an abbreviated format (whether that’s ISO 3166 or some other scheme).”I was wondering if someone could explain me how to do this?
April 25, 2013 at 2:53 pm #46878BarryMemberIf you take a look at this snippet you should get an idea of how you might do this – per the comments it isn’t the very neatest way of doing this, especially if you are likely to be processing a wide range of countries, but it should give you a starting point if nothing else.
If you haven’t done so already, take a look at our Themer’s Guide (link in the Useful Resources section on the right) for a primer on how to customize and override templates.
Cheers!
April 26, 2013 at 7:20 am #46926TinekeParticipantThanks Barry. But I wasn’t looking to change it everywhere. Just in list.php where I have this:
$country = tribe_get_country(); if ( !empty( $country ) ) : echo $country; endif;April 26, 2013 at 8:18 am #46929TinekeParticipantI just solved it with this (which is not a full list):
April 26, 2013 at 8:18 am #46930TinekeParticipant$country = tribe_get_country();
if ($country==”Netherlands”) {
echo “NL” ;
} elseif ($country==”Denmark”) {
echo “DK”;
} elseif ($country==”Afghanistan”) {
echo “AF”;
} elseif ($country==”Denmark”) {
echo “DK”;
} elseif ($country==”Argentina”) {
echo “AR”;
} elseif ($country==”Australia”) {
echo “AU”;
} elseif ($country==”Austria”) {
echo “AT”;
} elseif ($country==”Belgium”) {
echo “BE”;
} elseif ($country==”Brazil”) {
echo “BR”;
} elseif ($country==”Bulgaria”) {
echo “BG”;
} elseif ($country==”Canada”) {
echo “CA”;
} elseif ($country==”Chile”) {
echo “CL”;
} elseif ($country==”China”) {
echo “CN”;
} elseif ($country==”Colombia”) {
echo “CO”;
} elseif ($country==”Czech Republic”) {
echo “CZ”;
} elseif ($country==”Denmark”) {
echo “DK”;
} elseif ($country==”France”) {
echo “F”;
} elseif ($country==”Germany”) {
echo “DE”;
} elseif ($country==”Greece”) {
echo “GR”;
} elseif ($country==”Italy”) {
echo “IT”;
} elseif ($country==”Japan”) {
echo “JP”;
} elseif ($country==”Luxembourg”) {
echo “LU”;
} elseif ($country==”Luxembourg”) {
echo “ZA”;
} elseif ($country==”Spain”) {
echo “ES”;
} elseif ($country==”South Africa”) {
echo “LU”;
} elseif ($country==”Suriname”) {
echo “SR”;
} elseif ($country==”Sweden”) {
echo “SE”;
} elseif ($country==”Switzerland”) {
echo “CH”;
} elseif ($country==”United Arab Emirates”) {
echo “UAE”;
} elseif ($country==”United States”) {
echo “US”;
} elseif ($country==”United States”) {
echo “US”;
} elseif ($country==”Venezuela”) {
echo “VE”;
} else {
echo tribe_get_country();
}April 26, 2013 at 12:28 pm #46954BarryMemberExcellent, glad you’re all sorted 🙂
July 7, 2015 at 6:26 am #979003Support DroidKeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Short Country format’ is closed to new replies.