Skip to content

Instantly share code, notes, and snippets.

@turtlepod
Created October 10, 2017 13:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turtlepod/e396d9708d0454715101ea9a0038d95d to your computer and use it in GitHub Desktop.
Save turtlepod/e396d9708d0454715101ea9a0038d95d to your computer and use it in GitHub Desktop.
listify_custom_autolocation *better
<?php
/**
* Auto Populate Location Field
*
* @link https://www.facebook.com/groups/1035604846471813/permalink/1656529524379339/
*/
function listify_custom_autolocation() {
if ( ! ( is_front_page() || listify_is_job_manager_archive() ) ) {
return;
}
if ( isset( $_GET['search_location'] ) ) {
return;
}
?>
<script>
jQuery(document).ready(function() {
var locate = jQuery( '.locate-me' );
locate.trigger( 'click' );
});
</script>
<?php
}
add_action( 'wp_footer', 'listify_custom_autolocation', 9999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment