Last active
February 23, 2020 19:04
-
-
Save paulmiller3000/f58ed18bbb4969121748e23014694785 to your computer and use it in GitHub Desktop.
Function to display Advanced Custom Fields Google Map in Quick View Pro modal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Display a map (saved from Advanced Custom Fields) in Quick View Pro modal | |
* Documentation: https://battlestardigital.com/adding-advanced-custom-fields-google-maps-to-woocommerce-quick-view-pro/ | |
* HTML Source: https://www.advancedcustomfields.com/resources/google-map/ | |
*/ | |
private function bsd_qvp_display_map( $map) { | |
if ( $map ) { | |
?> | |
<div id="map" class="acf-map"> | |
<div class="marker" data-lat="<?php echo esc_attr($map['lat']); ?>" data-lng="<?php echo esc_attr($map['lng']); ?>"></div> | |
</div> | |
<script> | |
<?php | |
include_once get_stylesheet_directory() . '/bsd-maps.js'; // Assumes you've made a copy of the ACF JavaScript field and placed it in your child theme folder | |
//include_once dirname( BSD_WC_QVP_PATH ) . '/assets/bsd-maps.js'; // Use this syntax if you're storing the file elsewhere, e.g., your plugin | |
?> | |
</script> | |
<?php | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment