WordPress.org

Ready to get started?Download WordPress

Forums

Basic Google Maps Placemarks
[resolved] Error with do_shortcode in template (6 posts)

  1. Pierre Schneider
    Member
    Posted 9 months ago #

    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/

  2. Pierre Schneider
    Member
    Posted 9 months ago #

    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" )

  3. Pierre Schneider
    Member
    Posted 9 months ago #

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

  4. loic-33
    Member
    Posted 4 months ago #

    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

  5. Pierre Schneider
    Member
    Posted 4 months ago #

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

  6. loic-33
    Member
    Posted 4 months ago #

    Ok no problem

    Merci quand meme ;)

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.