WordPress.org

Ready to get started?Download WordPress

Forums

Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps)
[resolved] 3.2 requires adding to code to header of template files (29 posts)

  1. twodozen
    Member
    Posted 1 year ago #

    Since updating to LMM v3.2 and WP v3.5, I'm getting this error on pages using shortcodes to call maps:

    "Leaflet Maps Marker warning!
    You must enqueue the plugin stylesheets manually if you want to show maps by calling do_shortcode() in your template files!
    Please add the following code before your get_header() call inside your template, which is usually located in header.php:

    $plugin_version = get_option('leafletmapsmarker_version');
    global $wp_styles;
    wp_enqueue_style( 'leafletmapsmarker', LEAFLET_PLUGIN_URL . 'leaflet-dist/leaflet.css', array(), $plugin_version );
    wp_enqueue_style( 'leafletmapsmarker-ie-only', LEAFLET_PLUGIN_URL . 'leaflet-dist/leaflet.ie.css', array(), $plugin_version );
    $wp_styles->add_data('leafletmapsmarker-ie-only', 'conditional', 'lt IE 9');

    ********

    Anyone else experience this?

    http://wordpress.org/extend/plugins/leaflet-maps-marker/

  2. twodozen
    Member
    Posted 1 year ago #

    I should add:

    1. The problem goes away when I switch to default theme ("2012")
    2. Restoring the previous version (2.6) removed the problem

  3. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,
    this is not an error - conditional loading of css requires to some code once to heade.php of your template in order to display maps - please just follow the instructions and maps will work as normal.
    regards,
    Robert

  4. twodozen
    Member
    Posted 1 year ago #

    Hi Robert,

    To clarify - it wasn't necessary in v2 but is needed for v3?

    Btw, I did follow the instructions but the error persisted.

    Regards,
    Moz

  5. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Moz,

    didnt find a way to automatically add css files if shortcode is called via do_shortcode() in template files for v3.2 (didnt exist before). This is way I added the instructions - my thought was that if someone added shortcodes to template files, he/she is able to do that with the code needed for my plugin.
    I would have to take a look at your site/admin in order so see whats wrong.

    Will try to find a solution for this for v3.2.1 so that no manual changes in template files are needed
    regards,

    Robert

  6. WJJ
    Member
    Posted 1 year ago #

    OK but I can't find file to put the 'code' inside.
    In this moment i have to turn off Leaflet Maps Marker on my side, because
    "Leaflet Maps Marker warning!" kill it
    What can I do to restore Leaflet Maps Marker to good version?
    I use themes Adventure Journal in WordPress
    Regards
    Witold

  7. WJJ
    Member
    Posted 1 year ago #

    Uf! I fougth the place to put this "code" in Adventure Journal

    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    [...]
    * to support sites with threaded comments (when in use).
    */
    if ( is_singular() && get_option( 'thread_comments' ) )
    wp_enqueue_script( 'comment-reply' );

    /* Always have wp_head() just before the closing </head>
    * tag of your theme, or you will break many plugins, which
    * generally use this hook to add elements to <head> such
    * as styles, scripts, and meta tags.
    */
    $plugin_version = get_option('leafletmapsmarker_version');
    global $wp_styles;
    wp_enqueue_style( 'leafletmapsmarker', LEAFLET_PLUGIN_URL . 'leaflet-dist/leaflet.css', array(), $plugin_version );
    wp_enqueue_style( 'leafletmapsmarker-ie-only', LEAFLET_PLUGIN_URL . 'leaflet-dist/leaflet.ie.css', array(), $plugin_version );
    $wp_styles->add_data('leafletmapsmarker-ie-only', 'conditional', 'lt IE 9');

    wp_head();
    ?>
    </head>

  8. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Moz & WJJ,
    I just released v3.2.1 which includes an alternative function for conditional css if do_shortcode() is used in template files: http://www.mapsmarker.com/2012/12/12/v3-2-1-no-more-manual-edits-when-using-do_shortcode-is-available/
    please check if this works for you (no more manual edits are needed).
    best regards,
    Robert

  9. zimbru
    Member
    Posted 1 year ago #

    Hi Robert,

    With v3.2.1 installed i still have the warning on some pages where is used [mapsmarker layer="xxx"]

    The warning was present in v.3.2 as well but i waited for update - as you mentioned yesterday.
    Maybe in some cases it still need manual edit.

    Thank you

  10. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    I implemented a "95%-solution" - in which template files do you include the shortcode?

  11. zimbru
    Member
    Posted 1 year ago #

    I use them in categories description, but is some works and in some don`t.
    I will ask support from template developers team as well.

    Thank you

  12. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    automatic enqueuing of css files if shortcode is used in category description is not supported - please add those few lines to your template instead.

  13. twodozen
    Member
    Posted 1 year ago #

    I'm staying with v2 until this is a bit more stable. Amending theme files isn't a viable option for me in this case due to overwrite problems later when theme is updated.

  14. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Hi twodozen,

    v3.2.1 is stable and doesnt need any manual theme changes if you embedd the maps via do_shortcode() in theme files.

    The only usecase where you still need manual edits is when you use a shortcode within category descriptions. Enhancing my plugin to also check this field, would slow down its overall performance (as I had to check every available category description).
    regards,

    Robert

  15. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    I think I just had an idea: I will add an option to disable selective css loading which is disabled by default. In case you are using shortcodes in fields like category description for example which are not supported by my plugin, you can fix this my setting the option without having to touch your theme. Only disadvantage: css files then get loaded on every page again.

  16. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Hi again,
    I just released v3.2.2 which should fix all those issues - please check again.
    regards,
    Robert

  17. jwsocial
    Member
    Posted 1 year ago #

    Hello,

    I am getting these two error messages:

    1) Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent .....

    2) Warning: Missing argument 2 for wpdb::prepare(), ...

    Can you please advise what I need to do so I may use the plugin again? I really liked the plugin when I was first able to use it with no glitches.

    Thank you!
    Jocelyn
    http://nwsuburbschicago.com

  18. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Jocelyn,
    have you tried the latest version v3.2.4 -l should have no wpdb:prepare-warnings (are you sure these are from my plugin? wp 3.5 introduced a new check for prepare() which leads to this warnings on many plugins).
    if updating to latest version didnt work - did you try the steps from http://mapsmarker.com/readme-first ?
    best regards,
    Robert

    PS: as I give support for free, I'd appreciate your review at http://wordpress.org/support/view/plugin-reviews/leaflet-maps-marker

  19. jwsocial
    Member
    Posted 1 year ago #

    Hello Robert,

    Yes, I have updated to the latest and version and I have read the "readme first" and followed all the necessary steps as you had indicated from that post.

    Thanks,
    Jocelyn

  20. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Jocelyn,
    as indicated in the post, I would need an URL where I can take a look at your map ;-)
    regards,
    Robert

  21. jwsocial
    Member
    Posted 1 year ago #

    Of course, here's the direct link to the map section -> http://nwsuburbschicago.com/places-to-go/

    Thanks for looking into it, Robert.

    Jocelyn

  22. jwsocial
    Member
    Posted 1 year ago #

    PS: Please advise as soon as you can, as I do not want to keep that page up as it can be a security issue. I just published that page again so you can see it. Thank you!

  23. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    No worries - this aint a security issue. But thanks for reporting - since WordPress 3.5, prepare()-functions are handled more strictly.

    Open /inc/showmap.php and change line 313 from

    $mlm_all_layers = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM $table_name_layers" ), ARRAY_A );

    to

    $mlm_all_layers = $wpdb->get_results( "SELECT id FROM $table_name_layers", ARRAY_A );

    this will solve your issue (fix will be included in the next release.
    regards,

    Robert

  24. jwsocial
    Member
    Posted 1 year ago #

    That was quick! Is this something I do with my web server?

    Thanks! And good to know it's not a security issue. Whew! :)

  25. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    no, was an error with my plugin since wordpress 3.5

  26. jwsocial
    Member
    Posted 1 year ago #

    Hey Robert,

    I don't know who to contact to make this type of change.... I contacted HostGator but they said this is a coding issue that I need to contact the developer, they said to contact you. So now I'm back in square 1....can you get that corrected?

    Jocelyn

  27. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Are you wordpress admin of your site? I guess so. Then go to Plugins / Editor - select leaflet maps marker from the dropdown, select showmap.php file from the list on the right, search for the code I posted above and replace it with the new one.

    v3.2.5 will also include this fix, but I cant tell you a release date yet as I have to fix another issue first...
    regards,
    Robert

  28. jwsocial
    Member
    Posted 1 year ago #

    Hurray Robert! That fixed it. And I learned something new in the process. Thank you. Didn't realize I can make that correction in my Dashboard. :) Is this going to be a reflection of how to do business with you? I will for sure give a good recommendation!

    Looking forward to the new release to help correct the other issue. Thank you Robert.

    Enjoy your day!
    Jocelyn

  29. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    see - not that difficult - glad you made it :-)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic