Title: Error with do_shortcode in template
Last modified: August 21, 2016

---

# Error with do_shortcode in template

 *  Resolved [Pierre Schneider](https://wordpress.org/support/users/pierre-schneider/)
 * (@pierre-schneider)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/error-with-do_shortcode-in-template/)
 * Hello,
    I use your plugin in the “header.php” of a “Twenty Thirteen Child” theme.
   So in my header I have in a Div : `<?php echo do_shortcode('[bgmp-map]'); ?>`
 * I have created a “functionality plugin” that code :
 *     ```
       function bgmpShortcodeCalled()
       {
           global $post;
   
           $shortcodePageSlugs = array( // add the slugs of any pages/posts containing the map to $shortcodePageSlugs.
               'reservation',
               'hotels-ventoux'
           );
   
           if( $post ) {
               if( in_array( $post->post_name, $shortcodePageSlugs ) )
                   add_filter( 'bgmp_mapShortcodeCalled', '__return_true' );
       		if( is_front_page() || is_home() )
               add_filter( 'bgmp_mapShortcodeCalled', '__return_true' );
       	}
       }
       add_action( 'wp', 'bgmpShortcodeCalled' );
       ```
   
 * All is OK for the “home page”, the “reservation page” and for the “hotels-ventoux
   page”. The map is shown as I want.
 * But if I try to go on a page without map, I get the error message here (in french):
 * > Basic Google Maps Placemarks erreur : les fichiers JavaScript et/ou CSS n’ont
   > pas pu être chargez. SI vous utilisez la fonction do_shortcode(), vous devez
   > ajouter un filtre à votre thème. the FAQPlus de détails.
 * So you cannot see the site because I work in localhost with WampServer.
 * Can you help me please to know wher is the problem?
    Thank you, Pierre
 * [http://wordpress.org/plugins/basic-google-maps-placemarks/](http://wordpress.org/plugins/basic-google-maps-placemarks/)

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

 *  Thread Starter [Pierre Schneider](https://wordpress.org/support/users/pierre-schneider/)
 * (@pierre-schneider)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/error-with-do_shortcode-in-template/#post-4198486)
 * Hi,
    Euh, I think you don’t answer me because you think I have to look for in
   the FAQ or the Installation Guide. I read everything with my English is not very
   good, I also looked for on forum, but I think I have followed all your tips. 
   I don’t understand why it request Javascript and CSS on page where there is no
   map to show, while there is no problem on pages with map ( using “$shortcodePageSlugs”)
 *  Thread Starter [Pierre Schneider](https://wordpress.org/support/users/pierre-schneider/)
 * (@pierre-schneider)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/error-with-do_shortcode-in-template/#post-4198487)
 * Hello,
 * Well, I solved the problem like this,
 * In my “function.php” :
    `add_filter( 'bgmp_map-shortcode-called', '__return_true');`
 * In my “header.php” :
 *     ```
       <?php
       global $post;
   
       $shortcodePageSlugs = array( // add the slugs of any pages/posts containing the map to $shortcodePageSlugs.
       	'reservation',
       	'hotels-ventoux'
       );
       if( in_array( $post->post_name, $shortcodePageSlugs ) || is_front_page() || is_home()  )
       	echo do_shortcode('[bgmp-map]');
       ?>
       ```
   
 * And now it is OK with my 3 pages with map and the others pages without map and
   without error!!
 *  [loic-33](https://wordpress.org/support/users/loic-33/)
 * (@loic-33)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/error-with-do_shortcode-in-template/#post-4198594)
 * i have a problem with my bgmp-map too. My English is horrible. Pierre are you
   French? ca serait plus facile pour nous deux d’échanger en Francais.
 * sans créer de fonction spéciale, l’insertion du shortcode en dure dans mes fichier.
   php fonctionne parfaitement sur ma page d’accueil et une des pages intérieures
   de mon site.
 * mais sur les autres le meme message d’erreur que toi s’affiche et sur d’autre
   rien du tout…
 * j’ai du mal à comprendre l’utilité de la déclaration de cette fonction et comment
   résoudre le problème…..
 * j’espere que tu pourra m’aider
 *  Thread Starter [Pierre Schneider](https://wordpress.org/support/users/pierre-schneider/)
 * (@pierre-schneider)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/error-with-do_shortcode-in-template/#post-4198595)
 * Hi Loic-33,
    Sorry but I don’t remember about that problem. I did’t use it from
   3 months ago (I was just tried that plugin). So It’s difficult for me to return
   in this function to see what is the matter.
 * (Fr)Je disais que je ne me souviens plus de ce problème. Je n’utilise plus ce
   plugin depuis 3 mois (je faisais des essais à cette époque). Ca m’est difficle
   pour moi de replonger dedans.
    Désolé.
 *  [loic-33](https://wordpress.org/support/users/loic-33/)
 * (@loic-33)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/error-with-do_shortcode-in-template/#post-4198596)
 * Ok no problem
 * Merci quand meme 😉

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

The topic ‘Error with do_shortcode in template’ 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/)

 * 5 replies
 * 2 participants
 * Last reply from: [loic-33](https://wordpress.org/support/users/loic-33/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/error-with-do_shortcode-in-template/#post-4198596)
 * Status: resolved