WordPress.org

Ready to get started?Download WordPress

Forums

Pronamic Google Maps
[resolved] Map widths in Percentages/Ems/Auto etc. (6 posts)

  1. Ben B
    Member
    Posted 2 years ago #

    Hello!

    Is it possible to use other dimension types in the shortcodes? I'd like to be able to use percentages, for example.

    Thanks

    Ben

    http://wordpress.org/extend/plugins/pronamic-google-maps/

  2. daybot
    Member
    Posted 2 years ago #

    Not the best solution, but if you go into

    pronamic-google-maps -> classes
    and open
    Pronamic_Google_Maps.php

    go to line 270 and

    replace
    $content .= sprintf('<div class="canvas" style="width: %dpx; height: %dpx;">', $info->width, $info->height);

    with
    $content .= sprintf('<div class="canvas">', $info->width, $info->height);

    Then you can control the size of the map in css either in percentage or pixels.

    David.

  3. Ben B
    Member
    Posted 2 years ago #

    Thanks for the pointer, David. While I couldn't get your code to work directly; I was able to amend the code to append 'px' to height and '%' to width which gave me the result I was after.

    Thanks!

    Ben

  4. Remco Tolsma
    Member
    Plugin Author

    Posted 2 years ago #

    Unfortunately it is not possible to use another dimension type. Adjusting the core files of the plugin isn't a very nice solution. These changes are likely to be lost during an update.

  5. Creative Slice
    Member
    Posted 1 year ago #

    Ben, any chance you can post the code that you used to get this working? It looks like this comment form hid the solution daybot posted.

    Thanks!

  6. Creative Slice
    Member
    Posted 1 year ago #

    I was able to get it working by adjusting line 270 (from daybot's post) to this:

    $content .= sprintf('<div class="canvas" style="width: %dpx; height: %dpx;">', '100%', $info->height);

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic