Chris

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 1,071 total)
  • Author
    Posts
  • in reply to: Links in map open a new window #18404

    Chris
    Keymaster

    Hi,

    Sorry for the confusion, I think I misunderstood your original question.  This should help:

    To control what happens when a marker is clicked: use the settings ‘open POI’, ‘open post’, and  ‘open post in new tab’.  One of these options (‘open post’) wasn’t working properly – I had planned to deprecate it, but left it on the settings screen.  This is fixed in 2.53.3.

    To control what happens when the POI title is clicked (I think this is what you want to do): use the ‘templates’ section in the MapPress settings to edit the ‘mashup popup’ template.  In that template you’ll see:

    <div class='mapp-title'><a href='{{{poi.url}}}' target='_blank'>{{{poi.title}}}</a>

    Just change it to this (remove the target=’_blank’) and save:

    <div class='mapp-title'><a href='{{{poi.url}}}'>{{{poi.title}}}</a>

     

    in reply to: MapBox styles stopped loading with 2.53.2 #18401

    Chris
    Keymaster

    Hi Jay,

    Per our emails on this, the problem was due to a change by MapBox.  Their styles used to be prefixed with ‘http://’ but now they’re ‘mapbox://’.  MapPress 2.53.2 should work with both URL types.

    Hopefully this will help anyone else having the same issue.

    in reply to: scroll zoom with google map #18378

    Chris
    Keymaster

    Are you using Leaflet or Google?  Leaflet is “scrollwheelzoom”, Google is “scrollwheel”.

    in reply to: Leaflet / OpenStreetMaps with incorrect location #18355

    Chris
    Keymaster

    Hi,

    I’ve just published version 2.53, which includes an option on the MapPress setting screen to select the geocoder you’d like to use.

    Algolia is built on OpenStreetMap data, but it turns out it doesn’t do street number geocoding, even if it’s available on OSM.  In other words, it will just show the middle of the nearest street, even if OSM has more specific data.  That’s why the address “383 Woodbury Ave, Portsmouth, NH 03801” works on OSM but not in Algolia.

    OSM itself seems to have spotty street-level data.  It worked for some areas I tried, but not others.  You can use the OSM geocoder called Nominatim by selecting it on the settings screen.

    I’ve also added a MapBox option.  Their geocoder seems to be more accurate.

    Be sure to read the geocoders terms of use for usage limits and other restrictions – there are links to them in the MapPress documentation.

    I tried many other geocoders, but most are based on OSM, and thus are no better than Nominatim.  There is one called geocod.io, which looks useful.  They are free and seem to be accurate, but only cover the USA.

    I didn’t implement geocod.io yet because I wasn’t sure anyone needs it.  But if you, or anyone else, would like to have geocod.io (or any other geocoder), added to MapPress, please let me know.


    Chris
    Keymaster

    Hi,

    I think you’ve narrowed this down to an error with Query Monitor, but please let me know if you think it’s a bug in MapPress.   If so, it’d be helpful to have a URL where I can see the problem.

    in reply to: map deleted #18342

    Chris
    Keymaster

    Hi,

    As far as  I know, it’s not possible to maps to delete themselves.  However, one thing that is sometimes confusing is that the maps are attached to the post where they are created and not the post to where they are displayed.

    Is it possible the missing map was actually created in a different post, but displayed in the post which remains?

    in reply to: Mashup popup template simple formatting change #18340

    Chris
    Keymaster

    Hi,

    I couldn’t see the image.  A URL would be more useful, do you have one you can share?  You can use the contact form or email if you don’t want to post it here.

     

     

    in reply to: Mashup Popup template #18337

    Chris
    Keymaster

    Maybe specify the last argument ‘single’ = true for get_post_meta, otherwise I think it will return an array:

    https://developer.wordpress.org/reference/functions/get_post_meta/

    in reply to: Mashup Popup template #18334

    Chris
    Keymaster

    Hi

    I see a few small problems in the filter & template:

    1) For the filter, you begin by appending to $html, but it’s not defined yet.  So replace:

    $html .= '<span class="price label label-warning">';

    with:

     $html = '<span class="price label label-warning">';

    2) In the template, I’d suggest using ‘<span>’ instead of ‘i’.  Also, when you use two braces the HTML is escaped – i.e. the returned HTML from the filter was being escaped.  Use 3 braces instead, which outputs the value without modifying it:

    <h3>{{{poi.title}}}</h3>
    {{{poi.thumbnail}}}
    <br />
    <ul class="infos">
    <# if (poi.props.annonce_surface) { #>
    <span class="fal fa-home" aria-hidden="true"></span> {{poi.props.annonce_surface}} m²
    <# } #>
    <span class="fal fa-bed" aria-hidden="true"></span> {{poi.props.annonce_chambres}} chambre(s)
    <span class="fal fa-bath" aria-hidden="true"></span> {{poi.props.annonce_sdb}} SDB
    {{{poi.props.prix}}} €
    in reply to: Mashup Popup template #18330

    Chris
    Keymaster

    Hi,

    Can you share your popup template?  I’m wondering if maybe the error is there.

    in reply to: Links in map open a new window #18328

    Chris
    Keymaster

    Hi,

    Have a look at the MapPress settings screen in the ‘POI Click’ section, I think ‘Open post’ may be what you want.

    in reply to: Mashup Popup template #18326

    Chris
    Keymaster

    Hi,

    I don’t know what the problem is, but I can’t test with your data.  One thing I can suggest is just to return some text and make sure it’s displaying in the template.  Once you get that working you can try to debug the other code.

    For example, replace this:

    $props['prix'] = $html;
    

    with:

    $props['prix'] = 'TESTING';

    Once that’s working, you can add the other lines one by one to find the problem.

    in reply to: Mashup Popup template #18322

    Chris
    Keymaster

    Yes, but you would use your calculation to return the value.  It would look something like this (this is just pseudo-code – I haven’t tested it):

    function myfilter($props, $postid, $poi) {
      $price = annonce_detail('annonce_prix');
      $html = number_format( $price, 0, ',', ' ' ) . ' € ';
      if ( has_term( 'location', 'offre' ) )
        $html .= '<small>/ mois</small>';
      if ( has_term( 'location-saisonniere', 'offre', $postid ) )
        $html .= '<small>/ nuit</small>';
      $props['prix'] = $html;
      return $props;
    }
    in reply to: Mashup Popup template #18319

    Chris
    Keymaster

    Hi,

    Have you read the documentation yet?  There’s an example there of using the PHP filter to pass a value to the template.

    In this case, you would use that filter to pass the result of your function to the template as a property, then display that property in the template.

     

    in reply to: Mashup Popup template #18316

    Chris
    Keymaster

    I’m not sure if it’s clear, but PHP code can’t be used for calculation in the template itself.  The templates use JavaScript, and they only execute when a popup is displayed.

    So, using has_term() in the template won’t do anything useful.  Instead, you need to do the calculations for each post using the mappress_poi_props filter.  The results are then passed to the template for display using the poi.props array.

    There’s an example of using the filter to pass a custom value to the template here in the MapPress documentation:

    https://mappresspro.com/mappress-documentation/#toc-mappress-templating

     

Viewing 15 posts - 1 through 15 (of 1,071 total)