• Resolved Pierre Schneider

    (@pierre-schneider)


    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

    https://www.ads-software.com/plugins/basic-google-maps-placemarks/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Pierre Schneider

    (@pierre-schneider)

    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

    (@pierre-schneider)

    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!!

    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

    (@pierre-schneider)

    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é.

    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.