Skip to content

Instantly share code, notes, and snippets.

View tripflex's full-sized avatar
🦋
in the zone

Myles McNamara tripflex

🦋
in the zone
View GitHub Profile
@tripflex
tripflex / functions.php
Created April 15, 2022 20:57
Restrict backend geolocation (radius) handling for specific country when using WP Job Manager Search and Filtering
<?php
add_filter( 'search_and_filtering_geolocation_geocode_address_google_url', 'smyles_custom_geocode_url', 10, 2 );
// DE below is the 2 digit country code to limit results to
function smyles_custom_geocode_url( $url, $address ){
return $url . '&components=country:DE';
}
@tripflex
tripflex / functions.php
Created April 7, 2022 19:59
Select2 fix for ReadAndDigest Theme
<?php
add_action( 'wp_enqueue_scripts', 'smyles_check_sloppy_dev_scripts', 99999 );
function smyles_check_sloppy_dev_scripts(){
global $post;
if( ! $post ){
return;
}
$has_a_shortcode = false;
@tripflex
tripflex / functions.php
Created April 5, 2022 22:15
Remove application field check URL or Email for WP Job Manager
<?php
add_filter( 'job_manager_application_field_skip_email_url_validation', '__return_true' );
@tripflex
tripflex / functions.php
Created February 4, 2022 23:14
jQuery UI Date Picker Allow Year and Month Dropdown Selection when using WP Job Manager Field Editor
<?php
add_filter( 'job_manager_field_editor_date_args', 'my_custom_date_args' );
function my_custom_date_args( $args ){
$args['changeMonth'] = true;
$args['changeYear'] = true;
return $args;
}
@tripflex
tripflex / functions.php
Created February 2, 2022 00:31
Replace URLs and Emails with HTML links (only if one does not exist), excluding punctuation (!,.) Period/Comma/Exclamation Point
<?php
/**
* Replace URLs and Emails with HTML links
*
* This function will replace all URLs and Email Addresses wrapped in HTML links, ONLY if one does not already exist,
* excluding punctuation (email or url followed by period, comma, etc).
*
* @author Myles McNamara
* @param $content
@tripflex
tripflex / submit.php
Created January 25, 2022 20:26
Techbrise Company Manager Field Editor 1.12.0 fix
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'WP_Job_Manager_Form' ) ) {
include( JOB_MANAGER_PLUGIN_DIR . '/includes/abstracts/abstract-wp-job-manager-form.php' );
}
@tripflex
tripflex / functions.php
Created January 18, 2022 00:31
Disable auto remove empty meta fields on listings when using WP Job Manager Field Editor
<?php
// Remove the line below if you want to keep this handling on the frontend
add_filter( 'field_editor_save_custom_fields_remove_empty_value_fields', '__return_false' );
// Remove the line below if you want to keep this handling in the admin area
add_filter( 'field_editor_save_admin_custom_fields_remove_empty_value_fields', '__return_false' );
@tripflex
tripflex / functions.php
Created January 12, 2022 22:21
WordPress make sure that hidden_columns always returns an array
<?php
add_filter( 'hidden_columns', 'smyles_check_hidden_columns_is_array', 9999999999999 );
function smyles_check_hidden_columns_is_array( $hidden ){
return is_array( $hidden ) ? $hidden : array();
}
@tripflex
tripflex / functions.php
Last active November 23, 2021 23:55
Geocode custom URL for geocoding address when lat/lng not specified when using WP Job Manager Search and Filtering
<?php
add_filter( 'search_and_filtering_geolocation_geocode_address_google_url', 'smyles_custom_geocode_url', 10, 2 );
function smyles_custom_geocode_url( $url, $address ){
return $url . '&components=country:BE|postal_code:' . $address;
}
@tripflex
tripflex / functions.php
Created October 1, 2021 19:48
Change job permalinks max characters to 50 when using WP Job Manager Visibility plugin
<?php
add_filter( 'job_manager_visibility_admin_job_permalink_max_slug_chars', 'smyles_max_job_permalink_chars' );
add_filter( 'job_manager_visibility_job_permalink_max_slug_chars', 'smyles_max_job_permalink_chars' );
function smyles_max_job_permalink_chars( $chars ){
return 50;
}