WordPress.org

Ready to get started?Download WordPress

Forums

Geo Mashup
[resolved] Display Posts Near Point Not Working (8 posts)

  1. mariostella
    Member
    Posted 2 years ago #

    Hi,

    I am trying to show posts near a point using the near_lat near_lng and radius_km parameters.

    When I specify the code

    <?php echo GeoMashup::map('map_content=contextual&remove_geo_mashup_logo=true&radius_mi=10&near_lat=11.3323975&near_lng=43.3212242') ?>

    the only thing showing up is is the 0 lat and 0 lng points near Africa. How can I make it work?

    Then I have two questions:
    1) Is it possible to just specify the radius to display posts near a point on a map you already saved without specifying the near_lat and near_lng?

    2) Is it possible to have only posts showing in a contextual map, and not maps created on pages?

    Thanks for all the help.

    http://wordpress.org/extend/plugins/geo-mashup/

  2. Dylan Kuhn
    Member
    Plugin Author

    Posted 2 years ago #

    I think you probably want map_content=global. A contextual map will only include things in the current query, which probably doesn't include posts in that area.

  3. mariostella
    Member
    Posted 2 years ago #

    Thanks Dylan! Now the map works fine.

    I was wondering if it is possible to avoid specifying the near_lat and near_lng parameters when the page already has saved mashup coordinates, so to be able to use it in a template file.

    Also, is it possible to only have markers of posts showing in a global map, and not those of pages?

    Thanks in advance

  4. mariostella
    Member
    Posted 2 years ago #

    I am trying

    <?php $coords = GeoMashup::post_coordinates(); echo GeoMashup::map('map_content=global&remove_geo_mashup_logo=true&radius_mi=10&near_lat=' . $coords['lat'] . '&near_lng=' . $coords['lng'] . '') ?>

    But it completely ignores the near_lat and near_lng, I think my syntax is messed up though, but I can't seem to get it right.

  5. Dylan Kuhn
    Member
    Plugin Author

    Posted 2 years ago #

    You may have the same problem as before - maybe the current post doesn't have the coordinates you want? You could add var_dump( $coords ); to see what you're getting.

  6. Dylan Kuhn
    Member
    Plugin Author

    Posted 2 years ago #

    I didn't answer your second question. In Geo Mashup 1.4 you'll use map_post_type=post to eliminate pages.

  7. mariostella
    Member
    Posted 2 years ago #

    Hi, I tried echoing the coordinates prior to trying it out and they work, but I guess my php syntax is wrong in the code above. As for the second answer, great, will be waiting for 1.4 even more anxiously!
    Thanks for your replies

  8. Dylan Kuhn
    Member
    Plugin Author

    Posted 2 years ago #

    The syntax looks like it should work to me (you could add a semicolon at the end, and the last . '' isn't necessary, but these shouldn't cause errors). I'd have to be able to troubleshoot a bit to tell you for sure what's wrong.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags