This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Remove product-category slug | |
Plugin URI: https://timersys.com/ | |
Description: Check if url slug matches a woocommerce product category and use it instead | |
Version: 0.1 | |
Author: Timersys | |
License: GPLv2 or later | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('geot/dropdown_widget/countries', function($countries) { | |
foreach( $countries as $i => $c ) { | |
if( $c->iso_code == 'US' ) { | |
$countries[$i]->country = 'USA'; | |
} | |
if( $c->iso_code == 'GB' ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add this file in the wp-content/mu-plugins/ folder. If the folder doesn't exist simply create it. | |
* Uncomment the line for you builder and comment out the rest | |
**/ | |
add_filter( 'geot/deactivate_divi_integration', '__return_true' ); | |
//add_filter( 'geot/deactivate_beaver_integration', '__return_true' ); | |
//add_filter( 'geot/deactivate_elementor_integration', '__return_true' ); | |
//add_filter( 'geot/deactivate_fusion_integration', '__return_true' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// geot_user_country | |
// Return object of current user country details | |
$country = geot_user_country(); | |
echo $country->name; | |
echo $country->isoCode; | |
//geot_country_code | |
// return current user country code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Allow users to change location with query string like this | |
* https://yourdomain.com?geot_country=US | |
**/ | |
add_action( 'init', 'change_geolocation_with_url' ); | |
function change_geolocation_with_url(){ | |
if( ! isset( $_GET['geot_country'] ) ) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* geot_target() | |
* | |
* Main function that return true or false depending if current user | |
* target the given countries | |
* | |
* @param string/Array $country - Pass an array of countries ,country name or country code | |
* @param string $country_region - Region name | |
* @param string $exclude/Array -Pass an array of countries ,country name or country code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* The following code serves as an example and could be copied over to your theme's functions.php file | |
* Ideally you want to separate your javascript files and load them separatly. | |
* This example it's based on the following HTML structure: | |
* <a href="#" data-iso="US" class="geot-countries">United States</a> - <a href="#" data-iso="AR" class="geot-countries">Argentina</a> | |
*/ | |
add_action('wp_footer', 'my_custom_geot_widget' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class GeotWP_Url_Location { | |
public function __construct() { | |
add_filter( 'geot/cancel_query', [ $this, 'set_custom_data' ] ); | |
} | |
/** | |
* Check if url is set and modify data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpse159536_override_mofile_path( $mofile, $domain ){ | |
if( 'geot' == $domain ){ | |
$mofile = WP_LANG_DIR . '/plugins/' . basename( $mofile ); | |
} | |
return $mofile; | |
} | |
add_filter( 'load_textdomain_mofile', 'wpse159536_override_mofile_path', 10, 2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on('geotwp_ajax_success', function(e, data) { | |
if( typeof data.geo != 'undefined') { | |
// create a custom cookie with zip value and 999 days duration | |
GeotCreateCookie('geot_switcher', data.geo.city.data.zip, 999); | |
// Add a marker in a custom google map | |
if( data.geo.geolocation.data.latitude && data.geo.geolocation.data.longitude && jQuery('#geot-map').length != 0 ) { | |
var stanton = {lat: parseFloat(data.geo.geolocation.data.latitude), lng: parseFloat(data.geo.geolocation.data.longitude)}; | |
add_marker(stanton); | |
} |
NewerOlder