Skip to content

Instantly share code, notes, and snippets.

View Fitoussi's full-sized avatar

Eyal Fitoussi Fitoussi

View GitHub Profile
@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 / 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 / gjm.min.js
Created December 16, 2015 23:56
Wp Job Geolocation
jQuery(document).ready(function($) {
//default values
var thisPrefix = 'gjm';
var thisForm = false;
var thisTarget = false;
var addressField = false;
var prevAddressField = false;
var latField = false;
var lngField = false;
@Fitoussi
Fitoussi / wpjm-geolocation-radius-dropdown.php
Last active February 5, 2019 16:39
WP Job Manager Geolocation - Modify Radius Dropdown
function gjm_radius_dropdown( $output, $radius, $gjm_object ) {
$output = '';
$output .= '<div class="'.$gjm_object->prefix.'-filter-wrapper '.$gjm_object->prefix.'-radius-wrapper radius dropdown '.$gjm_object->prefix.'-filters-count-'.esc_attr( $gjm_object->filters['filters_count'] ).'">';
$output .= '<select name="'.$gjm_object->prefix.'_radius" class="'.$gjm_object->prefix.'-filter" id="'.$gjm_object->prefix.'-radius">';
foreach ( $radius as $value ) {
$value = esc_attr( $value );
@Fitoussi
Fitoussi / gist:da198dc313db2a323c2a
Last active November 30, 2018 03:58
GEO my WP Modify Taxonomy Drop-down Options
<?php
function gmw_modify_search_form_taxonomy_args( $args, $taxonomy, $gmw ) {
// Limit the fuction to a specific form using it's ID.
if ( 1 !== $gmw['ID'] ) {
return $args;
}
// limit the function to a specific taxonmoy.
if ( "category" !== $taxonomy->name ) {
@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 / 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