Skip to content

Instantly share code, notes, and snippets.

View Fitoussi's full-sized avatar

Eyal Fitoussi Fitoussi

View GitHub Profile
@Fitoussi
Fitoussi / gmw.min.js
Created December 16, 2015 22:09
Prevent Roboto font from loading in GEO my WP plugin
var head = document.getElementsByTagName('head')[0];
// Save the original method
var insertBefore = head.insertBefore;
// Replace it!
head.insertBefore = function (newElement, referenceElement) {
if (newElement.href && newElement.href.indexOf('http://fonts.googleapis.com/css?family=Roboto') === 0) {
@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 / wpmj-geolocation-per-category-map-icon.php
Last active January 4, 2016 23:21
WP Job Manager geolocation - Pre category map icon
function gjm_per_category_map_icon( $map_icon, $post ) {
// get Job Type terms attached to a job
$job_terms = wp_get_post_terms( $post->ID, 'job_listing_type', array( 'fields' => 'ids' ) );
// if term ID is 1
if ( in_array( '1', $job_terms) ) {
$map_icon = 'https://maps.google.com/mapfiles/ms/icons/yellow-dot.png';
@Fitoussi
Fitoussi / omw-nearby-locations-website.php
Created March 31, 2016 23:55
add website to nearby locations results
<div class="website">
<i class="">Website: </i>
<a href="<?php echo esc_url($post_data->website); ?>" target="_blank">
<?php echo esc_html( $post_data->website ); ?>
</a>
</div>
@Fitoussi
Fitoussi / wp_google_address_autocomplete_1.php
Last active April 13, 2016 09:24
Apply Google Places Address Autocomplete to an input field
function gmw_include_google_places_api() {
//register google maps api if not already registered
if ( !wp_script_is( 'google-maps', 'registered' ) ) {
wp_register_script( 'google-maps', ( is_ssl() ? 'https' : 'http' ) . '://maps.googleapis.com/maps/api/js?libraries=places&sensor=false', array( 'jquery' ), false );
}
//enqueue google maps api if not already enqueued
if ( !wp_script_is( 'google-maps', 'enqueued' ) ) {
wp_enqueue_script( 'google-maps' );
@Fitoussi
Fitoussi / wp_google_address_autocomplete_2.php
Last active April 13, 2016 09:30
Apply Google Places Address Autocomplete to an input field
function gmw_google_address_autocomplete() {
?>
<script>
jQuery(document).ready(function($) {
//Array of input fields ID.
var gacFields = ["gmw-address-1","gmw-address-7"];
$.each( gacFields, function( key, field ) {
@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
@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 / 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';
}