Is there a way to tell which country you are in when viewing the site? I mean like is the domain name example.uk | example.ca | example.com/en … That kinda thing?
Then you could search your domain for the string for that country:
$protocol = stripos($_SERVER['SERVER_PROTOCOL'],'https') === true ? 'https://' : 'http://';
$url = $protocol . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
if (strpos($url,'/en/') !== false) {
echo 'English version';
} else if (strpos($url,'/us/') !== false) {
echo 'US version';
} else {
echo 'Not UK or US Version';
}
Related Posts:
- How to add a custom field in the advanced menu properties?
- Adding a custom field to the site identity menu
- Add meta data to the menu
- Create a select drop down of available menus
- Dynamic User State & City selection
- Creating a custom menu/widget area
- Nav Menu – Add class based on meta keys
- Add image to menu item with ACF
- Declaring in variables [closed]
- How to add a custom field in the advanced menu properties?
- Walker class for sub-menu with ACF fields
- Populate wordpress menu with link to custom field value (file download)
- Show Custom field value instead of title in WP Menu
- How to check custom fields from functions.php
- Override edit_custom_walker.php to conditionally show input depending on menu position
- How to use page metadata while using wp_list_pages()?
- Add custom fields to specific menus
- Add CSS class to posts with certain meta key
- Underscores in custom fields
- Add custom field to the archive page?
- Show only posts which can be commented OR have custom meta field
- Need small coding with Custom Fields Search
- Adding Custom Field to Taxonomy Input :Panel
- How can I remove fields in the attachment editor?
- Unable to get Preview of Uploaded image within a Custom Meta box
- Edit Custom Database Tables in WordPress
- How to store the value of a custom field dropdown select for post referencing?
- Custom bulk action for media gallery items
- Change content before writing to database
- post meta data clearing on autosave
- WordPress Search Custom Meta Field Only
- Localized Date Format for Custom Field
- Which is best in the following scenario : post_meta vs custom table vs parent/child posts
- Saving custom image meta fields
- Echo values from custom field outside loop php
- How to add content at the end of posts?
- Transfer self made functions.php custom fields to Advanced Custom Fields [closed]
- Complex WP_User_Query call fails on production server
- Query post order by post and desc not working
- wordpress custom fields multiple data
- How do I define post titles as images using Custom Fields?
- How to show Small Box Inside Content Area, which holds (text, images, links)?
- Sort custom field by post
- How to create a gallery custom field for WordPress post?
- Why the pagination for a query modified by pre_get_posts doesn’t mind the number & order of posts sorted & selected based on a custom date time field
- Trying to update_post_meta function
- How do i add custom fields to my themes template file?
- Custom Field to a Role?
- List users by sum of all their posts’ custom field values
- Duplicate (or more) custom fields on many posts. Is there an easy way to clean them up?
- How to pass page as an argument like post in WordPress?
- Custom fields issue [closed]
- Select custom posts by meta_value and sort by a different meta value
- Front end register with custom fields
- Display custom field from the front page on another page
- Enable a short code in the custom meta field
- Gravity Forms Update post meta from template [closed]
- Automatic linking terms
- Adding extra fields to front end signup form
- Problem uploading different files as custom fields with front end post form
- How to change order of posts in admin
- Custom product fields in wp e-Commerce plugin [closed]
- make a dropdown custom field with ‘cities’ list in it
- How can I modify my meta_query to work with prices that are stored in the database that contain dollar signs and commas?
- How to add extra field in admin comment section
- wordpress multi user question
- Get Custom Field Name ( Label or Key ) Not Value
- Custom field on Quick Edit using select/dropdown – almost working right but not showing currently selected value
- Type character in name and make it invisble
- How to set up page fields with gutenberg instead of ACF
- Adding Custom Metadata to my Archive/Posts page
- Move the post title to another field
- ACF multi taxonomy on filterable gallery
- Ordering by ACF custom field vaule
- Custom user registration fields in user_register hook
- Unable to change checkout placeholder text
- add meta box considers the selected option as post parent
- Custom fields multiple commas separated values
- How do I display a custom field in an existing form on the front end?
- Add custom field information to source meta data
- How to save array option as text and not integer?
- Delete custom meta
- Extend WP_User_Query or WP_User to return all custom fields?
- Quicktag button to automatically add a custom field to a post
- Display custom fields only if it has a value
- WordPress taxonomy child image
- Create custom fields/meta data gender+country – radiobuttons and dropdown on register screen for these fields
- Add nofollow to custom field link and make domain exceptions?
- wordpress simple post multi rating with post_meta and user_meta
- Custom fields are not displaying in page with multiple loops
- Add class from custom field into widget class
- Download stuff after filling fields?
- Get multiple posts with some custom fields efficient
- Adding custom field to Lightbox in header only pulls current page data, not Lightbox item data
- Meta boxes not displayed, data isn’t being saved
- Custom fields / meta box output
- Custom registration form and custom field
- Get single image from custom fields made with WCK custom fields creator
- How to add google map to custom field
- How can i put a custom field inside this php