Skip to content

Instantly share code, notes, and snippets.

View Fitoussi's full-sized avatar

Eyal Fitoussi Fitoussi

View GitHub Profile
@Fitoussi
Fitoussi / gfgeodisableautofill.php
Last active June 25, 2020 23:01
Gravity Geolocation - Prevent address autofill
function gfgeo_disable_adderss_field_autofill() {
?>
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
jQuery( '.gfgeo-address-field' ).attr( 'autocomplete', 'gfgeo-address-field' );
});
</script>
<?php
}
add_action( 'wp_footer', 'gfgeo_disable_adderss_field_autofill' );
@Fitoussi
Fitoussi / gmw-dropdown-taxonomy-args
Last active November 30, 2018 03:50
Arguments for GEOm y WP dropdown taxonomy function.
$args = array(
'taxonomy' => $taxonomy, // taxonomy slug
'orderby' => 'name',
'order' => 'ASC,
'hide_empty' => 1,
'include' => '',
'exclude' => '',
'exclude_tree' => '',
'number' => 0,
@Fitoussi
Fitoussi / gmwUpdateEventPostLocation.php
Created November 26, 2018 21:17
Sync the location from Events Manager plugin with GEO my WP plugin.
/*
This example integrates GEO my WP and Events Manager plugin.
The script will update GEO my WP database table with the location
entered in the Event form from the front-end and back-end.
Note that when using GEO my WP together with Event Manager plugin
you should disable the GMW Location section for the Events Edit Post page ( in the back-end )
since The usage of Google maps API by the to plugin causes a conflict.
*/
@Fitoussi
Fitoussi / gmwUpdatePostLocationGist.php
Last active November 26, 2018 21:13
gmw_update_post_type_post_location example
/*
This example can be used with any post type.
The update location function is triggered using the
save_post_{post-type-name} action which fires every time
a new post is created or an existing post is updated.
The action hook passes the argument $post_id into the update location function.
Assuming that the address entered in the front end form is saved via custom field
@Fitoussi
Fitoussi / gmw-tab-map-resize.php
Last active February 18, 2017 03:53
Trigger map resize when inside a tab.
function gmw_resize_tab_map() {
?>
<script type="text/javascript">
jQuery( 'document' ).ready( function($) {
// on click
jQuery( '.test_tab' ).on( 'click', function() {
setTimeout(function() {
@Fitoussi
Fitoussi / gfgeo_move_marker_on_click.php
Created July 26, 2016 15:07
Move map marker with a click on the map.
function gfgeo_move_map_marker_onclick() {
?>
<script>
jQuery( document ).on( 'gfgeo_render_map', function( event, GF_Geo, map_data ) {
GF_Geo.map_single_click = false;
google.maps.event.addListener( GF_Geo.maps[map_data.map_id].map, 'click', function( event) {
GF_Geo.map_single_click = true;
@Fitoussi
Fitoussi / gmw_nearby_locations_google_map_link.php
Created June 5, 2016 07:38
GMW Nearby Locations Google Map link
@Fitoussi
Fitoussi / gmw_form_submission_conditional.php
Created April 29, 2016 00:07
gmw form submission conditional
// if form ID 1 submitted show results
// change the value 1 to the ID of your form
if ( !empty( $_GET['action'] ) && $_GET['action'] == 'gmw_post' && !empty( $_GET['gmw_form'] ) && $_GET['gmw_form'] == 1 ) {
echo do_shortcode( '[gmw form="results"]' );
// otherwise, show content.
} else {
echo 'some content';
}
@Fitoussi
Fitoussi / gmw_get_directions_link_temp_fix.php
Created April 24, 2016 22:56
GEO my WP - Temporary fix for "Get directions" link
@Fitoussi
Fitoussi / gfgeo-custom-zoom-level-on-map-update.php
Last active April 17, 2016 00:13
Set custom map level when map updates
function gfgeo_set_custom_zoom_level() {
?>
jQuery( document ).ready( function() {
jQuery( document ).bind( 'gfgeo_update_map', function( event, mapObject ) {
// set map zoom level to 10
mapObject.map.setZoom( 10 );
// pan map into new position