• I only use this plugin (shortcode) on one page. Therefore, I do not need the calls to google’s javascript api and related css called on every page. Is there a way to conditionally call the plugin without touching the plugin itself? Perhaps in the functions.php file? PHP is not my first language, so how would this literally be accomplished?

    Thanks in advance!

    http://wordpress.org/extend/plugins/google-maps-v3-shortcode/

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have the exact same issue with this plugin. The plugin’s code is being injected into the header of every page, but I’m using the shortcode on one page only.

    Thread Starter polyfade

    (@polyfade)

    Bill,
    If this annoys you as much as it did me, I did the one thing you probably shouldn’t do (especially if there’s an update). I modified the plugin itself.

    In Google-Maps-v3-Shortcode.php, I removed the call to Google Maps API. I believe starting with line 13 – 23

    // Add the google maps api to header
    add_action('wp_head', 'gmaps_header');
    
    function gmaps_header() {
    	?>
    	<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
    	<style type="text/css">
            .entry-content img {max-width: 100000%; /* override */}
        </style>
    	<?php
    }

    In you functions.php page add the following:

    function gmap() {
    if ( is_page( 'contact-us') ) {
    wp_register_script('googleMap', ('http://maps.google.com/maps/api/js?sensor=false'));
    wp_enqueue_script('googleMap'); }
    }
    add_action( 'wp_print_scripts', 'gmap');

    Replace ‘contact-us’ to whatever your page slug is called.

    Basically this adds the Google Maps API back in to only the page you have the map appear on.

    thanks man

    DaisyDesign

    (@daisydesign)

    It doesn’t work for me! 🙁
    I have some problems with the rule:
    .entry-content img {max-width: 100000%; /* override */}
    It override my css file and affect every img on my site.

    How can I fix it?
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Google Maps v3 Shortcode] Deregister plugin’ is closed to new replies.