Esempio n. 1
0
        $view_btn = '<a id="view-map" href="#" class="button icon-location">' . __('View map', 'gp') . '</a>';
    } else {
        $view_btn = '';
    }
    /**
     * Show Send Message button only if there is a [contact-form-7] short tag
     * in the content.
     */
    if (preg_match('/\\[contact\\-form\\-7.+?\\]/is', $post->post_content)) {
        $message_btn = '<a id="send-message" href="#" class="button icon-paper-plane">' . __('Send message', 'gp') . '</a>';
    } else {
        $message_btn = '';
    }
    ?>
    <div id="main" class="site page-contacts"><?php 
    if (gp_contacts_has_map(get_the_ID())) {
        ?>

            <div id="map" data-latitude="<?php 
        echo esc_attr($latitude);
        ?>
" data-longitude="<?php 
        echo esc_attr($longitude);
        ?>
"
                          data-icon-latitude="<?php 
        echo esc_attr($icon_latitude);
        ?>
" data-icon-longitude="<?php 
        echo esc_attr($icon_longitude);
        ?>
Esempio n. 2
0
/**
 * Add Google Maps script, if API key is specified.
 */
function gp_contacts_enqueue_google_maps()
{
    global $post;
    /**
     * If current page has contacts template, then see if we need to enqueue
     * Google Maps script.
     */
    if ($post) {
        if (it_is_template($post->ID, 'template-contacts.php')) {
            if (gp_contacts_has_map($post->ID)) {
                $data = gp_contacts_get_data($post->ID);
                wp_enqueue_script('google-maps-api3', 'https://maps.googleapis.com/maps/api/js?key=' . $data['api'] . '&sensor=false');
                wp_enqueue_script('gp-maps', get_template_directory_uri() . '/js/maps.js', array('google-maps-api3', 'jquery'));
            }
        }
    }
}