Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
force autolocation on homepage only
function listify_custom_autolocation() {
if ( ! ( is_front_page() ) ) {
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
You can’t perform that action at this time.