Skip to content

Instantly share code, notes, and snippets.

View Fitoussi's full-sized avatar

Eyal Fitoussi Fitoussi

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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 / 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 / gist:b45e5476847dafb8de8c
Created December 4, 2015 05:50
Gravity forms geolocation drag on click
drag_marker_onclick : function() {
google.maps.event.addListener( GF_Geo.map.map, 'click', function( event ){
GF_Geo.map.marker.setPosition( event.latLng );
// save some map details
GF_Geo.processing.status = true;
GF_Geo.processing.element = 'map';
GF_Geo.processing.coords = {
@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 / gist:e605e012afe7d9612d72
Last active November 9, 2015 11:05
wp_dropdown_categories args
<?php
$args = array(
'show_option_all' => '',
'show_option_none' => '',
'orderby' => 'ID',
'order' => 'ASC',
'show_count' => 0,
'hide_empty' => 1,
'child_of' => 0,
'exclude' => '',