Title: [Plugin: Basic Google Maps Placemarks] Using [bgmp-map] in a template file with do_shortcode():
Last modified: August 20, 2016

---

# [Plugin: Basic Google Maps Placemarks] Using [bgmp-map] in a template file with do_shortcode():

 *  [francos](https://wordpress.org/support/users/francos/)
 * (@francos)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-basic-google-maps-placemarks-using-bgmp-map-in-a-template-file-with-do_shortcode/)
 * **I want to implement a map to a contact page.**
    I am not a very skilled PHP
   developer. I can not get solution under to work. Do you have an example on this
   code? My theme name is A-theme, and I am not alode to write that name with the–
   in the function.
 * **Any suggestions to get any futher will be appreciated!!**
 * The text under is from the plugin site: [http://wordpress.org/extend/plugins/basic-google-maps-placemarks/installation/](http://wordpress.org/extend/plugins/basic-google-maps-placemarks/installation/)
   
   For efficiency, the plugin only loads the required JavaScript, CSS and markup
   files on pages where it detects the map shortcode is being called. It’s not possible
   to detect when do_shortcode() is used, so you need to manually let the plugin
   know to load the files by adding this code to your theme:
 * function my_theme_name_bgmp_shortcode_check()
    { global $post;
 *  $shortcodePageSlugs = array(
    ‘first-page-slug’, ‘second-page-slug’, ‘hello-
   world’ );
 *  if( $post )
    if( in_array( $post->post_name, $shortcodePageSlugs ) ) add_filter(‘
   bgmp_map-shortcode-called’, ‘__return_true’ ); } add_action( ‘wp’, ‘my_theme_name_bgmp_shortcode_check’);
   Copy and paste that into your theme’s functions.php file or a functionality plugin,
   update the function names and filter arguments, and then add the slugs of any
   pages/posts containing the map to $shortcodePageSlugs. If you’re using it on 
   the home page, the slug will be ‘home’.
 * This only works if the file that calls do_shortcode() is registered as a page
   template and assigned to a page.
 * [http://wordpress.org/extend/plugins/basic-google-maps-placemarks/](http://wordpress.org/extend/plugins/basic-google-maps-placemarks/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Ian Dunn](https://wordpress.org/support/users/iandunn/)
 * (@iandunn)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/plugin-basic-google-maps-placemarks-using-bgmp-map-in-a-template-file-with-do_shortcode/#post-2660405)
 * You don’t have to call the function `my_theme_name_bgmp_shortcode_check`, you
   can name it whatever you want. Try `at_bgmp_shortcode_check` instead. Just make
   sure you update both the function declaration itself, and the `add_action()` 
   parameter.
 *  [blix69](https://wordpress.org/support/users/blix69/)
 * (@blix69)
 * [14 years ago](https://wordpress.org/support/topic/plugin-basic-google-maps-placemarks-using-bgmp-map-in-a-template-file-with-do_shortcode/#post-2660512)
 * Hi Ian,
 * to change the name of the function doesn’t answer Francos problem so as mine.
   
   I am not php developer and I found your documentation not easy to understand.
   Talkin about (Using [bgmp-map] in a template file with do_shortcode();)
 * “Just make sure you update both the function declaration itself, and the add_action()
   parameter.”
    -Update the add_action()… update it to what?
 * I have tried everything (working with Twenty Eleven theme) trying to implement
   the map to home page. Nothing worked for me. I just gave up (after 5 hours of
   trying) because I haven’t found the answers anywhere…. And it’s a shame because
   your plugin seems to be decent.
    Just try to walk in shoes of non php developers.
   Most of your expressions in documentation are just a complete UFO for me. But
   I just talk for myself.
 * Thanks,
    Ev
 *  Plugin Author [Ian Dunn](https://wordpress.org/support/users/iandunn/)
 * (@iandunn)
 * [14 years ago](https://wordpress.org/support/topic/plugin-basic-google-maps-placemarks-using-bgmp-map-in-a-template-file-with-do_shortcode/#post-2660513)
 * Hi blix69, what I meant was that if you rename the function, you also have to
   change the parameter of the add_action function to match. Here are examples of
   valid and invalid action callbacks:
 * This example is **WRONG**:
 *     ```
       function foo()
       {
           // ...
       }
   
       add_action( 'wp', 'bar' );
       ```
   
 * That doesn’t work because the second parameter of the add_action() function call
   is “bar” and the function is named “foo”. The parameters need to match so that
   WordPress knows what function to call when the “wp” hook is executed.
 * This example is **RIGHT**:
 *     ```
       function foo()
       {
           // ...
       }
   
       add_action( 'wp', 'foo' );
       ```
   
 * This one works because both the function name and the add_action() parameter 
   match.
 * You can name the function whatever you want, it doesn’t have to be “my_theme_name_bgmp_shortcode_check”.**
   BUT**, if you change it you also have to change the second parameter of the add_action()
   call to match.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: Basic Google Maps Placemarks] Using [bgmp-map] in a template
file with do_shortcode():’ is closed to new replies.

 * ![](https://ps.w.org/basic-google-maps-placemarks/assets/icon-128x128.png?rev
   =1152531)
 * [Basic Google Maps Placemarks](https://wordpress.org/plugins/basic-google-maps-placemarks/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/basic-google-maps-placemarks/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/basic-google-maps-placemarks/)
 * [Active Topics](https://wordpress.org/support/plugin/basic-google-maps-placemarks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/basic-google-maps-placemarks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/basic-google-maps-placemarks/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Ian Dunn](https://wordpress.org/support/users/iandunn/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/plugin-basic-google-maps-placemarks-using-bgmp-map-in-a-template-file-with-do_shortcode/#post-2660513)
 * Status: not resolved