Support » Plugin: Embed Google Map » GoogleMap inside a widget

  • Resolved m4j4

    (@m4j4)


    Hi, I’m trying to get the Google Map inside the widget Text (in one of the sidebars of my Theme). But it doesn’t work. It desplays the HTML code like this …

    {google_map}Mystreet 10, 1234 Mycity{/google_map}

    … but not the map.

    Is there anything I should change? Thanks in advance.

    https://wordpress.org/plugins/embed-google-map/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Petteri Kivimäki

    (@petkivim)

    Hi,

    Currently the plugin cannot be used inside sidebars, but there’s an easy fix for it. You just need to add one line to the plugin file by following the steps below.

    1. Login to the admin panel of your site
    2. Go to Plugins -> Embed Google Map -> Edit
    3. In the beginning of the file you should see the following lines (lines 13-14)

    // Run the function on post content prior to printing on the screen
    add_filter(‘the_content’, ‘the_google_map_embedder’);

    4. Add the following line after the above lines

    add_filter(‘widget_text’, ‘the_google_map_embedder’)

    5. After step 4 you should have

    // Run the function on post content prior to printing on the screen
    add_filter(‘the_content’, ‘the_google_map_embedder’);
    add_filter(‘widget_text’, ‘the_google_map_embedder’)

    6. Click Update File button.

    7. The problem should be fixed.

    Please let me know if this didn’t fix the problem. I’ll add the support for sidebars to the next release.

    Regards,
    Petteri

    Hi, thanks for help.

    I’ve added the line:
    add_filter(‘widget_text’, ‘the_google_map_embedder’)

    … but it does not work … it gives:

    This plugin has been deactivated because your changes resulted in a fatal error.
    Parse error: syntax error, unexpected ‘if’ (T_IF) in C:\xampp\htdocs\wordpress\treehouse\wp-content\plugins\embed-google-map\embed_google_map.php on line 19

    Is there anything else I can do?

    Plugin Author Petteri Kivimäki

    (@petkivim)

    Hi,

    The reason for the error is that there’s a semicolon missing from the end of the line that you’ve added. All you need to do is to add the missing semicolon and then it should work.

    add_filter(‘widget_text’, ‘the_google_map_embedder’);

    The semicolon was missing from my previous message, sorry about that.

    Regards,
    Petteri

    No problem. Could have figured that out myself.
    It now works. Thank you!!!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘GoogleMap inside a widget’ is closed to new replies.